Mercurial > cpython-lru_cache-weakref
annotate Python/hypot.c @ 19600:1cece743a708 legacy-trunk
Removed some unreachable break statements to silence SGI compiler.
| author | Sjoerd Mullender <sjoerd@acm.org> |
|---|---|
| date | Thu, 30 Aug 2001 14:05:20 +0000 |
| parents | 2dea40e40d9d |
| children | 7bc4cc972b0b |
| rev | line source |
|---|---|
| 4176 | 1 /* hypot() replacement */ |
| 2 | |
|
18835
2dea40e40d9d
Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774.
Martin v. Löwis <martin@v.loewis.de>
parents:
13761
diff
changeset
|
3 #include "pyconfig.h" |
|
13761
59f8cedcf049
merge Include/my*.h into Include/pyport.h
Peter Schneider-Kamp <nowonder@nowonder.de>
parents:
13658
diff
changeset
|
4 #include "pyport.h" |
| 4176 | 5 |
|
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 } |
