🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6318

Re: format question

#6318
From: Heinrich Wolf
Date: Wed, 25 May 2005 18:04
15 lines
1351 bytes
"JD" <nospam@nospam.com> schrieb im Newsbeitrag 
news:4293a9ba$1@newsgroups.borland.com...
...

>    int WholePortion = SomeFloat;
>    int DecimalPortion = (SomeFloat - WholePortion) * 100;
>    Buffer.sprintf("%06d.%d", WholePortion, DecimalPortion );

That will give wrong output on e.g. SomeFloat = 25.06 !
The Format for WholePortion and DecimalPortion must be
"%06d.%02d"

But why for heaven's sake not:
Buffer.sprintf("%06.2f", SomeFloat); ?
Technical Details
Message-ID: <3fjt23F88dlhU1@individual.net>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <4292f5a8$1@newsgroups.borland.com> <42931256$1@newsgroups.borland.com> <42933ba8$1@newsgroups.borland.com> <4293a9ba$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3b7f7b4a56d80b10
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: "Heinrich Wolf" <invalid@invalid.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: format question
Date: Wed, 25 May 2005 20:04:52 +0200
Lines: 17
Message-ID: <3fjt23F88dlhU1@individual.net>
References: <4292f5a8$1@newsgroups.borland.com> <42931256$1@newsgroups.borland.com> <42933ba8$1@newsgroups.borland.com> <4293a9ba$1@newsgroups.borland.com>
X-Trace: individual.net /Xr5KzC1KQ+h+ZkXohuJvg82Q1CdFDUsIR0zNRVoniK8CYOmy8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Original