By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,144 Members | 872 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,144 IT Pros & Developers. It's quick & easy.

using mod(%) operand on double data

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.