On 17 August 2010 04:15, Graydon Hoare <[email protected]> wrote: > Concept (3) is, well ... a bit of a matter of taste. But I think probably an > easy to explain one. Follow the supposed logic of doing (3): you're on x86. > So it has an x87. So float turns into f80. So now your FPU behavior ... > slows down *and* changes behavior on a platform-by-platform basis. Accuracy > is nice, but you want the default to be "pick accuracy over speed and > predictability"? I think this would be undesirable.
Hypothetical: you're writing for two target platforms. Platform A only has hardware support for f32. Platform B has hardware support for both f32 and f64, but f64 is significantly slower. The current wording of Ref.Type.Float requires that float resolve to f32 on A and to f64 on B. That is, it precisely requires that "FPU behavior slows down *and* changes behavior on a platform-by-platform basis". You're right that my OP was blurry, and I'm absolutely not suggesting that anyone should implement f80 (though reserving it sounds eminently sensible). But I think that the existence of fast f64 on x86 - the ability to have your cake and eat it - is concealing a lack of clarity in this section. If I'm on x86 and I know it and I want fast predictable SSE2 mode, I'll declare as f64. If I declare something as float, it's precisely because I *want* to change behaviour on a platform-by-platform basis; I want the compiler to pick the "best" type available, and I'm accepting a loss of predictability as the price of that. The trouble is that, without a definition of "best", it's hard to know whether float will capture my intent or not. How about "The Rust type float [...] is the fastest supported floating-point type. If several types are equally fast, it is the largest of those types [...]" - would that capture the rationale behind your taste? - Mike _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
