I can't belive what's happen in my program
double den = 180*3600*10000 ;
in debugging a got this value -2109934592.0000000
any help please ???
you can try this simple code
#include<stdio.h>
#include<math.h>
int main ( int argc , char *argv )
{
double denominator = 10000*180*3600 ;
printf("%f \n", denominator ) ;
return 0 ;
}
Is the error when I compile. Your overflowing ints and casting to a double.
Fixes the issue
With the full code in the question we can now see it's an integer overflow.
This is greater than 2,147,483,648 which is the max value of a 32-bit signed int. The results of the multiplication overflows to -2,109,934,592 and is then converted to double.
To get the right result make one of the numbers a double before you do the multiplication: