if you want just 2 digits after dot - use '%.2lf' instead '%g' i do so almost everytime if you need 4 digits - '%.4lf' but if you need exact value without rounding to fixed precision - there no good way to replace '%g' '%.NNNlf' rounds double to NNN decimal position
Комментарии: 13
Doctor
try '%.2lf'? or show code snippet?
Anonim
my program is calculator, maybe user input 1/1000
Dmitriy
Доайверы tmc 2225
Doctor
if you want just 2 digits after dot - use '%.2lf' instead '%g' i do so almost everytime if you need 4 digits - '%.4lf' but if you need exact value without rounding to fixed precision - there no good way to replace '%g' '%.NNNlf' rounds double to NNN decimal position
Anonim
ok, thanks
Doctor
welcome, but strange that codevision do not support '%g'
Roma
Емае, на английском заговорил
Doctor
а, да, это кстати мб не по правилам чата )))
Roma
Разве?
Doctor
а хз тут чот было типа правил, но я их не читал )))
Roma
А ну я тоже))
Rus
Можно хоть на казахском общаться
Anonim
It has not error, but when I run in proteus, displays exotic characters