From: Peter Vandenabeele Date: 2012-01-23T19:35:07+09:00 Subject: Re: Microrant on Ruy's Math Skills --20cf3033497379319c04b72f95e2 Content-Type: text/plain; charset=UTF-8 On Mon, Jan 23, 2012 at 11:33 AM, Peter Vandenabeele wrote: > On Mon, Jan 23, 2012 at 9:29 AM, Robert Klemme > wrote: > >> On Sun, Jan 22, 2012 at 3:03 AM, Intransition >> wrote: >> > So they can drop a billion transistors on a chip, have implemented 3D >> > pipelines and video codec optimizations in hardware, but no one ever >> thought >> > thay maybe it would be a good idea to support accurate base-10 math on >> the >> > die? >> >> Floating point math with binary representation of numbers is more >> efficient than with decimal because you need less bits for >> representing the same number. And there is a standard for floating >> point arithmetic which clearly defines how it must be done (i.e. base >> 2): >> >> >> http://en.wikipedia.org/wiki/Floating_point_number#IEEE_754:_floating_point_in_modern_computers >> >> So BigDecimal is always the special case while the standard is binary. >> It's good that Ruby does not digress from this standard because if it >> would do this could have dramatic effects (on performance for >> example). >> > > > Feature request: > > Based on this discussion, it would actually be useful to me if I could > shorten this: > > amount = BigDecimal.new("15.5") > > to > > amount = 15.5B > Maybe 15.5D is better naming (maps to "Decimal" and the %d of format string). Peter --20cf3033497379319c04b72f95e2--