Decimal FP faster than binary?

3 newbie-02 1 8/18/2025, 3:28:05 AM
Mike Cowlishaw recently pointed me to the decNumber library, and I see fantastic I/O performance that can often compensate for slower calculations. For example, the telco benchmark with output to file runs faster here with decDoubles than with binary64, 0.629 versus 0.720 seconds. In software emulation, not on a Power or z9 processor. Before I spread misinformation, I would appreciate it if someone could double-check this. It would also be nice to have the following statements/results/questions checked: - decNumber lacks trigonometric and some other functions, - as does mpdecimal, which calculates faster but is slower in I/O than decNumber, - libdfp using BID encoding is okay for basic arithmetic, but terribly slow in I/O and often slow and inaccurate for more complex calculations, - does anyone have experience with libdfp using DPD encoding? - IRDFPML (Intel (R) Decimal Floating-Point Library) calculates various functions in binary rather than decimal and therefore has good speed but occasional outliers in accuracy.

Comments (1)

zgs · 3h ago
I used decNumber in the WP 34S project (https://sourceforge.net/projects/wp34s/) and more recently in the C47 project (https://47calc.com).

You are correct in that the decNumber library doesn't support trig operations. Arithmetic, log, exp and square root plus rounding and some conversion functions.

My experience is that decNumber is generally slow. Logarithms are especially slow. Intel's decimal library is much faster & as you noted, it uses binary operations to start it's algorithms.