Are the [x] and {x} functions defined for negative numbers?

315 Views Asked by At

[x] is the whole part (floor) of x
{x} is the fractional (decimal) part of x

Ex:
[5,76] = 5;     [12/13] = 0;       [e] = 2;
{9/4}=0,25;     {69/2}=0,5;        {4}=0;

Are those functions defined for negative numbers and how?

1

There are 1 best solutions below

0
On BEST ANSWER

$[x]$ is defined as the nearest integer less than $x$.

For example,

  • $[4.78] = 4$.
  • $[-4.78] = -5$.

$\{x\}$ is defined as

$$\{x\} = x - [x].$$

For example,

  • $\{4.78\} = 4.78 - [4.78] = 4.78-4 = 0.78$.
  • $\{-4.78\} = -4.78 - [-4.78] = -4.78-(-5) = 0.22$.