[Lazarus] Real number display

Larry Dalton larrydalton71 at gmail.com
Wed Dec 10 05:39:35 CET 2014


Works great! Thanks!

Sent from my iPhone

> On Dec 9, 2014, at 22:23, Chris Kelling <kellingc at cox.net> wrote:
> 
> RealNumber := 1.5;
> FloatToStr(RealNumber:2,RealStr);
> DbeditBox.text := RealStr
> 
> The ":2" specifies the number of decimal. If you were using WRITE to output to the console, it would look like:
> 
> RealNumber := 13.3456;
> writeln('Number = ',RealNumber:3:2);
> 
> Which would output
> Number =  13.34
> 
> The first number = the number of spaces after the literal (notice the extra space after the equals), and the second is the number of decimal places to print. NOTE, in both examples, the formatting dies bit change the value (i.e. No rounding or trunking happen, just the number of decimal places specified are printed).  
> 
> Hope that helps. 
> 
> -Chris
> -------- Everything at or below the line is a signature, not to be confused with the body of the email above. Sorry about the last signature text that seemed to have some people questioning my sanity. 
> 
> We are what we repeatedly do. Excellence, then, is not an act, but a habit.
> 
> -Aristotle
> 
> 
> 
> 
>> On Dec 9, 2014, at 23:03, Larry Dalton <larrydalton71 at gmail.com> wrote:
>> 
>> How do I get a real number to display as a decimal in a dbedit instead of an exponential number?
>> 
>> Sent from my iPhone
>> --
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lists.lazarus.freepascal.org
>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141209/85832a08/attachment-0003.html>


More information about the Lazarus mailing list