Round to 2 digits?

What’s the easiest way to make sure this ends to 2 digits?

$ echo {round([v(0,3),u(0,1000),u(0,1),v(0,34),u(.1,100)]*100)/100}

I always see something like this:

0,449.08999999999997,0.68000000000000005,21,19.629999999999999

I’m guessing a command to manipulate string would help here, but I don’t like that idea though. For context, my filter will think parameters changed because it ends on 2 digits if I touch something, but on initialization of randomization, because of more digits, it thinks it changed.

When an expression starts with _, the evaluated number is put in the string in a “readable” form.
So:

$ gmic e "{round(1/3,0.01)}" e "{_round(1/3,0.01)}" 
[gmic]./ Start G'MIC interpreter (v.3.3.6).
0.33000000000000002
0.33
[gmic]./ End G'MIC interpreter.
2 Likes