Reduce number of decimals / length of a number?

Hello there!

Here’s a simple question (or that’s what I suppose despite the fact that I can’t solve it by myself).

When I use a pattern/noise/LFO CHOP, sometimes I want to display the number that this CHOP is producing. So I reference it using a Text TOP. The thing is that this numbers, even when they look shorter in the CHOP itself, when I reference them in the Text TOP, are too long. And I would like to get them shorter, so, with less decimals.

An example:

LFO CHOP displays: 0.4023
Text TOP with the LFO reference displays: 0.4023124893547945

I would like the Text TOP to display something like: 0.4023, or 0.402312, or something simmilar (shorter that what it’s representing right now).

Do you know if is there anyway to get this? Maybe a Python command, or another CHOP that round the number to 4 decimals or something like that?

Thank you very much everybody!!

You can use CHOP value %replace parameter in the text TOP to make this happen.

Notice in the example above that you can use the syntax

chop val %.2f

chop val comes through as text the %.2f tells the Text TOP that you want to replace that % sign with a channel value with two significant digits .2 that’s a floating point value f.

In you’re case you probably want something like:

my val is %.4f

You can see more about the flags and syntax for CHOP formatting here:

1 Like

Thank you very much, Matthew. That’s exactly what I needed and completely did the trick. Works perfectly.

Also, thank you very much for your great tutorials and your work. It’s so nice to learn from you! :slightly_smiling_face:

Have a nice day!

1 Like