cast von double to float



  • hi!
    ich muss in meinem programm von double auf float casten und habe folgendes dazu gefunden:

    when you cast a double to a float, the system shrinks the number's precision, and this shrinking may change the number's value because of rounding. The rounding generally occurs on the sixth or seventh decimal digit. Also, when you cast down from double to float, you run the risk of causing a run-time overflow error caused by a double that is too big or too small to fit in a float.

    weiß jemand, ab welcher größenordnung es zu einem solchen runtime-overflow kommt?

    lg,
    Iso



  • float reicht von 1,2*10^-38 bis 3,4*10^38
    Wenn dein double außerhalb dieses bereiches ist hast du deinen Overflow. Das kannst du aber alles auch rausbekommen, indem du bei Google "float Wertebereich" eingibst.



  • thx


Anmelden zum Antworten