How to format float value send to screenLine1

Hello, I want to show values on the screen and I use the pure-data-message.
“screenLine1 1: GrainLength $1ms”…

On the screen I get:

  1. GrainLength 129.93847ms

Sometime I have so many digits, that the physical unit „ms“ is not anymore displayed, because the value is too long.

How can I format the value, to have only one digit after the separator.

Here’s a useful list of stuff List of objects | Pure Data

int turns values into integer. So multiply value by 10, int object, divide by 10 will get you one decimal place (or something like that). Then send to screen.

1 Like

You can also check the [makefilename] object which is useful for formatting things other than filenames. (To get only one digit after the decimal point you can use a format string such as %.1f)

2 Likes

use [int] , that will remove decimals.

1 Like

Thank you, this is very useful. The functions name is a little misleading, but it works.

Thank you very much.

Very good.