top | item 28363356

(no title)

extremelearning | 4 years ago

You are right. In mathematics, the traditional notation {x} represents the fractional part of x.

Regarding the two-variable function mod(x,b). Typically this is written as x (mod b) in maths, and as x%b in computing.

It is generally well known that for positive integers x and b, the output of this function is the remainder when x is divided by b.

However, what is less well-known is that if b=1, then the convention is that:

x (mod 1) = x%1 = fractional part of x.

For example, Python, Excel both implement this special convention.

discuss

order

No comments yet.