0

Float with more than 3 numbers after the dot.

Hi, how can i set a float that is able to safe values with up to 8 digits after the dot?

13th Feb 2017, 12:11 PM
Christian Klünter
Christian Klünter - avatar
3 Respostas
+ 4
round() can do this, I think.
13th Feb 2017, 12:23 PM
Mario L.
Mario L. - avatar
+ 1
ok, i will try it. thank you :) but i think i have found my Problem: it ist in assigning a float to a constant value of 0.02223 to calculate with it i'm doing it like this: float eegum; . . . if... eegum = 0.022239; . . . in the Programm it will Change to "5.07059e+266". i'm not sure what can cause this problem. if I work with "cin" it works fine :/
13th Feb 2017, 12:44 PM
Christian Klünter
Christian Klünter - avatar
+ 1
if found the problem! :D it was a failure in an if-statement without the else. so that the variable "eegum" wasn't set. and without a default value, it doesn't work properly
13th Feb 2017, 1:03 PM
Christian Klünter
Christian Klünter - avatar