Re:Why do programming languages suck at math?
by Gibbon1 on Sunday June 25, 2017 @08:36PM
(#14633093)
When I've brought this up it's pretty obvious that while their were historical reasons behind it, not it because of cargo cult ideas of how numeric variables should work.
In any higher level language the default numeric variable should be an algebraic decimal float, not a binary int or float. Doesn't mean ints and floats shouldn't exist, but they shouldn't be the default.
Meaning when a programmer writes
number x = 2/3;
number should equal 2/3. Not an approximation of 2/3.
In any higher level language the default numeric variable should be an algebraic decimal float, not a binary int or float. Doesn't mean ints and floats shouldn't exist, but they shouldn't be the default.
Meaning when a programmer writes
number should equal 2/3. Not an approximation of 2/3.