Re: [fpc-devel] which constant expression?

2007-05-29 Thread Joost van der Sluis
On Mon, 2007-05-28 at 13:34 -0300, Mario R. Carro wrote:
 On Monday 28 May 2007, Jonas Maebe wrote:
  On 28 May 2007, at 15:00, Mario R. Carro wrote:
   Great! But look at the attached test: The compilation of the
   line ArrayInts := nil fails with the same error. Rewriting it
   as FArrayInts := nil lets the compiler accept it. I'm using r7494.
 
  Thanks, fixed.
 
 
  Jonas
 
 With this fix ZeosLib-testing compiles out of the box with FPC from SVN 
 (except a wrong ifdef in ZeosLib that I'll ask them to fix). 

You'd better test it with fpc 2.1.4 aka 2.2.0-beta. Changes in svn can
break things again.

Joost.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] IsLibrary and GetModuleFileName

2007-05-29 Thread Graeme Geldenhuys

Hi

Is the IsLibrary and GetModuleFileName implemented on platforms other
than Windows?

I found a 'fpcylix' unit, but GetModuleFileName just returns 0.
Nothing is implement?

What about the IsLibrary function? Is that also a fake implementation
on platforms other than Windows?


--
Graeme Geldenhuys

General error, hit any user to continue.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] FormatFloat bug

2007-05-29 Thread Graeme Geldenhuys

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.

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

---

--
Graeme Geldenhuys

General error, hit any user to continue.


project1.lpr
Description: Binary data
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] which constant expression?

2007-05-29 Thread Mario R. Carro
On Tuesday 29 May 2007, Joost van der Sluis wrote:
 On Mon, 2007-05-28 at 13:34 -0300, Mario R. Carro wrote:
  On Monday 28 May 2007, Jonas Maebe wrote:
   On 28 May 2007, at 15:00, Mario R. Carro wrote:
Great! But look at the attached test: The compilation of the
line ArrayInts := nil fails with the same error. Rewriting it
as FArrayInts := nil lets the compiler accept it. I'm using r7494.
  
   Thanks, fixed.
  
  
   Jonas
 
  With this fix ZeosLib-testing compiles out of the box with FPC from SVN
  (except a wrong ifdef in ZeosLib that I'll ask them to fix).

 You'd better test it with fpc 2.1.4 aka 2.2.0-beta. Changes in svn can
 break things again.


Ok, I'll do that.

 Joost.


Thanks,
Mario

 ___
 fpc-devel maillist  -  fpc-devel@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-devel


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FormatFloat bug

2007-05-29 Thread Joao Morais

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.0050001, 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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FormatFloat bug

2007-05-29 Thread Graeme Geldenhuys

On 5/29/07, Joao Morais [EMAIL PROTECTED] wrote:

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.0050001, you will have 0.01, also correct.




What rounding does FormatFloat() use so I can see if it is
mathematically correct and how compatible do we want to be with
Delphi?

Graeme.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FormatFloat bug

2007-05-29 Thread Graeme Geldenhuys

On 5/29/07, Joao Morais [EMAIL PROTECTED] 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.0050001, you will have 0.01, also correct.


Normally you would round 5 or higher up so taking 0.005 to two decimal
places would give you 0.01 which is what Delphi does! This is
mathematically correct.  It's got nothing to do with whether it is
closer to zero or to one.

Graeme.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FormatFloat bug

2007-05-29 Thread Michael Van Canneyt


On Tue, 29 May 2007, Graeme Geldenhuys wrote:

 On 5/29/07, Joao Morais [EMAIL PROTECTED] wrote:
  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.0050001, you will have 0.01, also correct.
 
 
 
 What rounding does FormatFloat() use so I can see if it is
 mathematically correct and how compatible do we want to be with
 Delphi?

If I remember correctly: 
Bookkeepers rounding as implemented by the Intel processors.
No own routines are used. It's left up to the processor.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FormatFloat bug

2007-05-29 Thread Burkhard Carstens
Am Dienstag, 29. Mai 2007 20:51 schrieb Graeme Geldenhuys:
 On 5/29/07, Joao Morais [EMAIL PROTECTED] 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.0050001, you will have 0.01, also correct.

 Normally you would round 5 or higher up so taking 0.005 to two
 decimal places would give you 0.01 which is what Delphi does! This is
 mathematically correct.  It's got nothing to do with whether it is
 closer to zero or to one.

Try 0.015, that should round to 0.02. IIRC, it's round-to-even, see 
http://en.wikipedia.org/wiki/Rounding.

regards
 Burkhard

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel