🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
2 messages
2 total messages Started by bugzilla-noreply Wed, 14 Oct 2026 17:00
[Bug 299389] [libm] nextafter[fl] and nexttoward[fl] return incorrect results for MAX value depending on rounding mode
#92
Author: bugzilla-noreply
Date: Wed, 14 Oct 2026 17:00
55 lines
3523 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299389

            Bug ID: 299389
           Summary: [libm] nextafter[fl] and nexttoward[fl] return
                    incorrect results for MAX value depending on rounding
                    mode
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: kargl@FreeBSD.org

While scanning the openlibm bugs, I found

https://github.com/JuliaMath/openlibm/issues/361

which contains code that shows FreeBSD libm (may?) produces
wrong results.  For example, the openlibm bug states
that with FE_UPWARD the following code should return
-inf, but it does not!  [Note, I have not looked at
any of the drafts I have of the C standard to determine
what the correct behavior is.]

% cat next.c
int
main(void)
{
   int rnd;
   double x, y;
   x = -DBL_MAX;
   rnd = fegetround();
   fesetround(FE_UPWARD);
   y = nextafter(-DBL_MAX, -INFINITY);
   fesetround(rnd);
   printf("nextafter(%la, -inf) = %le %la\n", x, y, y);
   return 0;
}

% cc -o z next.c -lm && ./z
nextafter(-0x1.fffffffffffffp+1023, -inf) = -1.797693e+308
-0x1.fffffffffffffp+1023

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 299389] [libm] nextafter[fl] and nexttoward[fl] return incorrect results for MAX value depending on rounding mode
#93
Author: bugzilla-noreply
Date: Wed, 14 Oct 2026 17:28
16 lines
2658 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299389

Mark Linimon <linimon@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|bugs@FreeBSD.org            |numerics@FreeBSD.org

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads