c++ - is there any difference between f+=1 and f+=1.0 if f is a double? -


suppose have double f;

is difference between f+=1 , f+=1.0 ?

how compiler handler these situations?

i tried on computer , loop 1010 times, elapsed time same

referring c++03 here.

4.9 floating-integral conversions [conv.fpint]

an rvalue of integer type or of enumeration type can converted rvalue of floating point type. result exact if possible. otherwise, implementation-defined choice of either next lower or higher representable value.

if system can represent 1.0 (and looks can), expressions same.


Comments

Popular posts from this blog

double exclamation marks in haskell -

qml - Is it possible to implement SystemTrayIcon functionality in Qt Quick application -

Qt Creator - Searching files with Locator including folder -