source:
vendor/python/2.5/Python/hypot.c@
3397
| Last change on this file since 3397 was 3225, checked in by , 19 years ago | |
|---|---|
| File size: 282 bytes | |
| Rev | Line | |
|---|---|---|
| [3225] | 1 | /* hypot() replacement */ |
| 2 | ||
| 3 | #include "pyconfig.h" | |
| 4 | #include "pyport.h" | |
| 5 | ||
| 6 | double hypot(double x, double y) | |
| 7 | { | |
| 8 | double yx; | |
| 9 | ||
| 10 | x = fabs(x); | |
| 11 | y = fabs(y); | |
| 12 | if (x < y) { | |
| 13 | double temp = x; | |
| 14 | x = y; | |
| 15 | y = temp; | |
| 16 | } | |
| 17 | if (x == 0.) | |
| 18 | return 0.; | |
| 19 | else { | |
| 20 | yx = y/x; | |
| 21 | return x*sqrt(1.+yx*yx); | |
| 22 | } | |
| 23 | } |
Note:
See TracBrowser
for help on using the repository browser.
