Skip to content

Instantly share code, notes, and snippets.

View chadjoan's full-sized avatar
Currently building things to help avoid permanent sleepiness.

Chad Joan chadjoan

Currently building things to help avoid permanent sleepiness.
  • Ohio, United States
View GitHub Profile
@chadjoan
chadjoan / dreaming-of-fixed-point-math.md
Last active January 15, 2024 08:10
Dreaming of Fixed Point Math

I've always wanted a physics engine that uses fixed-point integers. No floats.

Why?

  • Consistent behavior across platforms.[^1][^2][^3][^4]
  • Deterministic calculations become possible by avoiding non-deterministic quirks[^1][^5].
    • If the citations from the last two points weren't enough, this page[^6] is a treasure trove! There are just too many examples of non-determinism and platform divergence for me to cite in this article. The amount of time and effort spent by talented individuals to force disparate systems to behave the same way, or find workarounds, would appear to be immense.
  • Have equivalent expressions yield equivalent numbers.[^7][^8]
  • Incrementing the number by 1 will always increment the number by 1.[^9]
  • Easier representation of exact base-10 numbers, and potentially other rational numbers. [Footnote: Exactness]
    • If we chose a base-10 representation, we can now build all of your content with numbers lik