question about Trim

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
how can i take a float number and make it's lengeth to be only 3 or 4 numbers after the points, for example: if i have the number 1.999999999999 i want it to be 1.999

thnaks
 
I think, that Math.Round() should do the job.

float o=1.999999999999f;
float n=Math.Round(o,3);

Tomas Petricek
Microsoft C# MVP

-----Original Message-----
From: Gidi [mailto:[email protected]]
Posted At: Saturday, July 31, 2004 2:45 PM
Posted To: microsoft.public.dotnet.languages.csharp
Conversation: question about Trim
Subject: question about Trim

hi,
how can i take a float number and make it's lengeth to be only 3 or 4
numbers after the points, for example: if i have the number
1.999999999999 i want it to be 1.999

thnaks
 
Back
Top