mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] sqrt does not emit errno=EDOM
@ 2025-07-03  7:44 Paul Zimmermann
  2025-07-03  8:00 ` Damian McGuckin
  2025-07-03 20:05 ` Rich Felker
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Zimmermann @ 2025-07-03  7:44 UTC (permalink / raw)
  To: musl; +Cc: maxence.ponsardin

       Hi,

it seems musl does not set errno=EDOM for sqrt(x) when x is negative.
Here on cfarm27 (Alpine Linux):

$ cat /tmp/e.c
#include <stdio.h>
#include <math.h>
#include <errno.h>
 
int
main()
{
  errno = 0;
  float x = -1.0f;
  float y = sqrtf (x);
  printf ("y=%a errno=%d\n", y, errno);
}

$ gcc /tmp/e.c -lm
$ ./a.out 
y=-nan errno=0

Is this a known issue?

Best regards,
Paul


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-04  9:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03  7:44 [musl] sqrt does not emit errno=EDOM Paul Zimmermann
2025-07-03  8:00 ` Damian McGuckin
2025-07-03 20:05 ` Rich Felker
2025-07-04  9:00   ` Paul Zimmermann

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).