which is faster? a*a or sqrt(a)

Started by
21 comments, last by iwaskia 21 years, 11 months ago
quote:
cause math don''t like ifs and elses (or have you seen them yet in formulas in school?)


Yes, the Kronecker Delta:

d(ij) = { (1, if i=j), (0, if i!=j) }

Can be used to specify things even as simple as your identity matrix (and things much more complex).

http://mathworld.wolfram.com/KroneckerDelta.html
Advertisement
okay.. never say never, right?
but in normal math (means up to calculus and everything) you normally don''t touch any functions with an if in (well.. abs(x), yeah, the big exception..)

and using if/else in functions is never that fast cause you kill the streaming structure of the function.. (and using some while(blah) { if(blahblah) do else do } is the most stupid approach for stuff like sqrt(x), or sin(x) etc..)

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

quote:Original post by a person
Anonymous Poster, you really dont understand what you are saying. doing absolutly nothing is not the same as calling a function which does nothing. we were discussing calling a function that does nothing vs a multiply. you are merely erasing the function call from existence, and the compiler never even sees the call. you are not being clever, but rather ignorent of things.

so i guess that makes it
#define AP 0
heh, could not resist.

btw, AP, that is a GREAT optimization technique. you should write an article to gamedev on it.

<SPAN CLASS=editedby>[edited by - a person on April 30, 2002 12:51:16 AM]</SPAN>


oh, i know exactly what im doing. i was just pointing out that a function call can really be made to do nothing, thus countering saispete''s comment..so, in fact, it would be faster than a multiply, even if it did nothing.. : )

and ive got better things to write articles on besides being a smartass developer..dont have time now been putting in well over 80 hours a week to get our e3 demo done and polished..

This topic is closed to new replies.

Advertisement