mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* missing/acosh.c (atanh): should set ERANGE to errno if parameter
is the boundary case. fixed [ruby-dev:35155] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6bb934c482
commit
363b0bddde
2 changed files with 14 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <errno.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include "ruby.h"
|
||||
|
||||
/* DBL_MANT_DIG must be less than 4 times of bits of int */
|
||||
#ifndef DBL_MANT_DIG
|
||||
|
@ -79,6 +80,14 @@ atanh(double x)
|
|||
if (z < SMALL_CRITERIA) return x;
|
||||
z = log(z > 1 ? -1 : (1 + z) / (1 - z)) / 2;
|
||||
if (neg) z = -z;
|
||||
if (isinf(z))
|
||||
#if defined(ERANGE)
|
||||
errno = ERANGE;
|
||||
#elif defined(EDOM)
|
||||
errno = EDOM;
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
return z;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue