1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

sqrt() now returns NAN, rather than 0, if the argument is < 0

Thanks go to sodero for providing the fix.
This commit is contained in:
obarthel
2025-07-12 12:26:34 +02:00
parent 2704ff880f
commit f49877920e

View File

@ -1,10 +1,8 @@
/* /*
* $Id: math_sqrt.c,v 1.9 2006-09-22 07:54:24 obarthel Exp $
*
* :ts=4 * :ts=4
* *
* Portable ISO 'C' (1994) runtime library for the Amiga computer * Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net> * Copyright (c) 2002-2025 by Olaf Barthel <obarthel (at) gmx.net>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -251,7 +249,8 @@ sqrt(double x)
} }
else else
{ {
result = 0; result = NAN;
__set_errno(EDOM); __set_errno(EDOM);
} }