Why isn't 'float' simply an alias for 'float64' just like 'byte' is an
alias for 'uint8'?
Those who want to minimize memory use will use float32s---they already
have to convert if they want to use the standard math package, so making
float an alias for float64 wouldn't affect them.
And for those using 'float' it would mean eliminating the need to
convert all the time to use the math package. (It might increase the
memory their applications use though, if their implementation happened
to currently use 32-bit floats for float.)
Nor would it preclude Go supporting 'quad' precision 128-bit floats in
the future (float128s), although they'd need their own version of the
math package (qmath?).
--
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Advanced Qt Programming" - ISBN 0321635906
http://www.qtrac.eu/aqpbook.html
i thought there was an issue on this topic, but i couldn't find one.
here are a couple of links to old discussions on the topic:
http://groups.google.com/group/golang-nuts/browse_thread/thread/d7545b8325c43e15
http://groups.google.com/group/golang-nuts/browse_thread/thread/25d8068784971c15/65a2cf75662838a6
I don't think that in-context Russ' statement meant that he thought
floating point wasn't important, but rather that he and the other core
developers aren't keen on making decisions on floating point without
outside input.
Since that quote was made, he's floated the idea (which seemed likely
to be implemented) of removing the "float" type entirely. Personally,
I think that's a good approach. Type synonyms are ugly and
potentially confusing (and there's only one of them in the language,
as far as I know: byte). Making everyone type "float64" is the same
number of characters as the "double" we're all accustomed to typing
(unless you're coming from fortran), and is clearer to newcomers.
--
David Roundy