[Python-bugs-list] [ python-Bugs-532631 ] Confusions in formatfloat

SourceForge.net noreply@sourceforge.net
Tue, 07 Jan 2003 17:24:16 -0800


Bugs item #532631, was opened at 2002-03-20 13:34
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=532631&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Nobody/Anonymous (nobody)
Summary: Confusions in formatfloat

Initial Comment:
stringobject.c's formatfloat seems confused in a 
couple respects.

1. Testing "fabs(x)/1e25 >= 1e25" is pretty baffling.  
What is it intending to do?  If it means what it says, 
it should be the simpler "fabs(x) >= 1e50".  But maybe 
it really intended to test "fabs(x) >= 1e25".

2. The "worst case length calc" is fantasy in some %f 
cases.  It assumes there's one digit before the 
decimal point, but, e.g., '%.100f'% 1e49 produces 
dozens of digits before the decimal point.  We're 
saved from a buffer overrun thanks to the PyOS_snprintf
() following, but unclear that truncation is sensible 
here (e.g., the user asked for a precision of 100 
here, but only gets back 50 digits after the decimal 
point).

Complication:  we're deliberately replacing C's %f 
with C's %g in some cases, but the docs don't document 
the rules Python intends for %f.

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-01-07 20:24

Message:
Logged In: YES 
user_id=33168

Tim, did MALs recent checkin fix any of these problems?  Is
doc the only thing left to do?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=532631&group_id=5470