Hi Walter,

I can't see it either, but (using Delphi 5 on WinXP Pro) I confirm your
results. If you move the multiplication operation out of the function call,
as in

d := 2.3*10;
label1.caption := IntToStr( Trunc( d ) );

you get 23 as expected...

Ariel

On 10/13/05, Walter Prins <[EMAIL PROTECTED]> wrote:
>
> Hi guys,
>
> I'm having a blonde moment here, or this is a strange bug... Can anyone
> point out what I'm missing: why the following test-case produces a label
> with a caption of '22' and not '23'???? Or is this just a case of floating
> point imprecision? (To reproduce create a new project, drop a button and a
> label on a form and replace the click event handler with the following:)
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
> d : Double;
> begin
> d := 2.3;
> // 2.3 * 10 = 23.0, Trunc(23.0) = 23, IntToStr(23) = '23'
> label1.caption := IntToStr( Trunc( d * 10 ) ); { produces '22' , not
> 23!!! Why!!!?? }
> end;
>
> It must be something obvious but I can't see it...
>
> Walter
>
>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED]
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Reply via email to