# How get i the correct "rounding"?

hello dynos,

I want the numbers shown as in Revit.
Dynamo does hide ceros and not representing the numbers as shown.
How can i deal with that?

KR

Andreas

`Math.Round(number, 3);`

still it ignores ceros

Iâ€™m lostâ€¦ which number isnâ€™t displaying as you want, and where are you looking to display it?

1 Like

thats from Revit schedule

it has 3 digits! 0.000 becomes 0

Final aim is to convert them to strings an at it to the name

thats the units in Revitâ€¦ Dynamo is doing it own stuff

String.FromObject after the three digit rounding should do the trick. You can then either add zeros via pad left, or take the Substring to stop at 3 digits last the decimal as needed.

1 Like

how to deal with +/- values i think i have to do some clever sorting if â€ś-â€ť do it in a other way

and length if it is > 9

I would recommend getting the index of the â€ś.â€ť, and counting 3 digits after that.

1 Like

i got confused â€¦ i am in the list rollercoster

This may help:

``````str;
indx = String.IndexOf(str,â€ť.â€ť);
frmtdStr = String.SubString(str, 0, indx+3);
``````

Untested as I am not at my computer. If youâ€™re still stuck when I get to it in ~30 minutes Iâ€™ll post a confirmed fix.

That sounds goodâ€¦ minwhile i continue

Python would probably be quicker at this point. You can round and then set the number of trailing zeros with this method.

``````nums = IN[0]
out = []

for num in nums:
n = '{:.3f}'.format(round(num,2))
out.append(n)
OUT = out
``````
3 Likes

That would be almost the solution, but for any reson dynamo writes 3- insteat of -3,
i think multiply strings is not the way

Youâ€™re multiplying by a negative so youâ€™re getting the strings backwards. You would just get the first `x` substrings instead, starting at index 0.

thats it looks like Revit Schedule view

I sense a speed race!

1 Like