Hello Arsen

You could just use the format statement but in your example it would 
give the answer 2.6. To get 2.5 you need to use a truncation. This is 
easiest done at the integer level, so multiply up, truncate then divide 
back down.

Here is an untested thought:

var
   i  : integer;
  a : single;
  s : string;
begin
  a := 7751.9 / 2991;
  a := 10 * a;
  i := trunc(a);
  a := i / 10;
  s := format('%f5.1,[a]);  // s := '2.5'
end;

Does it work? If the answer can be negative, check that you get 
truncation to the correct side. If not, use the floor function instead 
of trunc.


Bobby Clarke



Arsen Khachatryan wrote:
>
> Hello world how are you.
> Im doing calculation in my delphi program for example im calculating 
> 7751.9 / 2991 and geting result 2,57970578401872 how can I cut after 
> 2.5 that its calculate like this 7751.9/2991 = 2.5 and not 
> 2,57970578401872
>
> thanks a lot
> Arsen Khachatryan
> -------------------------------
> Dating with the russian girls
> http://khaarsen.ueuo.com/love.html <http://khaarsen.ueuo.com/love.html>
>
> __________________________________________________________
> We won't tell. Get more on shows you hate to love
> (and love to hate): Yahoo! TV's Guilty Pleasures list.
> http://tv.yahoo.com/collections/265 <http://tv.yahoo.com/collections/265>
>
> [Non-text portions of this message have been removed]
>
> 
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.13/726 - Release Date: 18/03/2007 
> 15:34
>   


[Non-text portions of this message have been removed]

Reply via email to