472,989 Members | 3,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 software developers and data experts.

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 2092
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mike Reid | last post by:
Appreciate any feedback on the MOD function. I am at a loss to understand its "mathmatics". From the help Result = Number1 MOD Number2 where the result should be the remainder of the...
20
by: Hanzac Chen | last post by:
Hi, I don't understand why this could happen? The Code 1 will output `fff9' and the Code 2 will output `1' How could the `mod 8' not have effect? /* Code 1 */ #include <stdio.h> #include...
4
by: Diogo Alves - Software Developer | last post by:
I have the following code line: dsEmps.Tables.Columns.Expression = "MonthlyDeviation%60"; but hits gives an error it says that can't MOD from System.Double to System.Int32 I tried to put the...
3
by: Michael C# | last post by:
A statement of the form (m mod n) uses the sign of the first operand (m) as the sign of the result. I've ecnountered an issue where I need it to use the sign of the second operand. Here's what it...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
6
by: BlueTrin | last post by:
Hello I was adapting a C version of SolvOpt in C++ to use it within a virtual class. However I am stuck with the overriding of evaluation and gradiant functions. cStepCurveEvaluator.cpp...
13
by: Kantha | last post by:
Hi all, I have declared an Union as follows typedef union { struct interrupt_bits { unsigned char c_int_hs_fs_status : 1, c_setup_intflag : 1,
2
by: hakimks | last post by:
You are provided with a sample C programs: calc.c, which implements a reverse polish notation calculator. Study it carefully. This program uses a stack (of course!) but the stack implementation is...
7
by: somenath | last post by:
Hi All, I am trying to undestand "Type Conversions" from K&R book.I am not able to understand the bellow mentioned text "Conversion rules are more complicated when unsigned operands are...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.