[libc-commits] [PATCH] D93007: [libc] Add implementations of lround[f|l] and llround[f|l].
    Tue Ly via Phabricator via libc-commits 
    libc-commits at lists.llvm.org
       
    Thu Dec 10 08:09:48 PST 2020
    
    
  
lntue added inline comments.
================
Comment at: libc/utils/FPUtil/NearestIntegerOperations.h:168
+  // The standard says that an implementation defined valued is returned
+  // if FE_INVALID is raised. To keep it simple, we return 0 in such cases.
+
----------------
For overflow values, I think it makes more sense to saturate to LONG_(MIN/MAX), LLONG_(MIN/MAX) accordingly, as I doubt most user codes will check for FE_INVALID, and a small floating point error  making the results jump between INT_(MIN/MAX) and 0 might be surprising.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93007/new/
https://reviews.llvm.org/D93007
    
    
More information about the libc-commits
mailing list