14 ms·
The Joy of Sexagesimal Floating-Point Arithmetic
- leni536 9y agoI think the basic idea is that highly composite numbers [1] make good bases. It's a trade off between the number of divisors of the base and the number of digits we want to learn. Note that both 12 and 60 are such numbers. [1] https://en.wikipedia.org/wiki/Highly_composite_number https://en.wikipedia.org/wiki/Highly_composite_number Also it looks like the Babylonian is a composite system, where the 'digits' are represented in base 10 (the 10s use a different digit, but it doesn't matter). They could alternatively use base 12 for this digit.
- kutkloon7 9y agoYes, composite numbers have many advantages. Working in base 60 = 2^2 * 5 * 3, has advantages of working in base 2, base 5, and base 3. In base 10, you can quickly spot multiples of 2, 5, and ten (or alternatively, reduce any number module 2, 5, or 10).
- heycam 9y agoFirefox and Servo use 1/60 as the smallest layout unit for the same reason. http://searchfox.org/mozilla-central/source/gfx/src/AppUnits.h http://searchfox.org/mozilla-central/source/gfx/src/AppUnits... http://doc.servo.org/app_units/ http://doc.servo.org/app_units/ https://bugzilla.mozilla.org/show_bug.cgi?id=177805 https://bugzilla.mozilla.org/show_bug.cgi?id=177805
- microcolonel 9y agoIt's cool and all, but keeping that decision has led to some pretty annoying bugs in SVG (and other) transforms. https://bugzilla.mozilla.org/show_bug.cgi?id=844258 https://bugzilla.mozilla.org/show_bug.cgi?id=844258
- schindlabua 9y agopsh, it's 2017. Clearly we should switch to hex, ditch scientific notation and decimal points and all that difficult junk, and just use IEEE 754 double precision notation for all our calculations. Granted the sign bit in front makes hex notation a bit awkward but I believe it will give us a nice kickstart for when we will inevitably be subsumed by our AI overlords.
- eadmund 9y agoSixteen doesn't have 3 as a factor. IIRC, it's not possible to represent .1 (or is it .2) accurately in IEEE 754. Better to use duodecimal.
- JadeNB 9y ago> IIRC, it's not possible to represent .1 (or is it .2) accurately in IEEE 754. > Better to use duodecimal. Assuming you mean the decimals 0.1 and 0.2, they can't be represented as terminating duodecimals (which is different from not being represented accurately!), either. Whatever base you choose, someone's favourite fraction won't have a terminating expansion.
- SAI_Peregrinus 9y agoIEEE754 includes two decimal floating point basic formats: decimal64 and decimal128. 0.1 can be accurately represented. Of course in any base there will be some non-terminating representations of rational numbers, so changing the base of the floating point system changes which numbers these are but does not eliminate them.
- kutkloon7 9y agoI'm not sure why the author included 'floating point' in the title (probably to hint that the Babylonians did not use a symbol for zero, and had the point floating in blank space). To technical-minded people, floating point is synonymous with hardware that computes using a floating point representation, so this is a bit deceiving.
- pvg 9y agois synonymous with hardware Wait, no it isn't. It's about the representation (in contrast to 'fixed point'), the hardware is an implementation detail.
- jacobolus 9y agoThe ancient Mesopotamian (Sumerian/Akkadian) system was floating point. The exponent was implied rather than explicitly written though. So 1/120, 1/2, 30, and 1800 were all written the same way. Modern 'scientific notation' is also floating point.
- kutkloon7 9y agoAhh, that explains a lot. Thanks.
- kps 9y agoFor a century up to the 1970s most engineering calculations were done to three decimal digits with implied-exponent floating point hardware¹. ¹ https://en.wikipedia.org/wiki/Slide_rule https://en.wikipedia.org/wiki/Slide_rule
- deleted 9y ago[deleted]
- jeffwass 9y agoBelow is a slightly-modified comment I wrote 59 days ago on benefits of Duodecimal (Base-12) over Decimal and Hexadecimal. Sexagesimal takes the benefits of Duodecimal further by introducing a nice factor of five into the mix, though at the expense of 48 extra digits. Base-12 is a nice sweet spot for having high number of divisors vs the number of digits in the base. ----- I was about to post that in my opinion base-12 is superior to base-10. But someone beat me to it. In a sci-fi novel I'm writing, an advanced alien civilisation uses base-12. As to your question specifically regarding base-16 instead of base-12, it depends. Decimal itself is just a bizarre choice, most likely due to humans having literally ten digits. In decimal we can represent exact fractions of 1/2, 1/5, and 1/10 (without repeated decimals like 0.33333 for 1/3). Counting by fives (and twos) is very easy. But choosing prime factors of 2 and 5 is a strange choice in itself. Why skip 3? Why is it more useful to easily represent fraction 1/5th as 0.2 instead of 1/3rd? How often do we use fifths? Hexadecimal in one sense is easier, all prime factors are two. So we can represent 1/2, 1/4, 1/8, and 1/16 exactly. Duodecimal (Base 12) is very convenient for having a high proportion of exact fractions. Eg - 1/12, 1/6, 1/4, 1/3, and 1/2 can all be represented exactly. I'd argue in everyday use we're more likely to consider 1/3rd of something than 1/5th. Counting by twos, threes, fours, and sixes is easy. Watch, let's count to 20 (24 in decimal) by different amounts. By 2's : 2, 4, 6, 8, A, 10, 12, 14, 16, 18, 1A, 20. By 3's : 3, 6, 9, 10, 13, 16, 19, 20. By 4's : 4, 8, 10, 14, 18, 20. By 6's : 6, 10, 16, 20. And conversely counting to 1 exactly by different fractions. By 1/6th : 0.2, 0.4, 0.6, 0.8, 0.A, 1.0 By 1/4th : 0.3, 0.6, 0.9, 1.0 By 1/3rd : 0.4, 0.8, 1.0 By 1/2th : 0.6, 1.0 Base-12 offers four handy subdivisions (excluding 1) instead of two for decimal or three for hexadecimal. That beats hexadecimal using fewer unique digits. It beats decimal by two using only two extra unique digits. And I think it's these reasons it was chosen for various historical subdivisional units (inches per foot, pence per shilling). The other item to consider is the relative number of unique values per digit. I'm not sure of the utility of having 10, 12, or 16 here. At one extreme, while binary is useful for discretising signals in digital logic, using only zeroes and ones becomes cumbersome for daily use at higher numbers. Once we're at base 10 and higher, I'm not sure how much here extra digits help or hurt.
- wahern 9y agoDecimal itself is just a bizarre choice, most likely due to humans having literally ten digits. I think that's probably a myth and there's little reason to think it's related to the number of fingers on our hands. People who count using body parts to keep track of multiples don't just use their fingers, but their knuckles, too, and sometimes other body parts. Lest you think that would naturally give rise to a power of 10, some extant systems only use the 12 knuckles of your four fingers--index, middle, ring, and pinky. The 10 fingers explanation seems obvious only because of confirmation bias, representativeness bias, etc. Even a cursory survey of appendage-based counting systems makes the number 10 much less likely than we naturally think. Include all historic numeral systems and base 10 disappears into the mix altogether. We get base-10 from the Hindus. Perhaps some ancient Hindu philosopher actually choose 10 because of our 10 fingers. But there's nothing obvious about it. As you amply point out, there's plenty of reasons to choose some other base, and plenty of civilizations did just that.
- AstralStorm 9y agoMight be simpler to explain if you keep using single symbols for digits, like modern base 36 or 64, instead of mixing positional and nonpositional numerals.
- ecma 9y agoDid you genuinely find it difficult to parse the comma delimited representation near the bottom of the article? Just curious. It seemed very natural to me, a minor variation on British style thousand separators.
- leni536 9y agoMaybe ':' would be a more familiar separator because of hours, minutes and seconds (yeah, hours don't go up to 60, but whatever).
- AstralStorm 9y agoMyself, not really given the context in the article. If I was shown this without context it would be pretty confusing. Using : would be better as or would suggest clock which is base 12 plus base 60... Letters are clearer still if given the base identifier - commonly subscript number. The suggested notation would make for interesting puzzles.
- mfukar 9y agoThe article is completely irrelevant to floating-point math. I guess even Scientific American has to attract clicks.
- deleted 9y ago[deleted]
- xelxebar 9y agoA bit of topic, but I'd like to see how practical continued fractions could be used in day to day calculations. It's mainly a matter of having decent arithmetic algorithms. Continued fractions have a lot of cool properties that positional notation doesn't: * Terminating expressions are exactly the rational numbers, * All (eventually) repeating expressions are precisely the roots of some quadratic polynomial (e.g. √2 = [1;2,2,2,...]), * Truncated expressions of irrationals give best approximations to their irrationals Also, some famous irrationals have easy to remember patterns in their continued fraction representation: e = [2;1,2,1,1,4,1,1,6,1,1,8,…] Φ = [1;1,1,1,...] (the golden ratio) Bessel(1,2)/Bessel(0,2) = [0;1,2,3,4,5,...]
- undersuit 9y agoI've been using reciprocal pairs for mental division for as long as I can remember and now I have a name for the process. I especially find myself using them while calculating distances while running or driving with little interruptions and wanting to avoid the mental load of long division.