I am writing a code in C which analyzes the constant factor of time complexity of all sorting techniques. I am including a statistical study of those constants. To do that I had to find the ratio of two positive double numbers. Surprisingly I am getting a negative result. Could anybody help me understand what I am missing here?
I started digging in wiki https://en.wikipedia.org/wiki/C_data_types and this https://www.geeksforgeeks.org/data-types-in-c/, but that does not seem to have the answer I am looking for.
#include <stdio.h>
int main(void) {
// your code goes here
int i=1500;
double j=9265.49;
double result=(double)j/((double)(i*i*i*i));
printf("%lf",result);
return 0;
}
The result is -0.000007 which is clearly wrong.