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. :slight_smile:

Math.Round ?

(It would go after Math.Floor)


I try to use both Math.Floor and Math.Round together, but I still got an integer. :frowning:
Anyway, thank you for your advice. <3

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
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

numbers = IN[0]

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[0])]

2 Likes

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