# Divide by zero error

• ### Question

• Hi,

I am getting an error "multiple floating point traps" with the following code

double z1,z2;

int a1;

z1 = 13.170000000000000;

z2 = 239992912253.29358;

a1 = z2 / z1;

Why do I get an error is a1 too large for an int?  THanks

Monday, June 29, 2015 4:57 PM

• I don't know what errors you are seeing but the result of z2/z1 (a bit over 18 billion) is indeed too large for an int. The maximum value of an int is ~2 billion, 2^31 - 1 to be precise.
• Proposed as answer by Tuesday, June 30, 2015 12:02 PM
• Marked as answer by Wednesday, July 8, 2015 10:42 AM
Monday, June 29, 2015 5:06 PM

### All replies

• I don't know what errors you are seeing but the result of z2/z1 (a bit over 18 billion) is indeed too large for an int. The maximum value of an int is ~2 billion, 2^31 - 1 to be precise.
• Proposed as answer by Tuesday, June 30, 2015 12:02 PM
• Marked as answer by Wednesday, July 8, 2015 10:42 AM
Monday, June 29, 2015 5:06 PM
• https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx

Range for signed int is –2,147,483,648 to 2,147,483,647

Does result from your calculation fit in this range?

• Edited by Monday, June 29, 2015 5:09 PM
Monday, June 29, 2015 5:07 PM