# Thread: set X to X -0.3 moves by -1.0 : bug or feature?

1. Interesting, but fusion turns - 4.5 to - 5, so I guess it uses flooring after all

2. Originally Posted by Volnaiskra
Interesting, but fusion turns - 4.5 to - 5, so I guess it uses flooring after all

Sorry that stuff in italics was just extra interesting info..

Here’s a link about the topic my understanding is that it’s a data conversion not a math function

https://stackoverflow.com/questions/...uble-to-an-int

3. Seams like adding 0.5 might be a solution though

V Edit v

“Adding +0.5 to a negative input before turning it into an int will give the wrong answer. The correct quick-and-dirty way is to test the input sign for <0, and then SUBTRACT 0.5 from the negative inputs before turning them into an int. Most of the following answers do not explain this properly. Note high-accuracy procedures should use the new slower "round()" function. – DragonLord Aug 13 '16 at 22:37”

Sorry that stuff in italics was just extra interesting info..

Here’s a link about the topic my understanding is that it’s a data conversion not a math function

https://stackoverflow.com/questions/...uble-to-an-int
From what I can understand of that page they're talking about truncating numbers, as int() does. In other words, just chopping off the digits after the decimal so that 1.3 becomes 1 and -1.3 becomes -1.

But that's not what Fusion is doing. Fusion is flooring the numbers, so that 1.3 becomes 1 but -1.3 becomes -2. That asymmetry what I've been banging on about in this thread. I wish it truncated/cast the numbers as int() does, but it shifts them 'left' to the nearest integer, as floor() does.

You easily see this for yourself: Do the following event, and you'll see that the red object moves, while the teal object does not.

5. really weird behaviour ... thanks for that insight, Vol. may @Yves bring some light into this topic? would be interesting, why fusion behave like this

6. You can use floor() ceil() round() int() abs() but you cannot use float() in the expression editor maybe we can have a function like that to preserve the decimal?! At least than we could set it at runtime and fusion would not floor it automatically.

7. Originally Posted by casleziro
This has been a thing for quite a long time iirc. Fusion can't handle anything but integers in the expression editor, i.e 0.3 turns into 0. This is why it's common practice to use values to handle floats. You can add 0.3 to a value constantly and set X of Active to X( "Active" ) + value and it will move correctly. Or in my opinion the "better" way is to set two values (xpos and ypos) to x and y of object at start, and treat these as the "real" position of the object that you modify, then always position the object at X = Round( xpos ) and Y= Round( ypos).
Yes its true, the guy in the video also does this but its still strange acting, look at the example.

Set varPos + varFloat = varFloat stack up NOT reflected on obj
Set x("Active") + varFloat = varFloat stack up reflected on obj

The varFloatSpeed is stacking up constantly like we tell it (look debugger), but why is it not reflected like that in both examples?

8. Here is an mfa i made of the zentaco tutorial i posted. Its in 4 frames. When you go through the tutorial it shows a number of ways to do things.
Instead of deleting parts and replacing them i made a new frame at each stage.
There are a few parts where he identifies even more ways to do things like how to get around the float and sine limits.
If a had a few more thousand hours in fusion id have a go at explaining it in detail. Im around the 500 hour mark. and never used any other engine. So i am still a noob compared to many.
Maybe that's a plus as im not expecting Fusion to be like other game engines or be a scientific calculator, i hated math at school. If my teacher had told me that i can make a character move in relation to fps or game loop id of taken more interest.
Any way for any that are interested in seeing the outcome of the video without doing the tutorial here is the mfa.
I used a taco as the player in homage to Allmightyzentaco.sub_pixel_movement_Taco.mfa

Taco64x96.png

9. Originally Posted by c4t
Maybe that's a plus as im not expecting Fusion to be like other game engines or be a scientific calculator, i hated math at school.
I don't think anyone's expecting it to work like a scientific calculator. Quite the opposite. I think those people who are surprised at this behaviour are surprised simply because it doesn't behave the way one would intuitively expect.

I'm also not a maths wiz and have never used another game engine. I'm a regular person like you, and that's actually the problem here: I was expecting it to behave in an intuitive way, or in a way that seems like commonsense to a regular person. But it doesn't. If someone asked me last week: "hey, when you give Fusion the number 1.01, it will change it to the whole number 1. Now, what whole number do you think Fusion will change -1.01 into?" my answer would have been "-1, of course!. I think almost any regular person's answer would have been that. It's probably only the programming wizzes or computer science experts that might have predicted the correct answer of -2.

Now, your answer might have been "-2", because you remember zentaco saying that Fusion floors everything a year ago and you have a good memory. But if you had never seen that video, and had to rely only on your regular person's intuition, what would you have answered? I'd be surprised if it was anything but "-1".

10. I don't really know Vol. I can only comment on what i think myself really. My own thoughts are based on how i learn about this stuff. So far its a mix of tutorials and searching the net. Like i said i hated math so did not take much interest. That comment is more about my own lack of understanding than any one else. scientific calculators came in while i was stil at school and we were allowed to use them in exams. It did not help me as i had no interest in what sine min float and a whole bunch of other things meant. If i was asked any thing about this before i would of just said i don't know. Thanks to Taco i see something work and just excepted it to be what it is.It made sense only because it worked. Never challenged it or thought oh that should work another way. Id be the same with things like strings, delimiters alt values, flags and many other things ive never heard of before i started using fusion. Im just trying to get involved in the discussion and add what i think might be useful to some people that might think like me or not. I cant really define a regular person. To me any person can be any thing if they choose and have the drive to be it. Regular is a word i use to describe a size of coffee between small and large lol. ill keep reading and trying to learn and i really appreciate all the time you and many others put in here.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•