Shriramana Sharma:
Hello. I like that D exposes to me the real type to maximally
utilize
the machine's numerical precision. Since I am writing a program
(currently in C++ but I am thinking of moving to D) that has to
handle
lots of fractional numbers (calculating offset curves and such)
I am
wondering whether/when I should real instead of double or even
any
arguments in favour of staying with double (compatibility with
C/C++?). Any pointers appreciated please? I checked the FAQ but
it
doesn't seem to mention this.
If you have to store many reals, they require more memory than
doubles (how much is relative to the operating system). Regarding
speed in theory double and real should give the same, but in
practice theory and practice often differ. As suggested, use an
alias like:
alias FP = real;
And switch from double and real, and take a look at the
differences. But don't perform such switch at the end, do it now
and then to be sure everything keeps working correctly.
Bye,
barophile