Mercurial > cpython-lru_cache-weakref
annotate Python/hypot.c @ 44825:ef859cd754a7 legacy-trunk
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Sun, 20 Jan 2008 14:28:28 +0000 |
| parents | 7bc4cc972b0b |
| children |
| rev | line source |
|---|---|
| 4176 | 1 /* hypot() replacement */ |
| 2 | |
|
43829
7bc4cc972b0b
Merged revisions 58939-58946 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
18835
diff
changeset
|
3 #include "Python.h" |
| 4176 | 4 |
|
44825
ef859cd754a7
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
Christian Heimes <christian@cheimes.de>
parents:
43829
diff
changeset
|
5 #ifndef HAVE_HYPOT |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
4176
diff
changeset
|
6 double hypot(double x, double y) |
| 4176 | 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 } | |
|
44825
ef859cd754a7
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
Christian Heimes <christian@cheimes.de>
parents:
43829
diff
changeset
|
24 #endif /* HAVE_HYPOT */ |
|
ef859cd754a7
Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
Christian Heimes <christian@cheimes.de>
parents:
43829
diff
changeset
|
25 |
