In message <[EMAIL PROTECTED]> on Thu, 11 Dec 2003 17:53:51 +0100 (CET), Richard 
Levitte - VMS Whacker <[EMAIL PROTECTED]> said:

levitte> I get ooo.1 with BIO_printf() and 1000.1 with printf().  It's clear to
levitte> me that this is in fact a bug in OpenSSL (especially since fmtfp()
levitte> does all the calculations itself, and doesn't rely on printf() in any
levitte> way).  I'm investigating right now.

(actually, I got 000.1, not ooo.1...)

OK, the bug is found.  This is the code that causes the problem, do
you think you can spot it?  A hint: the integer part will *always* be
truncated to the three least significant digits...


    /* convert integer part */
    do {
        iconvert[iplace++] =
            (caps ? "0123456789ABCDEF"
              : "0123456789abcdef")[intpart % 10];
        intpart = (intpart / 10);
    } while (intpart && (iplace < (int)sizeof(iplace)));
    if (iplace == sizeof iplace)
        iplace--;
    iconvert[iplace] = 0;



I'll produce patches shortly, but first I've got to figure out some
funnies with the fractional part.  The following source:

        BIO_printf(myBio, "float: %.5f\n", (float) 21000.123456);

produces this:

        000.12305

(well actually, after I've corrected the integer part bug, it actually
outputs 21000.12305 :-)).

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.
You don't have to be rich, a $10 donation is appreciated!

-- 
Richard Levitte   \ Tunnlandsvägen 3  \ [EMAIL PROTECTED]
[EMAIL PROTECTED]  \ S-168 36  BROMMA  \ T: +46-8-26 52 47
                    \      SWEDEN       \ or +46-708-26 53 44
Procurator Odiosus Ex Infernis                -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/

Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to