GigaCoders

Learn. Share. Code

Full width home advertisement

CPP Basics Live Series

Using the Qt Creator

Post Page Advertisement [Top]

If you have tried to find the modulo of two double/float types, you will run into an error. Click here to read about this error on stack overflow. Essentially, the % operator is used for finding the modulo of two integers. You need to use the fmod() function if you need to find the modulo of two double/float types.

Error trying to find the modulo of two doubles using the % operator


To find the modulo of two doubles, import the "math.h" standard library and use the following syntax to find the modulo: fmod(number1, number2).

Modulo of two double types. Float types can work as well.


References:


Thank you for reading and I hope this helps.

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib