(OAT) Picard said, January 10, 2008, 05:48:03 pmhttp://us3.php.net/absScroll to the bottom...QuoteSometimes you may want to do the opposite of abs(): turn a positive number into a negative.<?phpfunction turn_neg ($num) { return $num - $num * 2;}?>But this can create errors when you put a negative number inside...turn_neg (-2) returns 6.<?phpturn_neg (-2); // 6.?>The solution is to make another function to determine if the number is negative or not.<?phpfunction is_neg ($num) { return $num < 0;}function turn_neg ($num) { if (is_neg ($num)) { return $num - $num * 2; } else { return abs ($num); }}turn_neg (2); // -2turn_neg (-2); // 2?>Or, if the number is not negative, you could also return false.Developer-wise, this is just as bad as youtube comments!WOWAMAZINGTHX, THAT WUZ THE BOM
I do actually find these to be rather funny there is a surprising number of bad really coders out there in surprisingly high positions, with all this rapid application development crap everyone and his mother thinks he's a great coder because he can place buttons in an IDE
King of MUGEN said, January 11, 2008, 12:09:05 amTempesT said, January 10, 2008, 05:49:16 pmGOD!! Math + Coding jokes really don't have that effect on me anymore, gosh darn it all. What do you mean by anymore?The "gosh darnit all" was SUPPOSED to be sarcasm, but I seem to have failed
Sorry, I just can't trust you. I... I just can't. Plus, I like this avatar, and I can easily adblock your your sig =P
if i pulled a "haha owned im not changing it" you can just put yours back it's a good deal don't pass it up
TempesT said, January 11, 2008, 03:14:47 amPlus, I like this avatar, and I can easily adblock your your sig =PYES I QUOTED MYSELF!!!