Mercurial > cpython-lru_cache-weakref
annotate Python/hypot.c @ 13658:f79434ee41fa legacy-trunk
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
declarations yet, those come later.
| author | Thomas Wouters <thomas@python.org> |
|---|---|
| date | Sat, 22 Jul 2000 18:47:25 +0000 |
| parents | 37d009b1bf45 |
| children | 59f8cedcf049 |
| rev | line source |
|---|---|
| 4176 | 1 /* hypot() replacement */ |
| 2 | |
| 3 #include "config.h" | |
| 4 #include "myproto.h" | |
| 5 #include "mymath.h" | |
| 6 | |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
4176
diff
changeset
|
7 double hypot(double x, double y) |
| 4176 | 8 { |
| 9 double yx; | |
| 10 | |
| 11 x = fabs(x); | |
| 12 y = fabs(y); | |
| 13 if (x < y) { | |
| 14 double temp = x; | |
| 15 x = y; | |
| 16 y = temp; | |
| 17 } | |
| 18 if (x == 0.) | |
| 19 return 0.; | |
| 20 else { | |
| 21 yx = y/x; | |
| 22 return x*sqrt(1.+yx*yx); | |
| 23 } | |
| 24 } |
