Making negatives positive

Another_Guy's icon

Hi all!

Does anyone know of an easy way to make a negative number (or list of numbers) change to its equivalent positive value?

Thanks Guy

pm's icon

For a number [abs] or [abs 0.]. For a list of ints, [vexpr abs($i1)] or floats [vexpr abs($f1)].

Another_Guy's icon

Thanks pal!!

brendan mccloskey's icon

....in addition to those elegant solutions, [!- 0] or [!- 0.] will also work on a stream of numbers: 0. - (-4.) = 4.

Brendan

Peter Castine's icon

[* -1] and [* -1.] will also work (assuming you know the input is negative). If you can have both positive and negative values, use [abs].

Roman Thilenius's icon

just to make the thread complete:

[expr -($f1)]

laonikoss's icon

Yet another way: [scale 1. 10. -1. -10.]

Peter Castine's icon
Max Patch
Copy patch and select New From Clipboard in Max.

There is no limit to the convoluted ways of doing this. I'll see your [scale] and raise you this:

Roman Thilenius's icon

one could also convert the input into a video signal.