Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-08

FloatToStrF problem

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Danie Wessels

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.

Reply by email

Danie Wessels
to Danie Wessels

Thanks people for this update 2.0.4 of fpc with windows version. That seems now to have resolved issue 1 partly and issue 2. How can I incorporate the new units now into Lazarus (on Win2k)? I tried copying (and also installing) all the stuff under \fpc\2.0.4\ (of fpc) to under \Lazarus\pp\
Not a good idea - different versions - surely!

Now I get in Lazarus in this code:
----
uses

  {$IFDEF UNIX}{$IFDEF UseCThreads} // a break here with error:

Ymproject.lpr(6,28) Fatal: Can't find unit Interfaces cthreads,

  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset

----
Note: "Find Declaration" for "UseCThreads" and "cthreads" does not work but of "Interfaces" does.
- I hope this helps

I have downloaded the source (fpcbuild-2.0.4.zip) (Where do I put this?) How do I now recompile Lazarus (if I need to)
How can I add libgdb (from libgdb-6.2.1-i386-win32.zip (only .a files?)) in for Lazarus to use?

-----Original Message----- To: Subject: [fpc-devel] FloatToStrF problem ... I am using Lazarus 0.9.16 beta 9369 on Win2K

:

Show quoted text 12 lines
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 ..?

:

3): Compile issue? // With this: Testit (1.); // I get this error: project1.lpr(48,11) Fatal: Syntax error, ")" expected but "]" found

Is now also solved?

// But changing to the following works fine ??? Testit (1.0);

:

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.

Reply by email

Vincent Snijders
to Danie Wessels
Danie Wessels wrote 15 lines
Thanks people for this update 2.0.4 of fpc with windows version. That seems now to have resolved issue 1 partly and issue 2. How can I incorporate the new units now into Lazarus (on Win2k)? I tried copying (and also installing) all the stuff under \fpc\2.0.4\ (of fpc) to under \Lazarus\pp\ Not a good idea - different versions - surely! Now I get in Lazarus in this code: ---- uses {$IFDEF UNIX}{$IFDEF UseCThreads} // a break here with error: Ymproject.lpr(6,28) Fatal: Can't find unit Interfaces cthreads, {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset

You need to rebuild the LCL for the new compiler.

Do, Tools, Configure Build Lazarus and recompile the LCL. Leave all others set to none.

Vincent.

Reply by email

Danie Wessels
to Vincent Snijders

Thanks. That worked fine.

Show quoted text 7 lines
> Now I get in Lazarus in this code: > {$IFDEF UNIX}{$IFDEF UseCThreads} // a break here with error: > Ymproject.lpr(6,28) Fatal: Can't find unit Interfaces You need to rebuild the LCL for the new compiler. Do, Tools, Configure Build Lazarus and recompile the LCL. Leave all others set to none. Vincent.

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.

Reply by email