Complete floating point literals

bearophile bearophileHUGS at lycos.com
Sun Jul 10 08:24:35 PDT 2011


So far 8 people beside me have answered with a positive vote (Alex Dovhal, Andrej Mitrovic, Bernard Helyer, Daniel Gibson, Jacob Carlborg, Nick Sabalausky, Simen Kjaeraas, Timon Gehr) and so far no one has voted against it.

Currently the enhancement request in Bugzilla has 7 votes (cbkbbejeap, metalcaedes, timon.gehr, brian-schott, doob, mike-wey, josvanuden).

I'd like to know what Don thinks about this because he knows floating point matters well, but he will be absent for few more days.

I'd like to know what Andrei and Walter think about this small breaking change. Walter is currently busy with the beta of 2.054, but maybe he is able to find the bit of time to comment.

Jacob Carlborg reminds that 1.f conflicts with the UFCS, I think the suggestion by Daniel Murphy of the special case is not worth it.

If this idea gets accepted then I think it's worth changing the other direction too, I mean the default printing of a floating point value with no decimal part:


import std.stdio;
void main() {
    double x = 3.0;
    writeln(x);
}


Currently (2.054beta3. I'd like beta releases to show a progressive beta number too) this prints:

3

Python here prints 3.0 and I think D is better to do the same, especially if the leading zero becomes required for the FP literals.

Bye,
bearophile


More information about the Digitalmars-d mailing list