mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
To: musl@lists.openwall.com
Cc: maxence.ponsardin@inria.fr
Subject: [musl] sqrt does not emit errno=EDOM
Date: Thu, 03 Jul 2025 09:44:12 +0200	[thread overview]
Message-ID: <p9u01pqx90s3.fsf@araignee.loria.fr> (raw)

       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


             reply	other threads:[~2025-07-03  7:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03  7:44 Paul Zimmermann [this message]
2025-07-03  8:00 ` sqrt does not emit errno=EDOM Damian McGuckin
2025-07-03 20:05 ` Rich Felker
2025-07-04  9:00   ` Paul Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=p9u01pqx90s3.fsf@araignee.loria.fr \
    --to=paul.zimmermann@inria.fr \
    --cc=maxence.ponsardin@inria.fr \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).