c++ - Why my double is shown as scientific? -


how can add scientific , float number ? have like

 var1 0.99999899 var2  3.5008552e-05 sum  3.5008552e-05 

but dont understand why in first place var2 shown scientific while in first place declared

double var1, var2;  

so, sum var2...

thanks

a

the way floating-point value displayed down mechanism display it. not property of value itself, nor in way stored within variable:

a number number number. call "scientific" not class of numbers. it's class of representations of numbers. same way "twelve" , "12" , "xii" , "a dozen" , "iiiiiiiiiiii" represent same number. "scientific" thing exists when decide represent number in specific way (i.e. when output it). calculations don't "turn numbers scientific" same way saying "2 * 6 twelve" doesn't turn numbers english words. variables store numbers not representations. — r. martinho fernandes

your display mechanism — std::cout? — choosing best way output value. can override io manipulators such std::fixed, though it's pretty fiddly how want it, due library limitations.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -