Page MenuHomePhabricator

[libc] Add implementations of nextafter[f|l] functions.

Authored by sivachandra on Jan 5 2021, 12:03 PM.



A differential fuzzer for these functions has also been added.
Along the way, a small correction has been done to the normal/subnormal
limits of x86 long double values.

Diff Detail

Event Timeline

sivachandra created this revision.Jan 5 2021, 12:03 PM
sivachandra requested review of this revision.Jan 5 2021, 12:03 PM

Add a TODO about raising floating point exceptions in a later pass.

Add test source file missed previously.

Harbormaster completed remote builds in B84092: Diff 314681.

Add nextafter* to the list of aarch64 entrypoints.

lntue added inline comments.Jan 5 2021, 4:00 PM

We can reduce the if-else chain a bit as follows:

if (from != T(0.0)) {
  if ((from < to) == (from > T(0.0)) {
  } else {
} else {
  intVal = (to.bitsAsUInt() & signMask) + UIntType(1);

Address comments.

sivachandra marked an inline comment as done.Jan 5 2021, 6:05 PM
lntue accepted this revision.Jan 5 2021, 8:45 PM
This revision is now accepted and ready to land.Jan 5 2021, 8:45 PM
This revision was landed with ongoing or failed builds.Jan 5 2021, 10:32 PM
This revision was automatically updated to reflect the committed changes.