Member Avatar for nalasimbha
nalasimbha

Hello,

I am writing a program that integrates a function and returns the integrated value. The integration is to be performed from 0 to an upper limit which I specify. But the function I am integrating does not allow 0 to be used as the lower limit, as using 0 will result in Nan or infinity. So I am using a really small value as the lower limit. When I use a value such as 1e-8 or 1e-10 as the lower limit and integrate the function, the results are very close to each other. However when I tried to use 1e-15 as the lower limit my results were way off from the ones I got when I used 1e-10. The results I get from using 1e-10 as the lower limit are very close to the expected results.

I am using double to represent all the variables in the function. I think the different results might be due to precision. If its due to precision is there a way to overcome that, or am I missing something.

Thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.