 How can I round down a number with 2 decimals place?

Hello,
I want to round down a number with 2 decimals place, but the Math.Floor node that I use displays an integer. So what node or code that suitable for my situation.
Thank you for your advice. I try to use both Math.Floor and Math.Round together, but I still got an integer. Multiply by 100, Floor, divide by 100.

Hi @natcha.jita,

You can also use python code to get 2decimal place. See screencap below:

import clr
from Autodesk.DesignScript.Geometry import *

numbers = IN

numList = []

for num in numbers:
numList.append("{:.2f}".format(num))

OUT =  numList

PS: the digit number is controlled by this number {:.2f} . If you don’t want to have any digit then you can change it to zero. {:.0f}

Only format for code with comment above

import sys
def tolist(obj1):
if hasattr(obj1,'__iter__') : return obj1
else : return [obj1]
OUT = ["{0:.2f}".format(float(i)) for i in tolist(IN)]

2 Likes

Just pasting this out of interest. Here’s my unorthodox method that corresponds to other decimal values.