Live data from Hacker News

Rust: 128 bit integers preparing to be released

github.com

21–30 of 173 posts

Re: Rust: 128 bit integers preparing to be released

#21
post #3

What 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 numerical integration. At any rate, it's important enough that many Forth dialects have a word for this specific operation [1].

[1] https://www.forth.com/starting-forth/5-fixed-point-arithmeti...

Re: Rust: 128 bit integers preparing to be released

#22
post #15
post #3

What sorts of applications/domains need or benefit from having 128 bit integers?

GUIDs are usually 128 bits. So are IPv6 addresses. Could be nice to store them in a single, native type? Probably no easier than a byte array though...

Neither one is used like an integer though. As in, you don't really add GUIDs together¹, so there's no real benefit over a byte array or struct.

1. I guess having bit mask operations for IPv6 addresses could be useful.

Re: Rust: 128 bit integers preparing to be released

#23

Why was this feature accepted whereas 128 bit floats were removed from Rust?

128 bit floats were removed years ago (June of 2014), here's the meeting notes from the time: https://github.com/rust-lang/meeting-minutes/blob/master/wee... (as with all old Rust stuff, please remember that details very much might have changed between then and now.)

In other words, they weren't removed because we fundamentally didn't want them. They were removed because of maintainability, usability, and usefulness concerns.

The RFC with justifications for why this was added (and all the related discussion) is already linked elsewhere in this thread. The same could still happen with f128 in the future.

Re: Rust: 128 bit integers preparing to be released

#24
post #19

Earlier quoted context omitted.

> After the quadratic hashes Reference: http://accidentallyquadratic.tumblr.com/post/153545455987/ru... (bugs happen, fix is in the queue, life goes on) > rumored memory issues Rumors are just rumors. If you (or anyone else) has more than FUD here, please email https://www.rust-lang.org/security.html .

Thanks for the link to the explanation of the hash table bug! > One proposal is that hash tables ought to retain their insertion order... This seems to be something that a lot of hash table implementations are converging on: https://morepypy.blogspot.com/2015/01/faster-more-memory-eff... Do you happen to have a link to the discussion for the Rust proposal?

I don't happen to have a link handy, no. I'm not even sure if it's a formal proposal or something someone happened to suggest one time, off the top of my head.

Re: Rust: 128 bit integers preparing to be released

#25
post #9

Earlier quoted context omitted.

Is this for implementing faster high precision floating point? It didn't mention 128 bit float.

For finance probably but it's mostly useful for statistics from what I understand. I know fortran and Cobol code that banks use and is used for science (tm) often defines numbers this large for certain operations. One such i can think of is a map reduce of large datasets. Let's say you want to find as a result a huge sum. 2^128 is a bit bigger then 2^64 and that difference may be big enough to provide the computation…

Fun fact: there are ~2^50 millimetres from here to mars

Re: Rust: 128 bit integers preparing to be released

#26
post #19

Earlier quoted context omitted.

> After the quadratic hashes Reference: http://accidentallyquadratic.tumblr.com/post/153545455987/ru... (bugs happen, fix is in the queue, life goes on) > rumored memory issues Rumors are just rumors. If you (or anyone else) has more than FUD here, please email https://www.rust-lang.org/security.html .

Thanks for the link to the explanation of the hash table bug! > One proposal is that hash tables ought to retain their insertion order... This seems to be something that a lot of hash table implementations are converging on: https://morepypy.blogspot.com/2015/01/faster-more-memory-eff... Do you happen to have a link to the discussion for the Rust proposal?

Here's the discussion about this problem on Rust's internals forum:

https://internals.rust-lang.org/t/help-harden-hashmap-in-lib...

Re: Rust: 128 bit integers preparing to be released

#27
post #6

People still care about Rust? After the quadratic hashes and rumored memory issues, I'd have thought people would've dropped interest in it by now.

> After the quadratic hashes Reference: http://accidentallyquadratic.tumblr.com/post/153545455987/ru... (bugs happen, fix is in the queue, life goes on) > rumored memory issues Rumors are just rumors. If you (or anyone else) has more than FUD here, please email https://www.rust-lang.org/security.html .

Why would they? Do you have any idea how much money a vuln like that would be worth? You've threatened to kill people on twitter and you think someone would turn something like that over to the team out of charity?

You're delusional.

I've never seen a million-dollar exploit, but DAMN if this wouldn't be close.

Re: Rust: 128 bit integers preparing to be released

#28
post #3

What sorts of applications/domains need or benefit from having 128 bit integers?

(Some) NVMe statistics are specified as 128-bit integers. Not that you need to operate on them, necessarily, or that they'll practically ever exceed 64-bit values, but they are.

Re: Rust: 128 bit integers preparing to be released

#29

Earlier quoted context omitted.

> After the quadratic hashes Reference: http://accidentallyquadratic.tumblr.com/post/153545455987/ru... (bugs happen, fix is in the queue, life goes on) > rumored memory issues Rumors are just rumors. If you (or anyone else) has more than FUD here, please email https://www.rust-lang.org/security.html .

Why would they? Do you have any idea how much money a vuln like that would be worth? You've threatened to kill people on twitter and you think someone would turn something like that over to the team out of charity? You're delusional. I've never seen a million-dollar exploit, but DAMN if this wouldn't be close.

> You've threatened to kill people on twitter

What?

Re: Rust: 128 bit integers preparing to be released

#30
post #9

Earlier quoted context omitted.

Is this for implementing faster high precision floating point? It didn't mention 128 bit float.

For finance probably but it's mostly useful for statistics from what I understand. I know fortran and Cobol code that banks use and is used for science (tm) often defines numbers this large for certain operations. One such i can think of is a map reduce of large datasets. Let's say you want to find as a result a huge sum. 2^128 is a bit bigger then 2^64 and that difference may be big enough to provide the computation…

What number in finance is bigger than 2^64?
Post reply on HN