Category : floating-point

For the same underlying value, will the rounding error be consistent or random when I run a program multiply time. Say, if I store value 0.003, the actual number stored in the computer is 0.002999999998. If I run the same program multiple times, will the stored number be sometimes 0.002999999998, and sometimes 0.0030000000001? Source: Windows ..

Read more

so I was trying a question from codechef contest and the question was pretty simple. The question isn’t necessary for my doubt, actually the doubt is, that when I change the data type of the variable "value" from float to double the answer remains the same but the comparison operators work differently #include<bits/stdc++.h> using namespace ..

Read more

Here is a program to find the sum of the rows. The task : Determine the maximum modulus term of the series and compare the calculation error with the grid step for it. #include <stdio.h> #include <math.h> double my_exp(double x); int main(void) { double a,x; scanf("%le",&x); a=my_exp(x); printf("%le",(double)a); return 0;} double my_exp(double x) { double ..

Read more