We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Signum function in Processing
Page Index Toggle Pages: 1
Signum function in Processing? (Read 642 times)
Signum function in Processing?
Nov 6th, 2007, 12:25pm
 
Hi, is there a Signum (sgn) function in Processing?
Re: Signum function in Processing?
Reply #1 - Nov 6th, 2007, 1:35pm
 
Not built in I don't think so, but you can easily write one yourself I'd say.
Re: Signum function in Processing?
Reply #2 - Nov 6th, 2007, 3:41pm
 
something like this?

Code:
int signum(float f) {
if (f > 0) return 1;
if (f < 0) return -1;
return 0;
}
Re: Signum function in Processing?
Reply #3 - Nov 7th, 2007, 1:23pm
 
This was very easy, I'm feeling a little bit stupid... thanks for the help!
Page Index Toggle Pages: 1