Fractional part

In the previous post I talked about the floor and ceiling functions. Go check them out if you haven’t already! We are going to need them to learn about the fractional part.

What is fractional part?

The fractional part of a positive number is the part after the decimal, i.e. the decimal part. We can write the fractional part of a number x as

y={x}

Here are some examples:

If you noticed, the fractional part of 2.6 is 0.6, which is 2.6-2, and the same happens for the other examples. This means that the result is the input – the integer part, and, as we saw in the previous post, the integer part of a real number is given by the floor function.

For real numbers, the fractional part can be defined as

And for the first example we have:

Another definition I figured out playing around with numbers makes use of the ceiling function.

Let’s try it out!

These two definitions can be used to know what the fractional part of a negative number is:

The result you would expect from {-4.8} is probably -0.8 or 0.8, but we’ve just seen that it is actually 0.2, which is 1-0.8. This means that we can also write the fractional part of a negative number as

Keep in mind that I am showing you these other ways to write {x} for the sake of curiosity. The only definition you must remember is the first one.

A few more examples:

What if you want to know the fractional part of a fraction? A fraction is a division after all, so just write the result and then take the fractional part of it.

And that’s all! I hope you liked this post and if something is not clear let me know in the comments!

Join 32 other subscribers.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.