shorten behind the comma

  • Thread starter Thread starter Wouter van Teeseling
  • Start date Start date
W

Wouter van Teeseling

How can I shorten a float number just for 2 figures behind dhe comma
e.g. from 0.123456 to 0.12.
 
Wouter van Teeseling said:
How can I shorten a float number just for 2 figures behind dhe comma
e.g. from 0.123456 to 0.12.

if by shorten you mean rounding: se Peter's post.
if by shorten you mean truncating: Though Math.Truncate doesn't have
overloads with decimals paramter you still can do someting like:
truncatedValue = Math.Truncate(rawValue * 100)/100

Christof
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top