summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-12-10 22:19:17 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-12-10 22:19:17 (GMT)
commit827b35c9fed9e842c96b41198b26cee96a3e679b (patch)
tree14eb9fb523b002aab63bc4b99fbbd1bae16f56c2 /Include
parentb9f7f24c2537e40e06de6f12c29f786215b64912 (diff)
downloadcpython-827b35c9fed9e842c96b41198b26cee96a3e679b.zip
cpython-827b35c9fed9e842c96b41198b26cee96a3e679b.tar.gz
cpython-827b35c9fed9e842c96b41198b26cee96a3e679b.tar.bz2
Issue #1580: New free format floating point representation based on "Floating-Point Printer Sample Code", by Robert G. Burger. For example repr(11./5) now returns '2.2' instead of '2.2000000000000002'.
Thanks to noam for the patch! I had to modify doubledigits.c slightly to support X64 and IA64 machines on Windows. I also added the new file to the three project files.
Diffstat (limited to 'Include')
-rw-r--r--Include/floatobject.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Include/floatobject.h b/Include/floatobject.h
index 3ec5af5..b9c79c7 100644
--- a/Include/floatobject.h
+++ b/Include/floatobject.h
@@ -76,6 +76,10 @@ PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
*/
PyAPI_FUNC(int) _PyFloat_Repr(double x, char *p, size_t len);
+/* Used to get the important decimal digits of a double */
+PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum);
+PyAPI_FUNC(void) _PyFloat_DigitsInit(void);
+
/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool
* argument, true if the string is in little-endian format (exponent
* last, at p+3 or p+7), false if big-endian (exponent first, at p).