# Can we use modulus operator with floating point number?

Page Contents

## Can we use modulus operator with floating point number?

Yes, %(modulo) operator isn’t work with floats and double.. if you want to do the modulo operation on large number you can check long long int(64bits) might this help you.

## Can remainder be obtained in floating point?

Remainder cannot be obtain in floating point division. Explanation: fmod(x,y) – Calculates x modulo y, the remainder of x/y.

## Can you use modulus on floats?

The modulus is basically finding the remainder. For this, we can use the remainder() function in C. The remainder() function is used to compute the floating point remainder of numerator/denominator.

## Which operator can’t be used with float operands?

% operator
% operator cannot be used with floating point numbers in C & C++. What about Java and C#? This behavior is different in Java & C#. % operator can be used on floating point numbers in these languages.

## Can modulus operator be used with float in Java?

As we learn in first paragraph, in Java modulus, operator can also be applied to floating-point numbers e.g. 3.0%1.0 is perfectly legal in Java. Since it return remainder value in division operation it is also known as remainder operator.

## What is the remainder of 74 divided by 7?

The quotient (integer division) of 74/7 equals 10; the remainder (“left over”) is 4.

## Can you use modulus with floats C++?

fmod() : This function is used to return the remainder(modulus) of 2 floating point numbers mentioned in its arguments. The quotient computed is truncated. 2. remainder() : This function is also used to return the remainder(modulus) of 2 floating point numbers mentioned in its arguments.

## Which of the following operators Cannot be used on a float or double type?

16 : Bitwise Operators (i) Bitwise operators cannot be applied to float or double. They can be applied to integers only.

## What happens when we use float operands in modulo operator?

In result of modulo operation we get value as answer is remainder. If we use float operands we will get floating point value as quotient and the remainder will be zero, which will not generate right answer. So if we use float operands in modulo operator, we always get answer 0.

## What is the purpose of the modulus operator?

The modulus operator – or more precisely, the modulo operation – is a way to determine the remainder of a division operation. Instead of returning the result of the division, the modulo operation returns the whole number remainder.

## When to use modulus of two float or double numbers?

The modules operator works with integer values i.e. modulus operator is used to find the remainder of two integer numbers. If the numbers are float or double the the modulus operators doesn’t work.

## Why is modulus operator not used with float type values in C + +?

And, that’s why at the time of C99 version another function is given by makers for modulus operation with floating type values i.e. fmod () which is used in C & C++ when float or real type values are used for modulus operations.