but that operation is expensive
Comment on I wish
pinkdrunkenelephants@lemmy.cafe 1 year ago
Modulus equals zero anyone?
nogrub@lemmy.world 1 year ago
pinkdrunkenelephants@lemmy.cafe 1 year ago
So what? It works and it’s better than precompiling a list of all known even and odd numbers, and expecting a computer to iterate through a whole list every time it wants to check the value of something.
The stupid trig tables are just as problematic and it’s why graphics chips use other geometric functions instead. It’s just better to use a modulus.
pixeltree@lemmy.world 1 year ago
No I’m pretty sure an if else ladder is more better
Rubeer@sh.itjust.works 1 year ago
Nah, it compiles down to an AND because of the constant 2
ramenshaman@lemmy.world 1 year ago
That’s the joke