From Test-Scratch-Wiki

Translate: - English 

Fractions are any numbers that are not whole. For example, 0.5 is a fraction. -1.4 and 5.67 are also fractions. These numbers can also be called decimal numbers or floating point numbers.

Glitches with Fractions

Displaying Fractions on Screen

In Scratch, if you have a variable or an operation that can return a floating point number, and you try to go to that point, it can cause problems since you can not have a fraction of a pixel on screen. Scratch normally treats this for you, when going to a position, but with certain decimal numbers, pen does not show up there. This can be a problem for many projects, but is easily fixable. Instead of using something like this:

go to x: ((1)+(0.5)) y: ((1)+(0.5))


go to x: (round((1)+(0.5))) y: (round((1)+(0.5)))

Floating Point Calculations

There is also a big glitch with math problems using floating point numbers in general. For example, entering ceiling(5.0) will return 6.[1] Other errors will happen when changing a variable by -0.1. If you want to do this until the variable equals 0, the loop will never stop. This is because computers use binary (1s and 0s). And, 0.1 can not be represented exactly in binary because it is infinite in binary.

More, less obvious glitches are when Scratch gets a floating point calculation wrong because of low accuracy with them.

Scratch's functions returning floating point numbers

Some of Scratch's functions will return fractions. For example, the () of () blocks will almost always return a fraction.