FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/Numerics/Pythagorean.py at codeql-cli/v2.15.5 · github/codeql · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10k
Code
Issues
998
Pull requests
462
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Numerics
/
Pythagorean.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
12 lines (9 loc) · 346 Bytes
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Numerics
/
Pythagorean.py
Copy path
File metadata and controls
12 lines (9 loc) · 346 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
# We know that a^2 + b^2 = c^2, and wish to use this to compute c
from
math
import
sqrt
,
hypot
a
=
3e154
# a^2 > 1e308
b
=
4e154
# b^2 > 1e308
# with these, c = 5e154 which is less that 1e308
def
longSideDirect
():
return
sqrt
(
a
**
2
+
b
**
2
)
# this will overflow
def
longSideBuiltin
():
return
hypot
(
a
,
b
)
# better to use built-in function
Back
|
FazBrowse Home
|
New Git URL