Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
LCL
»
Format issue
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Published sets in FPC are...
by
cdbc
[
Today
at 01:13:16 pm]
Is it possible to create ...
by
gidesa
[
Today
at 12:32:25 pm]
'Rounding' to (say) 5 DP
by
J-G
[
Today
at 12:28:25 pm]
BAScript - Simple scripti...
by
gidesa
[
Today
at 12:10:21 pm]
[SOLVED] Form has no Task...
by
Hartmut
[
Today
at 11:52:24 am]
StrMath.pas a String Numb...
by
LV
[
Today
at 11:48:43 am]
How to run an external co...
by
n7800
[
Today
at 11:36:59 am]
lazarus project
by
Zvoni
[
Today
at 10:14:51 am]
Debian removes FPC/Lazaru...
by
MarkMLl
[
Today
at 09:13:31 am]
Anyone else getting a tro...
by
RaketeMike
[
Today
at 09:09:28 am]
Frustrating Error When us...
by
TYDQ
[
Today
at 08:24:52 am]
[SOLVED] Statically linki...
by
Khrys
[
Today
at 07:37:24 am]
Status of FPC 3.4.0 or FP...
by
PascalDragon
[February 17, 2026, 09:25:01 pm]
MVP made easier.
by
cdbc
[February 17, 2026, 09:16:07 pm]
A diary project with SQLi...
by
cdbc
[February 17, 2026, 09:03:25 pm]
[ANN] fpGUI Toolkit v2.0....
by
PascalDragon
[February 17, 2026, 08:49:17 pm]
DCPcrypt v2.0.6 — Cryptog...
by
Ten_Mile_Hike
[February 17, 2026, 07:40:22 pm]
[SOLVED] Lazarus recompil...
by
creaothceann
[February 17, 2026, 07:37:12 pm]
4.4 messed with the proje...
by
QEnnay
[February 17, 2026, 07:26:00 pm]
Duplicated icon in the Wi...
by
n7800
[February 17, 2026, 06:11:54 pm]
[AGGPas] Difference betwe...
by
cdbc
[February 17, 2026, 05:02:28 pm]
pas2js WebAssembly SQLite...
by
PierceNg
[February 17, 2026, 03:32:46 pm]
My AGGPas examples
by
Roland57
[February 17, 2026, 02:10:03 pm]
Datatype of Fields in sql...
by
Dzandaa
[February 17, 2026, 01:46:59 pm]
TurboBird IBX
by
valdir.marcos
[February 17, 2026, 10:38:16 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Format issue (Read 5102 times)
wp
Hero Member
Posts: 13363
Format issue
«
on:
August 05, 2012, 06:04:21 pm »
The RTL function "Format" has problems when the format specifier is "%0.9" and the number is between 1e8 and less than 1e9, e.g.
Format('%0.9', [1e8]) --> 1
Format('%0.9', [1.2e8]) --> 12
How's that?
Logged
Leledumbo
Hero Member
Posts: 8835
Programming + Glam Metal + Tae Kwon Do = Me
Re: Format issue
«
Reply #1 on:
August 05, 2012, 06:41:04 pm »
I think you miss the ArgType part (it's NOT optional AFAIK), I even wonder why it doesn't generate runtime errors.
Logged
Follow this if you want me to answer:
http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F
http://pascalgeek.blogspot.com
https://bitbucket.org/leledumbo
https://github.com/leledumbo
Code first, think later - Natural programmer B)
Blaazen
Hero Member
Posts: 3241
POKE 54296,15
Re: Format issue
«
Reply #2 on:
August 05, 2012, 06:56:04 pm »
@I even wonder why it doesn't generate runtime errors.
Both give EConvertError here.
There must be something like:
Code:
[Select]
Format('%0.9f', [1e8]);
Format('%0.9f', [1.2e8]);
Logged
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21
Try Eye-Candy Controls:
https://sourceforge.net/projects/eccontrols/files/
wp
Hero Member
Posts: 13363
Re: Format issue
«
Reply #3 on:
August 05, 2012, 07:27:53 pm »
Sorry, I am embarrassed - I forgot the "g". The first posting should read:
Format('%0.9g', [1e8]) --> 1
Format('%0.9g', [1.2e8]) --> 12
Logged
Blaazen
Hero Member
Posts: 3241
POKE 54296,15
Re: Format issue
«
Reply #4 on:
August 05, 2012, 07:41:21 pm »
Then I cannot confirm here. It formats as expected:
Format('%0.9g', [1e8]);
Format('%0.9g', [1.2e8]);
100000000
120000000
Logged
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21
Try Eye-Candy Controls:
https://sourceforge.net/projects/eccontrols/files/
wp
Hero Member
Posts: 13363
Re: Format issue
«
Reply #5 on:
August 05, 2012, 08:04:37 pm »
A windows issue? I am using Win7, FPC 2.6.0 and a recent snapshot of Lazarus.
«
Last Edit: August 05, 2012, 08:06:59 pm by wp
»
Logged
Leledumbo
Hero Member
Posts: 8835
Programming + Glam Metal + Tae Kwon Do = Me
Re: Format issue
«
Reply #6 on:
August 05, 2012, 11:50:02 pm »
Since it's part of RTL, it has nothing to do with Lazarus. You might want to check the bugtracker for bugs regarding this function.
Logged
Follow this if you want me to answer:
http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F
http://pascalgeek.blogspot.com
https://bitbucket.org/leledumbo
https://github.com/leledumbo
Code first, think later - Natural programmer B)
Martin_fr
Administrator
Hero Member
Posts: 12143
Debugger - SynEdit - and more
Re: Format issue
«
Reply #7 on:
August 06, 2012, 12:51:03 am »
w32:
I get 1 and 12 with fpc 2.6
But it looks ok with 2.4.4 and 2.7.1 (2.7.1 from a while ago)
So it may be fixed already. I haven't tested 2.6.1
Logged
Ide Tools, Code completion and more
/
IDE cool features
/
Debugger Status
Avishai
Hero Member
Posts: 1021
Re: Format issue
«
Reply #8 on:
August 06, 2012, 02:14:34 am »
It looks fine with 2.6.1
Logged
Lazarus Trunk / fpc 2.6.2 / Win32
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
LCL
»
Format issue
TinyPortal
© 2005-2018