The fractional part of a number a can be obtained by moda 1

The fractional part of a number a can be obtained by “mod(a, 1)”. Enter

   >> mod(1e14 + .5, 1)

   >> mod(1e15 + .5, 1)

   >> mod(1e16 + .5, 1)

Explain why the last output is different from the other two.

Solution

using MATLAB code

>>mod(1e14 + .5, 1)

Ans=0.5000

>>mod(1e15 + .5, 1)

Ans= 0.5000

>>mod(1e16+.5,1)

Ans= 0

Similarly

>>mod(1e17+ .5, 1)

Ans = 0

If we have a congruent to b (mod c) then this mean that

When a or b divided by c the remainder will be the same.

After value of Mod( 1e16+.5,1) will be zero.

The fractional part of a number a can be obtained by “mod(a, 1)”. Enter >> mod(1e14 + .5, 1) >> mod(1e15 + .5, 1) >> mod(1e16 + .5, 1) Explain

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site