In message <[EMAIL PROTECTED]> on Thu, 11 Dec 2003 11:41:48 -0500, Jim Schneider 
<[EMAIL PROTECTED]> said:

jschneid> On Thursday 11 December 2003 02:16, Rhett Garber via RT wrote:
jschneid> > I have a simple program that uses the BIO printf functionality:
jschneid> >
jschneid> > #include <stdio.h>
jschneid> > #include "openssl/bio.h"
jschneid> >
jschneid> >
jschneid> > int main(int argc, char* argv[])
jschneid> > {
jschneid> >     BIO *myBio = BIO_new_fp(stdout, 0);
jschneid> >     BIO_printf(myBio, "float: %.1f\n", (float) 1000.1234);
jschneid> >     return 0;
jschneid> > }
jschneid> >
jschneid> >
jschneid> > When I run this against either of our builds of 0.9.7c (or
jschneid> > b) on HP-UX (PA and IA) the output of the above program
jschneid> > will be "float: 000.1"  Note that the front part of the
jschneid> > whole value is cut off. 
jschneid> >
jschneid> > This does not occur on Linux.
jschneid> 
jschneid> What is the result of running this on your machine?
jschneid> ---<BEGIN CODE>---
jschneid> #include <stdio.h>
jschneid> 
jschneid> int main(void)
jschneid> {
jschneid>       printf("float: %.1f\n", (float) 1000.1234);
jschneid>       return 0;
jschneid> }
jschneid> ---<END CODE>----
jschneid> 
jschneid> If this also results in "float: 000.1", then the error is in
jschneid> the HP compiler or libraries.  Given the peculiar field
jschneid> truncation, I'm guessing this is a library problem (but I
jschneid> don't have access to an HP system to check).

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

-----
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