Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl-copy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard M Kreuter
cmucl-copy
Commits
fc1c9daa
Commit
fc1c9daa
authored
9 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Replace with-inexact-exception-enabled with with-float-traps-enabled.
parent
6a6908fb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/fdlibm.lisp
+20
-25
20 additions, 25 deletions
tests/fdlibm.lisp
with
20 additions
and
25 deletions
tests/fdlibm.lisp
+
20
−
25
View file @
fc1c9daa
...
@@ -14,11 +14,6 @@
...
@@ -14,11 +14,6 @@
(
kernel:make-double-float
#x7ff00000
1
)
(
kernel:make-double-float
#x7ff00000
1
)
"A randon signaling MaN value"
)
"A randon signaling MaN value"
)
(
defmacro
with-inexact-exception-enabled
(
&body
body
)
`
(
ext:with-float-traps-enabled
(
:inexact
)
,@
body
))
(
define-test
%cosh.exceptions
(
define-test
%cosh.exceptions
(
:tag
:fdlibm
)
(
:tag
:fdlibm
)
(
assert-error
'floating-point-overflow
(
assert-error
'floating-point-overflow
...
@@ -68,11 +63,11 @@
...
@@ -68,11 +63,11 @@
;; sinh(x) = x for |x| < 2^-28. Should signal inexact unless x = 0.
;; sinh(x) = x for |x| < 2^-28. Should signal inexact unless x = 0.
(
let
((
x
(
scale-float
1d0
-29
))
(
let
((
x
(
scale-float
1d0
-29
))
(
x0
0d0
))
(
x0
0d0
))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must not throw an inexact exception because the result
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
;; is exact when the arg is 0.
(
assert-eql
0d0
(
kernel:%sinh
x0
)))
(
assert-eql
0d0
(
kernel:%sinh
x0
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
@@ -87,7 +82,7 @@
...
@@ -87,7 +82,7 @@
(
assert-true
(
ext:float-nan-p
(
kernel:%tanh
*snan*
))))
(
assert-true
(
ext:float-nan-p
(
kernel:%tanh
*snan*
))))
;; tanh(x) = +/- 1 for |x| > 22, raising inexact, always.
;; tanh(x) = +/- 1 for |x| > 22, raising inexact, always.
(
let
((
x
22.1d0
))
(
let
((
x
22.1d0
))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
@@ -123,11 +118,11 @@
...
@@ -123,11 +118,11 @@
(
assert-true
(
ext:float-nan-p
(
kernel:%asinh
*snan*
))))
(
assert-true
(
ext:float-nan-p
(
kernel:%asinh
*snan*
))))
(
let
((
x
(
scale-float
1d0
-29
))
(
let
((
x
(
scale-float
1d0
-29
))
(
x0
0d0
))
(
x0
0d0
))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must not throw an inexact exception because the result
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
;; is exact when the arg is 0.
(
assert-eql
0d0
(
asinh
x0
)))
(
assert-eql
0d0
(
asinh
x0
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
@@ -169,7 +164,7 @@
...
@@ -169,7 +164,7 @@
(
assert-true
(
ext::float-nan-p
(
kernel:%expm1
*snan*
))))
(
assert-true
(
ext::float-nan-p
(
kernel:%expm1
*snan*
))))
;; expm1(x) = -1 for x < -56*log(2), signaling inexact
;; expm1(x) = -1 for x < -56*log(2), signaling inexact
(
let
((
x
(
*
-57
(
log
2d0
))))
(
let
((
x
(
*
-57
(
log
2d0
))))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
(
kernel:%expm1
x
)))))
(
kernel:%expm1
x
)))))
...
@@ -188,11 +183,11 @@
...
@@ -188,11 +183,11 @@
;; log1p(x) = x for |x| < 2^-54, signaling inexact except for x = 0.
;; log1p(x) = x for |x| < 2^-54, signaling inexact except for x = 0.
(
let
((
x
(
scale-float
1d0
-55
))
(
let
((
x
(
scale-float
1d0
-55
))
(
x0
0d0
))
(
x0
0d0
))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must not throw an inexact exception because the result
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
;; is exact when the arg is 0.
(
assert-eql
0d0
(
kernel:%log1p
x0
)))
(
assert-eql
0d0
(
kernel:%log1p
x0
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
@@ -222,11 +217,11 @@
...
@@ -222,11 +217,11 @@
(
let
((
x
(
scale-float
1d0
-29
))
(
let
((
x
(
scale-float
1d0
-29
))
(
x0
0d0
))
(
x0
0d0
))
;; exp(x) = x, |x| < 2^-28, with inexact exception unlees x = 0
;; exp(x) = x, |x| < 2^-28, with inexact exception unlees x = 0
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must not throw an inexact exception because the result
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
;; is exact when the arg is 0.
(
assert-eql
1d0
(
kernel:%exp
x0
)))
(
assert-eql
1d0
(
kernel:%exp
x0
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
@@ -282,11 +277,11 @@
...
@@ -282,11 +277,11 @@
;; atan(x) = x for |x| < 2^-29, signaling inexact.
;; atan(x) = x for |x| < 2^-29, signaling inexact.
(
let
((
x
(
scale-float
1d0
-30
))
(
let
((
x
(
scale-float
1d0
-30
))
(
x0
0d0
))
(
x0
0d0
))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must not throw an inexact exception because the result
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
;; is exact when the arg is 0.
(
assert-eql
0d0
(
kernel:%atan
x0
)))
(
assert-eql
0d0
(
kernel:%atan
x0
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
@@ -630,11 +625,11 @@
...
@@ -630,11 +625,11 @@
;; asin(x) = x for |x| < 2^-27, with inexact exception if x is not 0.
;; asin(x) = x for |x| < 2^-27, with inexact exception if x is not 0.
(
assert-eql
x
(
kernel:%asin
x
))
(
assert-eql
x
(
kernel:%asin
x
))
(
assert-eql
(
-
x
)
(
kernel:%asin
(
-
x
)))
(
assert-eql
(
-
x
)
(
kernel:%asin
(
-
x
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must not throw an inexact exception because the result
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
;; is exact when the arg is 0.
(
assert-eql
0d0
(
kernel:%asin
x0
)))
(
assert-eql
0d0
(
kernel:%asin
x0
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
@@ -645,11 +640,11 @@
...
@@ -645,11 +640,11 @@
;; cos(x) = 1 for |x| < 2^-27. Signal inexact unless x = 0
;; cos(x) = 1 for |x| < 2^-27. Signal inexact unless x = 0
(
let
((
x
(
scale-float
1d0
-28
))
(
let
((
x
(
scale-float
1d0
-28
))
(
x0
0d0
))
(
x0
0d0
))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must not throw an inexact exception because the result
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
;; is exact when the arg is 0.
(
assert-eql
1d0
(
kernel:%cos
x0
)))
(
assert-eql
1d0
(
kernel:%cos
x0
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
@@ -660,11 +655,11 @@
...
@@ -660,11 +655,11 @@
;; sin(x) = x for |x| < 2^-27. Signal inexact unless x = 0
;; sin(x) = x for |x| < 2^-27. Signal inexact unless x = 0
(
let
((
x
(
scale-float
1d0
-28
))
(
let
((
x
(
scale-float
1d0
-28
))
(
x0
0d0
))
(
x0
0d0
))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must not throw an inexact exception because the result
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
;; is exact when the arg is 0.
(
assert-eql
0d0
(
kernel:%sin
x0
)))
(
assert-eql
0d0
(
kernel:%sin
x0
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
@@ -675,11 +670,11 @@
...
@@ -675,11 +670,11 @@
;; tan(x) = x for |x| < 2^-28. Signal inexact unless x = 0
;; tan(x) = x for |x| < 2^-28. Signal inexact unless x = 0
(
let
((
x
(
scale-float
1d0
-29
))
(
let
((
x
(
scale-float
1d0
-29
))
(
x0
0d0
))
(
x0
0d0
))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must not throw an inexact exception because the result
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
;; is exact when the arg is 0.
(
assert-eql
0d0
(
kernel:%tan
x0
)))
(
assert-eql
0d0
(
kernel:%tan
x0
)))
(
with-
inexact-exception-enabled
(
ext:
with-
float-traps-enabled
(
:inexact
)
;; This must throw an inexact exception for non-zero x even
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
;; though the result is exactly x.
(
assert-error
'floating-point-inexact
(
assert-error
'floating-point-inexact
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment