On Mon, Jan 23, 2012 at 9:29 AM, Robert Klemme
<shortcutter / googlemail.com>wrote:

> On Sun, Jan 22, 2012 at 3:03 AM, Intransition <transfire / gmail.com> 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

Then we could also answer future questions about

"How come  1.1 - 1.0 != 0.1 ??"

with

"1.1B - 1B == 0.1B"

HTH,

Peter