473,327 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Getting a divide by 0 error when using a modulus with a number below 1.

I am trying to get a remainder of a number with a = 0.9144, rm = ry % a; however, I keep getting a divide by zero error (I believe due to the program rounding 0.9144 down to the integer 0). Is there anyway to fix this?
Jan 31 '13 #1

✓ answered by whodgson

I think % (mod) is only used with integers.I think you need to use:
Expand|Select|Wrap|Line Numbers
  1. fmod(). e.g. cout<<fmod(7.6,2.5)<<endl;//prints 0.1 

2 1315
whodgson
542 512MB
I think % (mod) is only used with integers.I think you need to use:
Expand|Select|Wrap|Line Numbers
  1. fmod(). e.g. cout<<fmod(7.6,2.5)<<endl;//prints 0.1 
Jan 31 '13 #2
Thanks! I think I got it now.
Jan 31 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dermot O'Loughlin | last post by:
Can anyone help me with this? I get the following error when using the odbc adapter wizard in VS.Net 2003: --------------------------- Wizard Form --------------------------- An unexpected...
15
by: Andy S. | last post by:
Hi, I'm running DB2 UDB v 7.2 FP 9. I'm connected to my database (testdb) successfully as user db2admin. then i tried to run the following command: get db cfg for testdb
1
by: Greg | last post by:
System.Management.ManagementException: Provider failure I am getting this error when trying to get information on an external CD Rom Drive using WMI class Win32_CDROMDrive. Any ideas? The...
0
by: Charlie | last post by:
Hi: I get a TreeNode binding error when using Data property of XmlDataSource control. When I switch to TextFile property and point to xml file on hard drive, problem goes anyway. I'm...
5
by: Bob Cox | last post by:
I am getting the error: Invalid number : color fuchsia is not a color value : fuchsia from the W3C CSS validator, yet I am sure the same CSS validated ok previously. The offending CSS is: ...
4
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Why am I getting an error when I passed by ref a dataset to a new form? The message reads "cannot convert from 'ref Paimport.unixAccount' to 'ref System.Data.DataSet'. Paimport is the name of the...
8
by: msnews.microsoft.com | last post by:
Our IT team relocated our application servers yesterday. They had to take one machine out of the cluster because it would prompt users for credentials if accessed using the IP address, which I...
7
by: svsenthilkumar | last post by:
Hai, I got an javascript error when using ajax in mozilla browser, anyone help me why the error is coming, meaning for this error and how can i rectify this error. Error: " nsresult:...
4
by: barrientos101 | last post by:
Hello, I am trying some code from Higher Order Perl by Mark Jason Dominus and it doesn't work. When I tried to replace the original print statements with a reference to a subroutine...
1
by: Omendra | last post by:
I am getting an error When i am going to convert my SP as dynamic Error : Msg 403, Level 16, State 1, Line 21 Invalid operator for data type. Operator equals add, type equals text. Code : ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.