[fpc-devel] FormatFloat bug

Joao Morais post at joaomorais.com.br
Tue May 29 19:54:04 CEST 2007


Graeme Geldenhuys wrote:

> Hi,
> 
> Attached is a application that demonstrates a bug in FormatFloat.  All
> tests pass when run under Delphi, but test four fails under Free
> Pascal.

IMHO, fpc behaves correctly. 0.005 is closer than 0 instead 0.01. If you 
try 0.00500000001, you will have 0.01, also correct.

--
Joao Morais



> Here is the application output:
> 
> -------------------------------------------
> $ ./project1
> Time:00.001 N:7 E:0 F:1 I:0
>  TTestFormatFloat Time:00.001 N:7 E:0 F:1 I:0
>    00.000  Test1
>    00.000  Test2
>    00.000  Test3
>    00.000  Test4  Failed: Failed on 4 expected: <$ 0.01> but was: <$ 0.00>
>    00.000  Test5
>    00.000  Test6
>    00.000  Test7
> 
> Number of run tests: 7
> Number of errors:    0
> Number of failures:  1
> 
> List of failures:
>  Failure:
>    Message:           TTestFormatFloat.Test4: Failed on 4 expected:
> <$ 0.01> but was: <$ 0.00>
>    Exception class:   EAssertionFailedError
>    Exception message: Failed on 4 expected: <$ 0.01> but was: <$ 0.00>
> 
> -------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list