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
 
Back
Top