Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <trinity-90807052-9a8f-4679-8ed0-a1dfcff580c1-1751699163321@trinity-msg-rest-gmx-gmx-live-847b5f5c86-cp255>
Date: Sat, 5 Jul 2025 07:06:03 +0000
From: newbie-02@....de
To: musl@...ts.openwall.com
Subject: Research / study about the state of computer arithmetic.

 
hello @ all,  
  
!!! please no answers / discussions on the list except there are points  
touching musl !!!  
  
I'm considering about possible improvements of computer math towards human  
common decimal math compatibility and better preserving math logic for some  
time now. There are options, and I came up with the idea to ask around if  
people have additional knowledge or ideas.  
  
That's not the focus of musl, so pls. no discussions here, however Rich  
suggested to provide another place for discussions and seek / ask for  
interested experts here.  
  
I opened two projects, one for "math logic":  
https://gitlab.gnome.org/newbie-02/considerations-about-math-logic-in-it  
and one for "decimal datatypes":  
https://gitlab.gnome.org/newbie-02/considerations-about-decimal-datatypes.  
  
So if anyone reading here has expert knowledge or ideas for the question(s)  
below I'd appreciate if (s)he would put them there as "issues". ( it requires  
a registration to gitlab which is easy and anonymous as far as I remember. )  
  
thanks a lot for any help.  
  
-----------------------------------------------------------------------------
  
I wonder if you might have some expert knowledge about a special field of 
computer math, or even some new ideas, that you are willing and able to share.  
  
The overarching idea / objective is that computers should better support the  
math logic and "decimal arithmetic" that humans are used to.  
  
My idea is the following:  
  
There are two concurrent sights on math in computers. Humans learn "decimal" in  
school and expect computer math to be harmonic to that, while computers "learn"  
"binary" regarding simplicity in integrated circuits and price / performance  
benefit in production.  
  
The issue is fourfold:
- few people understand the differences between binary, decimal, fraction and
real math, the majority just thinks about "numbers", having the scope that
decimal fractions are "numbers",
- computer systems have some shortcomings when trying to match decimal fractions
math by binary approximations,
- however "short decimal fractions" are the! common "human datatype" in everyday
use,
combined together the above leads to sometimes "slightly inaccurate" results,
unsatisfying user experiences and broken math logic.
- And working with broken math logic, or a logic they don't understand, leads to
wrong results and disasters.

Men in the middle, programmers and developers, stand in the tension between
these poles, and should actually listen to one of their great masterminds.
Prof. Kahan clearly stated in 2006:
"Redesigning computers costs less than retraining people, so it behooves us to
adapt computers to the way people have evolved rather than try to adapt people
to the way computers have evolved."[1].

However they rarely do that and instead try to sell binary computer math as
superior - which it is in approximating real or fractional math - to people who
think in ( decimal! ) "numbers", who are used to "ties away from zero" rounding,
and who demand results matching what they learned in school. Consistency!

This fuels old ( since 1985 ) and ongoing discussions on the ping-pong level
"binary is better" versus "maybe better but not fitting my needs" which are
beneficial for ... nobody. In these discussions and flamewars we have some
questionable wisdom, and some rumors instead of knowledge.

From user's sight it would be beneficial to end the irritations and discussions
and just calculate according to their implicit expectations.

From programmer's / programming view it would ease coding and avoid some fails
if the computers would follow math concepts which the coder can predict,
Jack Rusher stated recently ( 2022 ):
"The ability to emulate the computer in your head."[2].
Steve Summit in 2025:
"Binary floating point does pretty badly violate the "principle of least
surprise".[3]

I'm actually investigating in three sectors:

- Are the available decimal datatypes sufficient for general use? How is the
performance? What about the accuracy?
Preliminary results: The free decimal math library "libdfp" is qualified for
simple arithmetic, it has poor accuracy and immense performance penalties for
anything more complex. "Mpdecimal" has less ( nearly no ) shortcomings, but
lacks trigonometric functions and requires C++ as language or a complex syntax
in "C".

- Are the proposed workarounds ( Rounding, calculating with integers ... )
sufficient to reliably serve people's decimal needs?
Preliminary results: quite often they do work, however they require constant
awareness of coders and users, and the idiosyncrasies still like to strike from
time to time.

- Can math with binary datatypes be bent towards decimal compatible results?
E.g. 0.2 + 0.1 -> 0.30000000000000004 is a rounded midpoint result in binary64,
for this case rounding down instead of up would stay decimal math compatible.
Preliminary results: There are some options, alas the "binary oriented people"
are not interested, and most "numbers oriented" people are not aware of the
issues.

I can well imagine that in 40 years of computer mathematics approaches have
fallen through the cracks that would have been interesting or better from
today's perspective. I would like to round off my studies with the following
question:

If you are aware of any such approaches, I would be curious to hear
about them. I'm seeing you among the few people which might have knowledge which
is in danger to vanish in the mists of time.

I'm interested as well in:
- to-the-point details,
for example: access to the adapted code, used input and detailed results for
"Performance Analysis of Decimal Floating-Point Libraries and Its Impact on
Decimal Hardware and Software Solutions"[3] would be nice, as in
- background info,
market segment and share of decimal datatypes, are there and which applications
using them? Market share and performance of decimal supporting hardware, other
comparisons between binary and decimal performance, who objected using decimal
types in Excel? Quality and performance of other than the "lipdfp" decimal
libraries and so on ...
- and anything else in the field which you think could broaden my horizon. It's
an open question, I can't predict what I'm still missing. The harder an
information is to find online the more likely it's new and interesting for me.

Do you have some time to reflect about this? Any hints are appreciated.

I'm writing this question to some persons which I think might have extra
knowledge or ideas.
I'd also appreciate if you can point to others who can provide to or might
be interested in the topic.

best regards,



Bernhard


( Pls. account that I did! read the FAQ and documentation at
https://speleotrove.com/decimal/ as well as
https://www.bytereef.org/mpdecimal/index.html . )

[1] William "Velvel" Morton Kahan, "How Futile are Mindless Assessments of
Roundoff in Floating-Point Computation ?," UC Berkeley, 2006. [Online].
Available:
https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf ,
retr. 2025-04-07

[2] Jack Rusher, "Stop Writing Dead Programs," Strange Loop conference, 2022.
[Online]. Available:
https://www.youtube.com/watch?v=8Ab3ArE8W3s
at about 3:27 min. , retr. 2025-05-07

[3] Steve Summit, in a comment on "converting doubles to long doubles,
understanding of 'binary vs. decimal' ambiguity? and is there a standard
solution?," stackoverflow.com, 2025 [Online]. Available: https://stackoverflow.
com/questions/69268520/converting-doubles-to-long-doubles-understanding-of-
binary-vs-decimal-ambigu/69363930 , retr. 2025-06-22

[4] Michael J. Anderson et.al., "Performance Analysis of Decimal Floating-Point
Libraries and Its Impact on Decimal Hardware and Software Solutions," IEEE, 2009
[Online]. Available:
https://iccd.et.tudelft.nl/2009/proceedings/465Anderson.pdf ,
retr. 2025-06-16

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.