Allow floating-point division by zero in ZScript
Moderator: GZDoom Developers
Re: Allow floating-point division by zero in ZScript
You are correct. I started with a different example, and ended up putting the max in the wrong place when I changed it up...
Re: Allow floating-point division by zero in ZScript
Good idea. As Graf confirmed, that's faster than if branches.AFADoomer wrote:For brevity's sake, I usually end up putting in a "max([divisor that might end up as zero], [arbitrary small number]);" call in cases like this...
e.g.:Not sure if that slows things down internally any more/less than using if statements to the same effect, but I haven't noticed any issues so far.Code: Select all
TweenChange = 1. / (max(time, 0.0001) * TICRATE);
I've replaced the if with similar code:
Code: Select all
TweenChange = 1. / (max(time, double.epsilon) * TICRATE);