Page 1 of 2

Comparison codes for DSP module

PostPosted: Sat May 09, 2015 2:04 pm
by Spogg
Hi
The User Guide doesn't seem to list all the possible comparison DSP codes. I base this on looking at others' DSP coding.
I've found
== which means exactly equal to
!= which means not equal to
I've also seen the vertical bar symbol | but have no idea what this does and means. Can someone enlighten me please?

What other stuff can I use in the DSP box that I don't know about? Does anyone have a complete list by any chance?

Cheers!

Re: Comparison codes for DSP module

PostPosted: Sat May 09, 2015 9:15 pm
by adamszabo
| is Or, & is And, then you have these also: <, >, >=, <=

Re: Comparison codes for DSP module

PostPosted: Sun May 10, 2015 6:33 pm
by KG_is_back
there is also pow(x,y) function, which is x to the power of y. However, it is very CPU consuming (in mono it is mostly OK, but in poly it can be quite a bugger). I recommend using these: http://flowstone.guru/downloads/stream-math-functions/

Re: Comparison codes for DSP module

PostPosted: Mon May 11, 2015 8:25 am
by Spogg
Hey thanks guys, much appreciated. I do wonder why the latest User Guide doesn't show all the functions available.
Cheers!

Re: Comparison codes for DSP module

PostPosted: Tue Jun 09, 2015 3:54 pm
by Spogg
I found another one, by accident:

abs(a) gives the absolute positive value of a, that is it removes a - sign.

I do wonder what else isn't in the manual...

Cheers

Spogg

Re: Comparison codes for DSP module

PostPosted: Tue Jun 09, 2015 7:58 pm
by MyCo
eg. sign, exp, sqrt

Re: Comparison codes for DSP module

PostPosted: Tue Jun 09, 2015 8:11 pm
by tulamide
Spogg wrote:abs(a) gives the absolute positive value of a, that is it removes a - sign.

Sorry, I just can't resist :mrgreen:

Time for Mr Wisenheimer in his smarty-pants

"absolute positive value" is an contradiction in terms. While certainly all will understand what you mean, the absolute of a value doesn't have any sign. That's why it's called absolute. Programming always was forming from lazyness. One of these lazy guys decided that positive values won't be written as +5, but only as 5 and the programmer thinks of it as '+5'

But despite its writing a number is either +5 or -5. Only when taken the absolute it is just 5 without any "direction".


Thanks, Mr Wisenheimer, what would we do without you!

Re: Comparison codes for DSP module

PostPosted: Tue Jun 09, 2015 9:44 pm
by KG_is_back
To deepen the concept.
Most people are forgetting the main aspect of mathematics: Number is always a representation of something. The sign of a number represents the direction of something(for example a direction of rotation). The absolute value is the length/size of that something.

Example: "You have 5 apples and you give 2 apples to your friend. How many apples do you have?"
mathematical solution: 5-2=3
the 5 and 3 represents the amount of apples (technically it has no sign - you simply have certain amount of apples). -2 represents the change (change can be positive or negative). You solve the problem by adding the change to the amount (so what is really happening is 5+(-2) )
The absolute value of the change is 2 = the size of the change, disregarding the direction. Sign is a property, that the number technically doesn't need to have, depending on what that number represents. The absolute value of amount of 5 apples is also 5 apples (because it was an amount to start with).
Math was invented to let us (logically) operate with things, without thinking of the things themselves - all we think about is their properties of amount, length, size, direction, orientation, probability, complexity,... Numbers, with all their properties are just general representations of the properties of real things, letting us apply general concepts to them (for example, in real life adding apples is quite different from adding areas, but it's driven by identical concepts).

For me, this is the real beauty of mathematics, that for some reason most people overlook... Probably because of how mathematics is being thought at schools these days. Teachers take so much effort to teach children how to separate the math from the reality (so that they can solve similar problems in general abstract way), that they miss the link between numbers, operations and relationships and the real things they represent.

For example, the prime number. Most people know that it is "a number divisible only by 1 and by itself". What people don't know is the consequences of it in real life! Many species of insects have reproductive cycle of prime number of years, so that there is smaller likelyhood of being in sync with reproductive cycles of your predators. Thanks to that, they do not serve as a main source of food for them (predator can't rely on them to be around when he is born / at certain age).

wow :shock: I've gone quite philosophical today...

Re: Comparison codes for DSP module

PostPosted: Tue Jun 09, 2015 9:48 pm
by martinvicanek
int(x) rounds SSE channel 0 to the nearest integer (and leaves the other three SSE channels untouched). :o

Re: Comparison codes for DSP module

PostPosted: Tue Jun 09, 2015 10:11 pm
by KG_is_back
martinvicanek wrote:int(x) rounds SSE channel 0 to the nearest integer (and leaves the other three SSE channels untouched). :o


I had no idea this one even existed!!! !!!!