Format as Decimal Number - Dropping the decimal point and trailing zero

I have some numbers that I'm reading from an orientation sensor (pitch) I'd like to display and those numbers should always be rounded to a single digit after the decimal point.

Using these blocks:

whenever the global "smoothedPitch" ends with .0, my text "Label_Pitch" drops the .0 and i just get an integer with no decimal point or trailing zero.

I'm now using the following blocks to resolve this, but just wondering if there's a simpler way of achieving the same result to always ensure there's a single digit after the decimal point?

grafik

Oops, sorry, i forgot the "absolute" while I was culling by blocks for presentation. These are by blocks:

It appears the absolute is dropping the ".0"

Ha! Thanks.

I wonder if there's a reason why this order makes this difference.

Because

And the format block then formats it as you need it

Taifun

And

on a number that is no-longer an integer

it's formatted as a decimal to one place?

Read the documentation of the format block
Also use Do it on all those blocks for better understanding what happens step by step
Taifun

Thanks. I often don't use Companion because the band at the bottom messes up my screen, but I should try to give it more of a go.

Definitely.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.