Comparison codes for DSP module

DSP related issues, mathematics, processing and techniques
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Comparison codes for DSP module

Post 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!
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Comparison codes for DSP module

Post by adamszabo »

| is Or, & is And, then you have these also: <, >, >=, <=
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Comparison codes for DSP module

Post 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/
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Comparison codes for DSP module

Post by Spogg »

Hey thanks guys, much appreciated. I do wonder why the latest User Guide doesn't show all the functions available.
Cheers!
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Comparison codes for DSP module

Post 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
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Comparison codes for DSP module

Post by MyCo »

eg. sign, exp, sqrt
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Comparison codes for DSP module

Post 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!
"There lies the dog buried" (German saying translated literally)
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Comparison codes for DSP module

Post 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...
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Comparison codes for DSP module

Post by martinvicanek »

int(x) rounds SSE channel 0 to the nearest integer (and leaves the other three SSE channels untouched). :o
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Comparison codes for DSP module

Post 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!!! !!!!
Post Reply