Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
cmucl
cmucl
Commits
e655d017
Commit
e655d017
authored
Dec 23, 2015
by
Raymond Toy
Browse files
Use setexception to raise the inexact exception for asin.
o Add tests for this o Use setexception for inexact in e_asin.c.
parent
0d53bc7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lisp/e_asin.c
View file @
e655d017
...
...
@@ -89,7 +89,12 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
return
fdlibm_setexception
(
x
,
FDLIBM_INVALID
);
}
else
if
(
ix
<
0x3fe00000
)
{
/* |x|<0.5 */
if
(
ix
<
0x3e400000
)
{
/* if |x| < 2**-27 */
if
(
huge
+
x
>
one
)
return
x
;
/* return x with inexact if x!=0*/
/* return x inexact except 0 */
if
(
x
!=
0
)
{
fdlibm_setexception
(
x
,
FDLIBM_INEXACT
);
}
return
x
;
}
else
t
=
x
*
x
;
p
=
t
*
(
pS0
+
t
*
(
pS1
+
t
*
(
pS2
+
t
*
(
pS3
+
t
*
(
pS4
+
t
*
pS5
)))));
...
...
tests/fdlibm.lisp
View file @
e655d017
...
...
@@ -556,4 +556,21 @@
(
assert-eql
-1d0
(
tanh
-100d0
))
;; tanh(1d300), no overflow
(
assert-eql
1d0
(
tanh
most-positive-double-float
))
(
assert-eql
-1d0
(
tanh
(
-
most-positive-double-float
))))
\ No newline at end of file
(
assert-eql
-1d0
(
tanh
(
-
most-positive-double-float
))))
(
define-test
asin-basic-tests
(
:tag
:fdlibm
)
(
let
((
x
(
scale-float
1d0
-28
))
(
x0
0d0
))
;; asin(x) = x for |x| < 2^-27, with inexact exception if x is not 0.
(
assert-eql
x
(
asin
x
))
(
assert-eql
(
-
x
)
(
asin
(
-
x
)))
(
with-inexact-exception-enabled
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
(
assert-eql
0d0
(
asin
x0
)))
(
with-inexact-exception-enabled
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
asin
x
)))))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment