6 ms·
Why was this feature accepted whereas 128 bit floats were removed from Rust?
by searealist 10y ago
Why was this feature accepted whereas 128 bit floats were removed from Rust?
- steveklabnik 10y ago128 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/weekly-meetings/2014-06-24.md#removing-f128 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.
- kevhito 10y agoI wasn't able to find any real justification beyond (a) one vague mention of "some algorithms... such as certain cryptographic algorithms" and (b) the fact that clang supports it. Can you point to something more specific? Justification (b) in particular smells bad to me.
- steveklabnik 10y agoI wasn't involved in the discussion really, so I don't have anything off-hand. I can see why (b) might smell a bit bad, but think of it this way: we share a backend with clang, and so if they think support is mature enough to ship, then that's a very positive sign.
- kevhito 10y agoOh, just found this: > The Duration type could be simplified with this: instead of using a u64 for seconds with a seperate u32 for nanoseconds, it could just be a single u128/i128 count of nanoseconds. Of course, just a single u64 at ns precision would get you 500+ years of range. But ok.
- eropple 10y agoFive 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?
- Veedrac 10y agoTo 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.
- eropple 10y agoI can think of astronomical measures from a couple hundred years ago that are at least second-accurate. Do you want to have DurationSecondsOnly and Duration as types? =)
- Veedrac 10y agoIt's more an argument for floating point.
- TillE 10y agoFloating point is awful if you care about precision.
- Veedrac 10y agoWhat scenario would you need more than 53 bits of precision in a time variable for? Even eropple's somewhat excessive subsecond-accurate timing for an event several hundred years ago has plenty of room to spare with 53 bits.
- fulafel 10y agoThe x86-64 64x64->128 instructions.
- pettou 10y agoWhen you say "details very much might have changed between then and now", are there any news on bringing in the float128 type? I mean, do you happen to know whether there is any reasonable chance of having it in Rust at all?
- steveklabnik 10y agoNobody since then has championed it, so there's been no progress. Because of that, I'm not aware of how much effort it would be to add; the compiler has changed a lot since those days. That might make it easier or harder.
- frozenport 10y agoAs a side note, what are some use cases for 128 floats?
- santaclaus 10y agoInterior point methods?
- ant6n 10y agohow about bit look up tables.
- ant6n 10y agoFor whoever downvoted, the issues of u128 types came up in the discussion for this function: fn is_token(c: u8) -> bool http://kamalmarhubi.com/blog/2015/09/15/eliminating-branches-in-rust-for-fun-but-not-much-profit/ http://kamalmarhubi.com/blog/2015/09/15/eliminating-branches...
- petters 10y agoSome numerically unstable problem require a lot of precision of solve successfully. Similarily, well-behaved problems can be solve with 32-bit floats, but many require 64-bit floats.
- frozenport 10y agoSo, then 64 bits is enough ( because the problems are being solved at present under 64 buts)? From personal experience, numerical ill behaved problems don't benifited from more precision, rather they benifited from being scaled to be numerically stable. Things like trust parameters, or preconditioners like SSOR.