24 ms·
The author makes the point that turns allow for exact representation of many commonly used angles, but with binary floating point, many common angles (1/6 of a
by bhk 4y ago
The author makes the point that turns allow for exact representation of many commonly used angles, but with binary floating point, many common angles (1/6 of a turn, for example) are inexact.
This could be addressed by using a whole number other than 1 to represent a turn ... one that is a multiple of 3 (or 3x3) and 5, and while we're at it, 2 (or 2x2x2), so most commonly-used angles are whole numbers! That gives us 360 as the value representing a whole turn.
- lupire 4y agoThere's no need to represent fractions of a turn as binary fractions, since you don't ever need more than 1 turn. You can represent fractions of a turn as (pair of integer) rationals, and round on the rare occasion that the denominator gets too big.
- aaaaaaaaaaab 4y ago>since you don't ever need more than 1 turn Helix.
- EmilioMartinez 4y ago>1/6 of a turn is inexact I just want to point out that that is an issue with radians too (pi/3). Whenever this happens I just use that same integer representation (or rational as some poster said) and then remember to multiply by tau before using a math library. With a turns-based library it would only make my life (very slightly) easier