Making negatives positive

Dec 12, 2011 at 12:25pm

Making negatives positive

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

#60591
Dec 12, 2011 at 12:29pm

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

#218064
Dec 12, 2011 at 12:37pm

Thanks pal!!

#218065
Dec 12, 2011 at 1:55pm

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

Brendan

#218066
Dec 14, 2011 at 2:32pm

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

#218067
Dec 14, 2011 at 4:58pm

just to make the thread complete:

[expr -(\$f1)]

#218068
Dec 15, 2011 at 3:19pm

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

#218069
Dec 18, 2011 at 5:43pm

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

– Pasted Max Patch, click to expand. –
#218070
Dec 19, 2011 at 3:27pm

one could also convert the input into a video signal.

#218071

You must be logged in to reply to this topic.