Mercurial > cpython-lru_cache-weakref
annotate Python/hypot.c @ 24866:f0dbd5b49d8a legacy-trunk
Streamline the fast track for CFunction calls a bit more: there was
nothing special done if keyword arguments were present, so test for
that earlier and fall through to the normal case if there are any.
This ought to slow down CFunction calls with keyword args, but I don't
care; it's a tiny (1%) improvement for pystone.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 16 Aug 2002 16:14:00 +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 } |
