[rust-dev] Appeal for CORRECT, capable, future-proof math, pre-1.0

Bob Ippolito bob at redivi.com
Fri Jan 10 21:50:02 PST 2014


On Friday, January 10, 2014, Lee Braiden wrote:

>  This may be go nowhere, especially so late in Rust's development, but I
> feel like this is an important, relatively small change (though a
> high-profile one).  I believe it could have a large, positive impact in
> terms of targeting new developer communities, gaining more libraries and
> applications, giving a better impression of the language, AND on
> performance and futureproofing.
>
> However, a lot of people who are interested in performance will probably
> baulk at this, on first sight.  If you're in that group, let me encourage
> you to keep reading, at least until the points on performance
> *improvements*.  Then baulk, if you like ;)
>
> Also, I said it in the post as well, but it's late here, so apologies for
> any readability / editing issues.  I tried, but sleep beckons ;)
>
>
>
> http://blog.irukado.org/2014/01/an-appeal-for-correct-capable-future-proof-math-in-nascent-programming-languages/
>

I think a pragmatic approach is to do what Haskell does and allow number
literals to be used for any type that implements the right typeclasses. You
can implement what you need to as a library, and if it solves problems then
people will use it.

(rant below, feel free to ignore)

Floats aren't horrible, you just have to know a little bit of numerical
analysis in order to use them properly (regardless of what base they are
in!). Most of the science and finance computations that I know of fit just
fine into the domain of fixed size floating point. The numbers have finite
precision to begin with, and there's often a ton of them so performance
matters. Having some arbitrary precision type where adding a really small
number to a really big one can take up an arbitrarily large amount of
memory and/or time probably isn't going to help much. Also, good luck
actually supporting real numbers unless you intend for this type to work
symbolically, and then you are building a computer algebra system. That's
not likely the right course for a systems programming language.

-bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140110/5652b37c/attachment-0001.html>


More information about the Rust-dev mailing list