Binary scaling: Difference between revisions

Content deleted Content added
GreenC bot (talk | contribs)
Reformat 1 archive link. Wayback Medic 2.5
math typesetting
Line 62:
=={{anchor|BAM}}Binary angles==
<!-- Binary angle (computing), Binary Angular Measurement System, and Binary radian redirect here -->
[[Image:Binary angles.svg|360px|thumb|Binary scaling (B0) Representationrepresentation of angles. <span style="color:black">Black</span> is traditional degrees representation, <span style="color:green">green</span> is BAM as a realdecimal number and <span style="color:red">red</span> is [[hexadecimal]] 32-&nbsp;bit representation of the BAM.]]
 
Binary angles are mapped using B0, with 0 as 0 degrees, 0.5 as 90° (or <math>\fractfrac{\pi1}{2}\pi</math>), &minus;1−1.0 or 0.9999999 as 180° (or {{math|π}}), and &minus;0−0.5 as 270° (or <math>\fractfrac{3\pi}{2}\pi</math>). When these binary angles are added using normal [[two's complement]] mathematics, the rotation of the angles is correct, even when crossing the sign boundary (this of course does away with checks for angle ≥ 360° when handling normal degrees<ref name="Hargreaves_2010"/>
 
The terms '''binary angular measurement''' ('''BAM''')<ref name="ship"/> and '''binary angular measurement system''' ('''BAMS''')<ref name="BAMS"/> as well as '''brads''' ('''binary radians''' or '''binary degree''') refer to implementations of binary angles. They find use in robotics, navigation,<ref name="LaPlante_2004"/> computer games,<ref name="Sanglard_1993"/> and digital sensors.<ref name="Parallax_2005"/>
 
No matter what bit-pattern is stored in a binary angle, when it is multiplied by 180° (or {{math|π}}) using standard signed [[fixed-point arithmetic]], the result is always a valid angle in the range of −180° &nbsp;[[degree (angle)|degree]]s ({{math|−π }}&nbsp;[[radian]]s) to +180° &nbsp;degrees ({{math| }}&nbsp;radians).
In some cases, it is convenient to use unsigned multiplication (rather than signed multiplication) on a binary angle, which gives the correct angle in the range of 0 to +360° &nbsp;degrees ({{math|+2π }}&nbsp;radians or +1 [[turn (geometry)|turn]]).
Compared to storing angles in a binary angle format, storing angles in any other format inevitably results in some bit patterns giving "angles" outside that range, requiring extra steps to [[trigonometric functions#Computation|range-reduce]] the value to the desired range, or results in some bit patterns that are not valid angles at all ([[NaN]]), or both.