Hacker News new | ask | show | jobs
by userbinator 1136 days ago
This IMHO very important information is buried near the bottom of the page:

The HP-42S represents numbers with a 12-digit decimal mantissa, and an exponent from 10^−499 to 10^499; Free42 Decimal uses a 34-digit decimal mantissa, and an exponent from 10^−6143 to 10^6144; and Free42 Binary uses native binary floating-point, which on all currently supported platforms is IEEE-754 double precision, with a 53-bit binary mantissa which is roughly equivalent to 16 decimal digits, with an exponent from 10^−308 to 10^308.

In other words, results will not be exactly the same as a real HP-42S. For a more authentic HP-42S experience, there's Emu42.

Also, just about every dedicated calculator uses decimal floating point for several reasons, such as simpler circuitry in the ASIC and keeping the human intuition that 0.1 + 0.1 is actually 0.2.

2 comments

There is a fork with that available.

as posted below:

For anyone that wants a physical version, SwissMicros makes a calculator based off of Free42: https://www.swissmicros.com/product/dm42

That website mentions that they use decimal floating point. Since free42 is licensed under gpl3, they have released the source.

https://github.com/swissmicros/DM42PGM/tree/master/lib

https://github.com/swissmicros/free42/tree/master/inteldecim...

They use Intel's library for decimal floating point: https://software.intel.com/en-us/articles/intel-decimal-floa...

It's still not the real HP-42S with its quirks, but it's nice to have decimal floating point operations.

Aside from keyboard not being quite at HP level (but then which one is? And it is still good), DM42 is entirely better version tbh. Even works with printer!

Weird obscure fact: The printer head for HP calculator printer was still available as new parts as late as 2019, coz it was used in variety of devices, I bought cheap non-working one and just replaced the head

The way you're using "decimal floating point" seems to imply there is a "floating point" that is not "decimal".

My understanding is that "decimal", in the context of programming, is a less-precise term to mean floating-point (i.e. encompassing IEEE 754 floats, double- vs single-precision, etc), because they're all binary numbers if you dig deep enough, right?

But apparently I am incorrect/underinformed about this.

What is "decimal", then?

Decimal means base 10. Decimus is the Latin word for 10, and deci- is the SI prefix for 1/10, e.g. decimeter is 1/10 of a meter. Decimal floating point is x*10^y whereas binary floating point is x*2^y . Compare to hexadecimal which means base 16.
Derp. I misunderstood.
IEEE-758 floating point standard defines decimal formats, decimal128 is relevant here, I believe that is what free42 uses: https://en.wikipedia.org/wiki/Decimal128_floating-point_form...