Skip to content
Snippets Groups Projects

Adjust vid.width floating point comparson for CHAT

Merged mazmazz requested to merge mazmazz_/SRB2:SRB2-CHAT-FLOAT-FIX into SRB2-CHAT

This fixes -Wfloat-equals compile errors that Alam enabled for the next branch. See https://git.magicalgirl.moe/STJr/SRB2/merge_requests/383 for that discussion.

In short, != == comparisons are invalid for floating point due to precision weirdnesses -- decimals in the 6th or 10th place may be off by 1.

So to do a not-equal comparison, you subtract the two values and see if that difference is non-zero. fabsf(X-Y) > 1.0E-36f checks for non-zero X-Y by seeing if the abs value of that difference is greater than .00000...000001 to the 36th decimal place.

Edited by mazmazz

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading