Robert Jacques: > I do GP GPU work, so I use floats all the time. They're also useful for > data storage purposes.
Today GPUs are just starting to manage doubles efficiently (Tesla?). > For your information, the x87 can only perform computations at 80-bits. If you compile D1 code that doesn't contain "real" types with 32-bit LDC it uses SSE instructions on default (just 8 registers), this means most computations are done with 64 bit doubles. And in real programs, that use trigonometry, ecc, this is not the whole story. > Yes, this auto-promotion of literals is very annoying, and it would be > nice if constants could smartly match the expression type. Polysemus literals in general (here just floating point ones) have being discussed several times in past, but I don't know if floating point polysemus literals can be implemented well, and what consequences they will have in D code. Maybe Don is able to give a good comment on this. > By the way, C/C++ also behave this way, which has gotten me into the > habit of adding f after all my floating point constants. I presume if you take a good amount of care, in C (and probably in D too) you are able to avoid the performance problems I was talking about. But given a perfect programmer most warnings become useless :-) The warnings are usually meant for for programmers that do mistakes, don't know enough yet, miss things, etc. Bye, bearophile
