Earlier quoted context omitted.
It could (there are 3rd party Rust libraries for arbitrary-size integers), but Rust focuses more on low-level features. Types that have fixed size at compile time are more useful in Rust and can be optimized much better.
I didn't mean dynamically sized integers. I meant at-compile-time-arbitrarily-sized-integers ;)
Rust: 128 bit integers preparing to be released
131–140 of 173 posts
Re: Rust: 128 bit integers preparing to be released
#132Earlier quoted context omitted.
However, Julia is a dynamic language and Rust is a static one.
I find your usage of the word static ambiguous. Also Julia is more static than you might expect, and besides it's still a compiled language, it just has a `dynamic` type (ala C# for example) as it's default type. It seems dynamic - like most lisps do - because it supports recompiling a function in a running session (however it doesn't change already compiled code, so not that dynamic).
Compilation strategy and code hotswapping are independent of static vs dynamic types. Java is statically typed, however its implementations support interpreted execution and code hotswapping.
Re: Rust: 128 bit integers preparing to be released
#133Earlier quoted context omitted.
What number in finance is bigger than 2^64?
The sum of the whole planet's annual GDPs, expressed as US dollars with a precision of cents, requires about 53 bits. Choose a smaller unit or start considering long time spans, and you can easily get uncomfortably close to overflow.
Re: Rust: 128 bit integers preparing to be released
#134Earlier quoted context omitted.
Five hundred years and eighty-four years? Recorded human history is almost ten times that range and history to which we can get precise dates is nearly five times that range. There are financial debts being paid, today, that exist from nearly the limit of that range (Dutch debts dating from 1624) even if you left a mere quarter of it for the future. So why are you middlebrowing at this?
To be fair, you basically never need scale and precision at the same time. Debts from 400 years ago aren't known down to the nanosecond.
Floating point errors are hard to reason about and often makes equality a very fuzzy concept. If your not starved for bandwidth or memory, large fixed precision numbers are incredibly useful.
Re: Rust: 128 bit integers preparing to be released
#135What sorts of applications/domains need or benefit from having 128 bit integers?
The main operation I can think of is multiplying by a ratio without losing precision. If all your values are specified in 64-bit fixed point, a 128-bit integer type gives you something with enough bits for the intermediate product. It's not something I've really dealt with myself, but I seem to remember reading that this is really handy to have in some physics simulations and control system algorithms that do numeric…
It also is a lot less of a concern on modern systems, where floating point operations aren't much slower than integer ones.
Re: Rust: 128 bit integers preparing to be released
#136Earlier quoted context omitted.
IP addresses are used like integers all the time. Ask your friendly neighborhood sysadmin how a network mask works. (Maybe you want to foreach over an array every time you want to apply one. I'd rather not.)
Not really. They are never added, subtracted, multiplied, or divided. They are never compared for greater-than or less-than. Possibly they are compared for equality. About the only mathematical operations I can think of which are ever done to them are bitwise-anding, bitwise-inclusive-oring, and testing for zero (and, as mentioned, equality).
Re: Rust: 128 bit integers preparing to be released
#137What sorts of applications/domains need or benefit from having 128 bit integers?
Re: Rust: 128 bit integers preparing to be released
#138Earlier quoted context omitted.
It's more an argument for floating point.
Floating point is awful if you care about precision.
Re: Rust: 128 bit integers preparing to be released
#139Earlier quoted context omitted.
Not really. They are never added, subtracted, multiplied, or divided. They are never compared for greater-than or less-than. Possibly they are compared for equality. About the only mathematical operations I can think of which are ever done to them are bitwise-anding, bitwise-inclusive-oring, and testing for zero (and, as mentioned, equality).
What is your point? u32/u128 are not mathematical integers. They are actually bit strings, just like IP addresses and unlike mathematical integers.
Re: Rust: 128 bit integers preparing to be released
#140Earlier quoted context omitted.
To be fair, you basically never need scale and precision at the same time. Debts from 400 years ago aren't known down to the nanosecond.
You usually don't need scale and precision at the same time, but a lot of algorithms get a lot simpler if you don't have to worry about rounding errors that get worse with every operation. Floating point errors are hard to reason about and often makes equality a very fuzzy concept. If your not starved for bandwidth or memory, large fixed precision numbers are incredibly useful.