470,815 Members | 1,125 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

using mod(%) operand on double data

Hi all,

While I try to find the modulus on double data , Compiler throws
following error

"Test.cpp(180): error C2296: '%' : illegal, left operand has type
'double' "

Any work around to over come this compiler error .

Regards,
Sri

May 22 '06 #1
2 1963
du**********@gmail.com wrote:
Hi all,

While I try to find the modulus on double data , Compiler throws
following error

"Test.cpp(180): error C2296: '%' : illegal, left operand has type
'double' "

Any work around to over come this compiler error .


The mod operator makes no sense when operating on type double, since there's
no remainder. What is it you're trying to accomplish?

-cd
May 22 '06 #2
chl
You might want to use fmod (from <math.h>)

<du**********@gmail.com> wrote in message news:11**********************@38g2000cwa.googlegro ups.com...
Hi all,

While I try to find the modulus on double data , Compiler throws
following error

"Test.cpp(180): error C2296: '%' : illegal, left operand has type
'double' "

Any work around to over come this compiler error .

Regards,
Sri

May 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Mike Reid | last post: by
4 posts views Thread by Diogo Alves - Software Developer | last post: by
3 posts views Thread by Michael C# | last post: by
13 posts views Thread by Kantha | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.