[fpc-devel] FloatToStrF problem
Danie Wessels
Danie.Wessels at pbmr.co.za
Tue Aug 22 14:44:29 CEST 2006
First off: I am new to the list. Have last really worked on Delphi 3
So please bear with me...
(Tell me if my issues was previously addressed elsewhere ..or should be)
I am using Lazarus 0.9.16 beta 9369 on Win2K without access to
fpc community (firewall) and the bug tracker.
I also have not tried to setup RCS.
After finding that FloatToStrF() in a Lazarus program gave a problem, I
tried the example from the docs.
This gave more problems. :(
1.) FloatToStrF()
In my original code: I got 1.0000E-0002
Instead of 1.0000E-02
For FloatToStrF(FloatSpinEditDTIMIN.Value,ffExponent,4,2)
It seemed ok for only 0.1 and 0.001
Similar problem with 1.0000E-0004 for 0.0001 instead of 1.0000E-04
And also 1E-5, 1E-6 ..?
2.)Further: In the example test:
Because of this result
-1.1000000000000000E+0010(Prec: 9, Dig: 1, fmt : exponent) :
-1.10000000E+10
I would expect instead of
1.1000000000000000E+0100(Prec: 5, Dig: 4, fmt : general) :
1.1000000000000000E+01
This
1.1000000000000000E+0100(Prec: 5, Dig: 4, fmt : general) :
1.1000E+100
I also got:
1.1000000000000000E-0015(Prec: 5, Dig: 4, fmt : general) : 1.1E-0015
-1.1000000000000000E-0015(Prec: 5, Dig: 4, fmt : general) : -0
Is this last one right?
What overflow and underflow indicators are available?
For
1.1000000000000000E+0100(Prec: 5, Dig: 1, fmt : general) :
1.1000000000000000E+01
-1.1000000000000000E+0100(Prec: 5, Dig: 1, fmt : general) :
-1.1000000000000000E+01
Should the Exponent not rather be E+100 ?
Also looking at the following sequence
1.0000000000000000E-0015(Prec: 15, Dig: 4, fmt : Currency) : R 0.0000
-1.0000000000000000E-0015(Prec: 15, Dig: 4, fmt : Currency) : R-0.0000
1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : general) :
1.0000000000000000E+01
-1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : general) :
-1.0000000000000000E+01
1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : exponent) :
1.0000E+100
-1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : exponent) :
-1.0000E+100
1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : fixed) :
1.0000000000000000E+0100
-1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : fixed) :
-1.0000000000000000E+0100
1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : number) :
1.0000000000000000E+0100
-1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : number) :
-1.0000000000000000E+0100
1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : Currency) : R
1.0000000000000000E+0100
-1.0000000000000000E+0100(Prec: 5, Dig: 1, fmt : Currency) :
R-1.0000000000000000E+0100
1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : general) :
1.0000000000000000E+01
-1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : general) :
-1.0000000000000000E+01
1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : exponent) :
1.0000E+100
-1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : exponent) :
-1.0000E+100
1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : fixed) :
1.0000000000000000E+0100
-1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : fixed) :
-1.0000000000000000E+0100
1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : number) :
1.0000000000000000E+0100
-1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : number) :
-1.0000000000000000E+0100
1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : Currency) : R
1.0000000000000000E+0100
-1.0000000000000000E+0100(Prec: 5, Dig: 2, fmt : Currency) :
R-1.0000000000000000E+0100
1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : general) :
1.0000000000000000E+01
-1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : general) :
-1.0000000000000000E+01
1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : exponent) :
1.0000E+100
-1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : exponent) :
-1.0000E+100
1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : fixed) :
1.0000000000000000E+0100
-1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : fixed) :
-1.0000000000000000E+0100
1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : number) :
1.0000000000000000E+0100
-1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : number) :
-1.0000000000000000E+0100
1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : Currency) : R
1.0000000000000000E+0100
-1.0000000000000000E+0100(Prec: 5, Dig: 3, fmt : Currency) :
R-1.0000000000000000E+0100
1.0000000000000000E+0100(Prec: 5, Dig: 4, fmt : general) :
1.0000000000000000E+01
-1.0000000000000000E+0100(Prec: 5, Dig: 4, fmt : general) :
-1.0000000000000000E+01
Bring more questions. Prec: 5? Dig: 2? For exponent
Changing 1.1 to 1.0 illustrated that there is a problem at Digits 2 with
E-03.
3): Compile issue?
// With this: Testit (1.);
// I get this error: project1.lpr(48,11) Fatal: Syntax error, ")"
expected but "]" found
// But changing to the following works fine ???
Testit (1.0);
Could 1) and 2) be only on Windows? I would doubt that.
TIA
DanieW
The perusal, use, dissemination, copying or storing of this message or its attachments and the opening of attachments is subject to PBMR's standard email disclaimer available at internet address: Pebble Bed Modular Reactor (Pty) Ltd - Disclaimer or on request from the sender.
More information about the fpc-devel
mailing list