Live data from Hacker News

Why do programming languages suck at math?

news.ycombinator.com

11–14 of 14 posts

Re: Why do programming languages suck at math?

#11

> What's the whole reason behind distinguishing between integers and float/doubles? Because historically CPUs worked efficiently natively on integers, and everything else was software. (Modern CPUs also work efficiently natively on floats, but with different representation and operations.) Note that not all languages (even o n your list) have the problem you describe though; plenty of automatic coercion with numeric…

I just did a quick test on my comp with python 2.7.13, perl 5.24, perl 6, ruby 2.3.3 and php 7 and they all worked.

Re: Why do programming languages suck at math?

#12

> What's the whole reason behind distinguishing between integers and float/doubles? Because historically CPUs worked efficiently natively on integers, and everything else was software. (Modern CPUs also work efficiently natively on floats, but with different representation and operations.) Note that not all languages (even o n your list) have the problem you describe though; plenty of automatic coercion with numeric…

It was actually working with Ruby and dollar/cents amounts for Stripe that led to this frustration, haha. Thanks for the insight!

Re: Why do programming languages suck at math?

#14
Simply put: Out compilers and interpreters force us humans to think more like the underlying machines, rather than vice-versa. It is ass-backwards. We should absolutely demand that our tools help the computers under what we want and not the other way around.
Post reply on HN