Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <p9u01pqx90s3.fsf@araignee.loria.fr>
Date: Thu, 03 Jul 2025 09:44:12 +0200
From: Paul Zimmermann <Paul.Zimmermann@...ia.fr>
To: musl@...ts.openwall.com
CC: maxence.ponsardin@...ia.fr
Subject: sqrt does not emit errno=EDOM

       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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.