Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e2167055
Commit
e2167055
authored
Oct 16, 2000
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the usual (part II)
parent
98c8184f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
30 deletions
+40
-30
Lib/dos-8x3/test_mat.py
Lib/dos-8x3/test_mat.py
+40
-30
No files found.
Lib/dos-8x3/test_mat.py
View file @
e2167055
...
...
@@ -153,33 +153,43 @@ print 'tanh'
testit
(
'tanh(0)'
,
math
.
tanh
(
0
),
0
)
testit
(
'tanh(1)+tanh(-1)'
,
math
.
tanh
(
1
)
+
math
.
tanh
(
-
1
),
0
)
print
'exceptions'
# oooooh, *this* is a x-platform gamble! good luck
try
:
x
=
math
.
exp
(
-
1000000000
)
except
:
# mathmodule.c is failing to weed out underflows from libm, or
# we've got an fp format with huge dynamic range
raise
TestFailed
(
"underflowing exp() should not have rasied an exception"
)
if
x
!=
0
:
raise
TestFailed
(
"underflowing exp() should have returned 0"
)
# If this fails, probably using a strict IEEE-754 conforming libm, and x
# is +Inf afterwards. But Python wants overflows detected by default.
try
:
x
=
math
.
exp
(
1000000000
)
except
OverflowError
:
pass
else
:
raise
TestFailed
(
"overflowing exp() didn't trigger OverflowError"
)
# If this fails, it could be a puzzle. One odd possibility is that
# mathmodule.c's CHECK() macro is getting confused while comparing
# Inf (HUGE_VAL) to a NaN, and artificially setting errno to ERANGE
# as a result (and so raising OverflowError instead).
try
:
x
=
math
.
sqrt
(
-
1.0
)
except
ValueError
:
pass
else
:
raise
TestFailed
(
"sqrt(-1) didn't raise ValueError"
)
# RED_FLAG 16-Oct-2000 Tim
# While 2.0 is more consistent about exceptions than previous releases, it
# still fails this part of the test on some platforms. For now, we only
# *run* test_exceptions() in verbose mode, so that this isn't normally
# tested.
def
test_exceptions
():
print
'exceptions'
try
:
x
=
math
.
exp
(
-
1000000000
)
except
:
# mathmodule.c is failing to weed out underflows from libm, or
# we've got an fp format with huge dynamic range
raise
TestFailed
(
"underflowing exp() should not have raised "
"an exception"
)
if
x
!=
0
:
raise
TestFailed
(
"underflowing exp() should have returned 0"
)
# If this fails, probably using a strict IEEE-754 conforming libm, and x
# is +Inf afterwards. But Python wants overflows detected by default.
try
:
x
=
math
.
exp
(
1000000000
)
except
OverflowError
:
pass
else
:
raise
TestFailed
(
"overflowing exp() didn't trigger OverflowError"
)
# If this fails, it could be a puzzle. One odd possibility is that
# mathmodule.c's CHECK() macro is getting confused while comparing
# Inf (HUGE_VAL) to a NaN, and artificially setting errno to ERANGE
# as a result (and so raising OverflowError instead).
try
:
x
=
math
.
sqrt
(
-
1.0
)
except
ValueError
:
pass
else
:
raise
TestFailed
(
"sqrt(-1) didn't raise ValueError"
)
if
verbose
:
test_exceptions
()
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