Announcement

Collapse
No announcement yet.

.f ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    .f ?

    Ok, lol, what does this mean?!

    #.f

    ?!

    #2
    in what context?

    Comment


      #3
      You can add 'f' or 'F' to any float number.

      1.f == 1.0 and 1.23f == 1.23

      Just ignore it.

      Comment


        #4
        Is there any particular reason why I should use 1.f or 1.0 instead of 1 for floats? Or does that all compile into the same thing anyway?

        Comment


          #5
          1 (instead of 1.0 or 1.f) might be compiled into the code for "integer 1". This could lead to different results when using certain operators: 1 / 2 (= 0 IIRC - it's integer division) is not the same as 1.0 / 2.0 (= 0.5).

          Comment


            #6
            Then wats the point of f? lol

            Comment


              #7
              I'm talking about the use of 1 (without .f or .0) for float variables or defaultproperties, not hardcoded constants, so you cannot get an integer division. It's a rounded float, not an integer.

              I can imagine the engine treating a hardcoded constant 1 as an integer, yes.

              Comment


                #8
                The point is that you can do the same in C++.
                there's no real use (1.0 or 1.f doesn't matter, 1.0 is nicer though)

                btw, you can also write +1 instead of 1, it has no extra use, but you can do it.

                Comment


                  #9
                  Odd, so just ignore it?

                  Comment


                    #10
                    Originally posted by Wormbo
                    You can add 'f' or 'F' to any float number.

                    1.f == 1.0 and 1.23f == 1.23

                    Just ignore it.

                    Comment


                      #11
                      oh lol XD

                      Comment


                        #12
                        No you can't ignore it. I do not know its function in unrealscript. however in C++ you have to have the f after you type the number
                        value ( float Afloat = 1.0f; ). If you wrote it down like this
                        ( float Afloat = 1.0; ) the compiler will automatically change the number to the value of type double. I don't know why it does that. it's just stupid that way.

                        Comment


                          #13
                          However in Uscript you can ignore it. It's just a convention. They probably put support for that method of declaration for those that are coming from C based programming.

                          Comment


                            #14
                            There's only one floating point data type in UnrealScript, so it doesn't matter whether you add the f or not.
                            Just. Freaking. Ignore. It.

                            Comment


                              #15
                              r-o-f-l

                              Comment

                              Working...
                              X