Mercurial > cpython-lru_cache-weakref
annotate Python/fmod.c @ 13930:4eaa463c031a legacy-trunk
Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since they
did the same anyway.
I'm not sure what to do with Tools/compiler/compiler/* -- that isn't part of
distutils, is it ? Should it try to be compatible with old bytecode version ?
| author | Thomas Wouters <thomas@python.org> |
|---|---|
| date | Fri, 11 Aug 2000 22:15:52 +0000 |
| parents | 59f8cedcf049 |
| children | 6f6f965c5e2d |
| rev | line source |
|---|---|
| 145 | 1 /*********************************************************** |
|
13255
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
2 Copyright (c) 2000, BeOpen.com. |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
3 Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
4 Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
5 All rights reserved. |
| 145 | 6 |
|
13255
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
7 See the file "Misc/COPYRIGHT" for information on usage and |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
8 redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 145 | 9 ******************************************************************/ |
| 10 | |
| 6 | 11 /* Portable fmod(x, y) implementation for systems that don't have it */ |
| 12 | |
| 2434 | 13 #include "config.h" |
| 14 | |
|
13761
59f8cedcf049
merge Include/my*.h into Include/pyport.h
Peter Schneider-Kamp <nowonder@nowonder.de>
parents:
13256
diff
changeset
|
15 #include "pyport.h" |
| 6 | 16 #include <errno.h> |
| 17 | |
| 18 double | |
| 2434 | 19 fmod(double x, double y) |
| 6 | 20 { |
| 21 double i, f; | |
| 22 | |
| 23 if (y == 0.0) { | |
| 24 errno = EDOM; | |
| 25 return 0.0; | |
| 26 } | |
| 27 | |
| 28 /* return f such that x = i*y + f for some integer i | |
| 29 such that |f| < |y| and f has the same sign as x */ | |
| 30 | |
| 31 i = floor(x/y); | |
| 32 f = x - i*y; | |
| 33 if ((x < 0.0) != (y < 0.0)) | |
| 34 f = f-y; | |
| 35 return f; | |
| 36 } |
