PC Review


Reply
Thread Tools Rate Thread

269.4052867128178 -> 269.4 how?

 
 
Jeroen Ceuppens
Guest
Posts: n/a
 
      11th Mar 2004
Hi, i want to have a conversion from 269.4052867128178 -> 269.4 (so it has
only one number after the point)

The type of the number is long

Thx
JC


 
Reply With Quote
 
 
 
 
John T
Guest
Posts: n/a
 
      11th Mar 2004
"Jeroen Ceuppens" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)
> Hi, i want to have a conversion from 269.4052867128178 -> 269.4 (so
> it has only one number after the point)
>
> The type of the number is long


This should get you what you want:

double myVar = 269.4052867128178;
string result = myVar.ToString("0.0");

--
John T
http://tknowlogy.com/TknoFlyer
http://www.pocketgear.com/products_s...veloperid=4415
____________________


 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      11th Mar 2004
Jeroen Ceuppens <(E-Mail Removed)> wrote:
> Hi, i want to have a conversion from 269.4052867128178 -> 269.4 (so it has
> only one number after the point)
>
> The type of the number is long


If the type of the number is long, you don't have any decimal places at
all. Could you check that?

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      11th Mar 2004
Use the Math class to round it.

-Chris

"Jeroen Ceuppens" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi, i want to have a conversion from 269.4052867128178 -> 269.4 (so it

has
> only one number after the point)
>
> The type of the number is long
>
> Thx
> JC
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:20 PM.