1. 6
  1.  

  2. 7

    It seems like the general consensus on Proggit and Hackernews is that this isn’t really a good idea, and I would agree.

    From a feasibility and performance standpoint, this stinks. There is no hardware support, and it’s unlikely that there ever will be given that implementing base-10 floating point hardware is trickier than implementing base-2 floating point hardware (you can’t just shift bits). Said hardware would also be slower, larger, or more power hungry because of aforementioned complexity.

    From a usefulness standpoint, this is highly questionable. If you are in a situation in which you don’t want to lose precision to rounding (like when handling money), you should probably be using either fixed point or arbitrary precision decimals. If you actually want limited precision floating point, using a decimal base isn’t going to give you more precision.

    1. 1

      Either:

      1. You care about precise subdivisions of integer quantities. In this case, keeping an integer count of subdivisions is the correct thing to do, e.g. US$ should be accounted as an integer number of cents.
      2. You don’t care about precise subdivisions of integer quantities. In this case, binary fixed or floating point is the correct thing to do, since the complexity of dealing with another base in a binary computer is hugely greater and the benefits are nil.

      I don’t get some people’s obsession with decimal types. It’s never the correct way to represent numbers in a computer.

      Unifying number types is stupid, too. Even mathematicians (the masters of sloppy typing) separate integers and reals, because they’re different things.

    2. 2

      Beyond just the quality of this proposition, the wording suggests repeatedly that DEC64 is designed to replace all numeric types in “the next generation of application programming languages”. This seems aligned with Crockford’s previous choices around numeric types, but strikes me as nonsense. There’s a huge difference—algebraically, rounding, performance, semantics—between the various numeric types. Shoehorning them all together might be convenient, but is just asking for pain.