<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>diar Mr. Reenen Laurie:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>thanks very much for your answer.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>really, I think that my problem was in the
TFloatRec. I see that you declare as var. I will try your
suggestions.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>yours,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Ing. Héctor F. Fiandor<BR><A
href="mailto:hfiandor@infomed.sld.cu">hfiandor@infomed.sld.cu</A></FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=rlaurie@gmail.com href="mailto:rlaurie@gmail.com">Reenen Laurie</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=lazarus@lazarus.freepascal.org
href="mailto:lazarus@lazarus.freepascal.org">General mailing list</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, September 01, 2008 1:29
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Lazarus] procedure
FloatToDecimal</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT><BR></DIV>
<DIV dir=ltr>Procedure FloatToDecimal(Out Result: TFloatRec; Value: Extended;
Precision, Decimals : integer);<BR><BR>The Precision, and Decimals work
together to ensure the rounding etc. <BR><BR>So lets say you want to have
float to decimal, and have 5 "digits"... And you do it on a value of 2
then the result will be<BR>2.00000<BR><BR>If you only want a precision 2 but
want decimals 5, and run it for pi, you will get<BR>3.14000<BR><BR>So general
rule is to have your precision higher than your digits, and you'll have good
"rounding".<BR><BR>Hmmm... My test program shows some
funnies:<BR><BR>procedure TForm1.FormDblClick ( Sender : TObject ) ;<BR>var t
: TFloatRec; <BR>begin<BR> FloatToDecimal(t,pi,5,3);<BR>
ShowMessage(inttostr(t.Exponent)+'.'+t.Digits);<BR>end; <BR><BR>Shows 3.1432
-- not 3.143 as expected...<BR><BR>FloatToDecimal(t,pi,2,6);<BR>Showed,
3.14<BR><BR>(not 3.140000) as I expected...<BR><BR><BR><BR>
<DIV class=gmail_quote>On Sat, Aug 30, 2008 at 4:19 AM, Héctor Fiandor Rosario
<SPAN dir=ltr><<A
href="mailto:hfiandor@infomed.sld.cu">hfiandor@infomed.sld.cu</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Dear
sirs:<BR><BR>I need to convert a Float to a number with two decimal places
in a Lazarus<BR>Project for Windows..<BR><BR>I am thinking to use the
following procedure:<BR><BR>Procedure FloatToDecimal(Out Result: TFloatRec;
Value: Extended; Precision, Decimals : integer);<BR><BR>begin<BR>
FloatToDecimal(Result,Value,fvExtended,Precision,Decimals);<BR>end;<BR><BR>but
I dont know what to write in some of the arguments.<BR><BR>Thanks in advance
for your help,<BR><BR>yours truly,<BR><BR>Ing. Héctor F. Fiandor<BR><A
href="mailto:hfiandor@infomed.sld.cu">hfiandor@infomed.sld.cu</A><BR><BR>_______________________________________________<BR>Lazarus
mailing list<BR><A
href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</A><BR><A
href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus"
target=_blank>http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</A><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>o__<BR>,_.>/ _<BR>(_)_\(_)_______<BR>...speed is
good<BR>_______________<BR>I believe five out of four people have a problem
with fractions.<BR></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>Lazarus mailing
list<BR>Lazarus@lazarus.freepascal.org<BR>http://www.lazarus.freepascal.org/mailman/listinfo/lazarus<BR><BR><BR><BR>__________
Informacisn de ESET Smart Security, versisn de la base de firmas de virus 3317
(20080801) __________<BR><BR>ESET Smart Security ha comprobado este
mensaje.<BR>http://www.eset.com<BR></BLOCKQUOTE></BODY></HTML>