f = 0.86194672985615151
digits = 5
rounded = int(f*10**digits) / 10.0**digits      # ** -> power-of operation

# 0.86194



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of efecto
Sent: Tuesday, January 05, 2010 2:56 PM
To: python_inside_maya
Subject: [Maya-Python] Clamping a float value with digits

Hi guys.. I have another question.
I want to clamp a float value with 8 digits to smaller number of digits.

Example:
0.86194672985615151 -> 0.86194

What's the best and the most efficient way to achieve this?

Thanks.

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to