VirtualBox

Ignore:
Timestamp:
Aug 14, 2022 1:03:18 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
153004
Message:

IPRT/nocrt: *round[fl] fixes. bugref:10261

Location:
trunk/src/VBox/Runtime/common/math
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/math/llround.cpp

    r96126 r96196  
    4242        rd = RT_NOCRT(round)(rd);
    4343        if (rd >= (double)LLONG_MIN && rd <= (double)LLONG_MAX)
    44             return (long)rd;
     44            return (long long)rd;
    4545        /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
    46         return rd > 0 ? LLONG_MAX : LLONG_MIN;
     46        return rd > 0.0 ? LLONG_MAX : LLONG_MIN;
    4747    }
    4848    /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
     49    if (RT_NOCRT(isinf)(rd) && rd < 0.0)
     50        return LLONG_MIN;
    4951    return LLONG_MAX;
    5052}
  • trunk/src/VBox/Runtime/common/math/llroundf.cpp

    r96126 r96196  
    4242        r32 = RT_NOCRT(roundf)(r32);
    4343        if (r32 >= (float)LLONG_MIN && r32 <= (float)LLONG_MAX)
    44             return (long)r32;
     44            return (long long)r32;
    4545        /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
    46         return r32 > 0 ? LLONG_MAX : LLONG_MIN;
     46        return r32 > 0.0f ? LLONG_MAX : LLONG_MIN;
    4747    }
    4848    /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
     49    if (RT_NOCRT(__isinff)(r32) && r32 < 0.0)
     50        return LLONG_MIN;
    4951    return LLONG_MAX;
    5052}
  • trunk/src/VBox/Runtime/common/math/llroundl.cpp

    r96126 r96196  
    4242        lrd = RT_NOCRT(roundl)(lrd);
    4343        if (lrd >= (long double)LLONG_MIN && lrd <= (long double)LLONG_MAX)
    44             return (long)lrd;
     44            return (long long)lrd;
    4545        /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
    46         return lrd > 0 ? LLONG_MAX : LLONG_MIN;
     46        return lrd > 0.0L ? LLONG_MAX : LLONG_MIN;
    4747    }
    4848    /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
     49    if (RT_NOCRT(__isinfl)(lrd) && lrd < 0.0)
     50        return LLONG_MIN;
    4951    return LLONG_MAX;
    5052}
  • trunk/src/VBox/Runtime/common/math/lround.cpp

    r96126 r96196  
    4444            return (long)rd;
    4545        /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
    46         return rd > 0 ? LONG_MAX : LONG_MIN;
     46        return rd > 0.0 ? LONG_MAX : LONG_MIN;
    4747    }
    4848    /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
     49    if (RT_NOCRT(isinf)(rd) && rd < 0.0)
     50        return LONG_MIN;
    4951    return LONG_MAX;
    5052}
  • trunk/src/VBox/Runtime/common/math/lroundf.cpp

    r96126 r96196  
    4444            return (long)r32;
    4545        /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
    46         return r32 > 0 ? LONG_MAX : LONG_MIN;
     46        return r32 > 0.0f ? LONG_MAX : LONG_MIN;
    4747    }
    4848    /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
     49    if (RT_NOCRT(__isinff)(r32) && r32 < 0.0)
     50        return LONG_MIN;
    4951    return LONG_MAX;
    5052}
  • trunk/src/VBox/Runtime/common/math/lroundl.cpp

    r96126 r96196  
    4444            return (long)lrd;
    4545        /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
    46         return lrd > 0 ? LONG_MAX : LONG_MIN;
     46        return lrd > 0.0L ? LONG_MAX : LONG_MIN;
    4747    }
    4848    /** @todo RT_NOCRT(feraiseexcept)(FE_INVALID); */
     49    if (RT_NOCRT(__isinfl)(lrd) && lrd < 0.0)
     50        return LONG_MIN;
    4951    return LONG_MAX;
    5052}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette