If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Comparison codes for DSP module
19 posts
• Page 1 of 2 • 1, 2
Comparison codes for DSP module
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!
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!
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: Comparison codes for DSP module
| is Or, & is And, then you have these also: <, >, >=, <=
- adamszabo
- Posts: 667
- Joined: Sun Jul 11, 2010 7:21 am
Re: Comparison codes for DSP module
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/
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Comparison codes for DSP module
Hey thanks guys, much appreciated. I do wonder why the latest User Guide doesn't show all the functions available.
Cheers!
Cheers!
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: Comparison codes for DSP module
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
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
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: Comparison codes for DSP module
Spogg wrote:abs(a) gives the absolute positive value of a, that is it removes a - sign.
Sorry, I just can't resist
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)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Comparison codes for DSP module
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 I've gone quite philosophical today...
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 I've gone quite philosophical today...
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Comparison codes for DSP module
int(x) rounds SSE channel 0 to the nearest integer (and leaves the other three SSE channels untouched).
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: Comparison codes for DSP module
martinvicanek wrote:int(x) rounds SSE channel 0 to the nearest integer (and leaves the other three SSE channels untouched).
I had no idea this one even existed!!! !!!!
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
19 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 51 guests