Aller au contenu

Photo

Floats


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Leurnid

Leurnid
  • Members
  • 271 messages
Why do I sometimes see floats set with an "f" after the value, for example:

float fRootBeer = 12.0f;

and other times the trailing "f" is omitted?

float fYourBoat = 10.0;

I have seen it both ways (in the same script, even) and can't find any rhyme or reason for the "f" at the end of the value in the first place, let alone why it is used for some but not other float values.

Modifié par Leurnid, 19 mai 2012 - 09:19 .


#2
_Guile

_Guile
  • Members
  • 685 messages
Because some noobs, like myself, didn't realize that you don't have to put the f after the actual float..

:D

#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
It is a legacy format of older programming languages. The option of having the f at the end of the float was left for the convenience of people who where either use to it or liked having it. That way they would not have to change there syntax from one language to another. In NWNscript it is simply optional, in other languages it is mandatory.

#4
Leurnid

Leurnid
  • Members
  • 271 messages
Thank you.