Binary scaling: Difference between revisions

Content deleted Content added
See also: +link
Line 60:
Various scalings may be used. B0 for instance can be used to represent any number between -1 and 0.999999999.
 
=={{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) Representation of angles. <span style="color:black">Black</span> is traditional degrees representation, <span style="color:green">green</span> is floating point representation and <span style="color:red">red</span> is [[hexadecimal]] 32-bit representation.]]
Line 66:
Binary angles are mapped using B0, with 0 as 0 degrees, 0.5 as 90° (or <math>\frac{\pi}{2}</math>), &minus;1.0 or 0.9999999 as 180° (or π) and &minus;0.5 as 270° (or <math>\frac{3\pi}{2}</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>[http://blogs.msdn.com/shawnhar/archive/2010/01/04/angles-integers-and-modulo-arithmetic.aspx Angles, integers, and modulo arithmetic] Shawn Hargreaves, ''blogs.msdn.com''</ref>).
 
The terms '''Binarybinary Angularangular Measurement Systemmeasurement''' (BAMS)<ref>[http://acronyms.thefreedictionary.com/Binary+Angular+Measurement+System Binary Angular Measurement System] ''acronyms.thefreedictionary'BAM'</ref>'')<ref name="ship">[{{cite web |url=http://www.tpub.com/content/fc/14100/css/14100_314.htm BINARY|title=Binary ANGULARangular MEASUREMENT] {{webarchivemeasurement |archive-url=https://web.archive.org/web/20091221160257/http://www.tpub.com/content/fc/14100/css/14100_314.htm |archive-date=December 21, 2009 -12-21}}</ref> and ''www'binary angular measurement system''' ('''BAMS''')<ref>{{cite web |url=http://acronyms.tpubthefreedictionary.com''/Binary+Angular+Measurement+System |title=Binary Angular Measurement System |work=acronyms.thefreedictionary}}</ref> andas well as '''brads''' ('''binary radians''' or '''binary degree''') refer to implementations of binary angles. They find use in robotics, navigation,<ref>[http://www.globalspec.com/reference/14722/160210/Chapter-7-5-3-Binary-Angular-Measure Real-Time Systems Design and Analysis] Chapter 7.5.3, Binary Angular Measure , Phillip A. LaPlante, page via ''www.globalspec.com''</ref> computer games,<ref>[http://fabiensanglard.net/doomIphone/doomClassicRenderer.php Doom 1993 code review] Fabien Sanglard, section "Walls", 13/1/2010, ''fabiensanglard.net''</ref> and digital sensors.<ref>[http://www.hobbyengineering.com/specs/PX-29123.pdf Hitachi HM55B Compass Module (#29123)] {{webarchive |url=https://web.archive.org/web/20110711172521/http://www.hobbyengineering.com/specs/PX-29123.pdf |date=July 11, 2011 }} pdf via ''www.parallax.com'' via ''www.hobbyengineering.com''</ref>
 
No matter what bit-pattern is stored in a binary angle, when it is multiplied by 180° (or π) using standard signed [[fixed-point arithmetic]], the result is always a valid angle in the range of −180° [[degree (angle)|degree]]s (−π [[radian]]s) to +180° degrees (+π radians).