Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
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
Carl Shapiro
cmucl
Commits
7916cfb0
Commit
7916cfb0
authored
11 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Add more tests for exceptional values for cos and tan. Add a few
comments.
parent
9c4bcc61
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
src/tests/trig.lisp
+26
-2
26 additions, 2 deletions
src/tests/trig.lisp
with
26 additions
and
2 deletions
src/tests/trig.lisp
+
26
−
2
View file @
7916cfb0
;;; Tests for the basic trig functions, now implemented in Lisp.
(
defpackage
:trig-tests
(
defpackage
:trig-tests
(
:use
:cl
:lisp-unit
))
(
:use
:cl
:lisp-unit
))
...
@@ -52,8 +54,10 @@
...
@@ -52,8 +54,10 @@
"Test sin for exceptional values"
"Test sin for exceptional values"
(
:tag
:sin
:exceptions
)
(
:tag
:sin
:exceptions
)
(
kernel::with-float-traps-masked
()
(
kernel::with-float-traps-masked
()
(
assert-error
'floating-point-invalid-operation
(
sin
ext:double-float-positive-infinity
))
(
assert-error
'floating-point-invalid-operation
(
assert-error
'floating-point-invalid-operation
(
sin
ext:double-float-negative-infinity
))))
(
sin
ext:double-float-positive-infinity
))
(
assert-error
'floating-point-invalid-operation
(
sin
ext:double-float-negative-infinity
))))
(
define-test
cos.signed-zeroes
(
define-test
cos.signed-zeroes
"Test cos for 0d0 and -0d0"
"Test cos for 0d0 and -0d0"
...
@@ -104,6 +108,15 @@
...
@@ -104,6 +108,15 @@
(
assert-eql
-0.9258790228548379d0
(
assert-eql
-0.9258790228548379d0
(
cos
(
scale-float
1d0
120
))))
(
cos
(
scale-float
1d0
120
))))
(
define-test
cos.exceptions
"Test cos for exceptional values"
(
:tag
:sin
:exceptions
)
(
kernel::with-float-traps-masked
()
(
assert-error
'floating-point-invalid-operation
(
cos
ext:double-float-positive-infinity
))
(
assert-error
'floating-point-invalid-operation
(
cos
ext:double-float-negative-infinity
))))
(
define-test
tan.signed-zeroes
(
define-test
tan.signed-zeroes
"Test tan for 0d0 and -0d0"
"Test tan for 0d0 and -0d0"
(
:tag
:tan
:signed-zeroes
)
(
:tag
:tan
:signed-zeroes
)
...
@@ -150,6 +163,14 @@
...
@@ -150,6 +163,14 @@
(
assert-eql
-4.08066388841804238545143494525595117765084022768d-1
(
assert-eql
-4.08066388841804238545143494525595117765084022768d-1
(
tan
(
scale-float
1d0
120
))))
(
tan
(
scale-float
1d0
120
))))
(
define-test
tan.exceptions
"Test tan for exceptional values"
(
:tag
:sin
:exceptions
)
(
kernel::with-float-traps-masked
()
(
assert-error
'floating-point-invalid-operation
(
tan
ext:double-float-positive-infinity
))
(
assert-error
'floating-point-invalid-operation
(
tan
ext:double-float-negative-infinity
))))
(
define-test
sincos.signed-zeroes
(
define-test
sincos.signed-zeroes
"Test sincos at 0d0, -0d0"
"Test sincos at 0d0, -0d0"
...
@@ -159,6 +180,9 @@
...
@@ -159,6 +180,9 @@
(
assert-equal
'
(
-0d0
1d0
)
(
assert-equal
'
(
-0d0
1d0
)
(
multiple-value-list
(
kernel::%sincos
-0d0
))))
(
multiple-value-list
(
kernel::%sincos
-0d0
))))
;; Test sincos at a bunch of random points and compare the result from
;; sin and cos. If they differ, save the result in a list to be
;; returned.
(
defun
sincos-test
(
limit
n
)
(
defun
sincos-test
(
limit
n
)
(
let
(
results
)
(
let
(
results
)
(
dotimes
(
k
n
)
(
dotimes
(
k
n
)
...
...
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