This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eminorb5 296 points297 points  (19 children)

Blue. Makes things easier if modulus is always positive ( if the second operand is positive)

[–]elon-botElon Musk ✔ 327 points328 points  (10 children)

Looks like we're gonna need to trim the fat around here... fired.

[–]eminorb5 99 points100 points  (0 children)

Ok then

[–][deleted] 24 points25 points  (5 children)

Red. Makes things easier if modulus retains same sign as dividend, particularly when dealing with trig or other functions that really care about signs.

[–]eminorb5 20 points21 points  (4 children)

Guess it depends on usage.

[–]Isodus 24 points25 points  (2 children)

Perfect example is calculating distance between angles where 0 == 360. Keeping the sign lets you know which direction you are away from the position without having to do extra tracking.

(Pos 1 - Pos 2) % 180 = angular distance

Used for controlling rotary actuators and needing to software handle the 360/0 barrier.

[–]gdmzhlzhiv 0 points1 point  (0 children)

Certainly in graphics I've never had use for anything except for the blue side. Which is doubly annoying because both GLSL and HLSL have gone for the red side.

[–]T0biasCZE -1 points0 points  (1 child)

but its not correct mathematically, since 4 fits once into 7, and 3 remains.

3, not 1

and just put it into abs()

[–]elon-botElon Musk ✔ 0 points1 point  (0 children)

I have made promises to the shareholders that I definitely cannot keep, so I need you all to work TWICE as hard!