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
  0 siblings, 0 replies; only message 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] only message in thread

only message in thread, other threads:[~2025-07-03  7:44 UTC | newest]

Thread overview: (only message) (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

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).