If I want to write method converting from float to double.
Is there any case the two would give back different result?
Which version should I use if I don't care about platform consistency?
What if I need it to behave consistently in different platforms?
double f2d(float x) {
return (double) x;
}
or:
strictfp double f2d(float x) {
return (double) x;
}
JLS 5.1.2:
A widening primitive conversion from float to double that is not strictfp may lose information about the overall magnitude of the converted value.
why will this conversion lose info?