[Tutor] Hi there, have a question for a side project in physics.....

Steven D'Aprano steve at pearwood.info
Mon Dec 25 07:58:15 EST 2017


On Mon, Dec 25, 2017 at 09:45:35AM +0000, Alan Gauld via Tutor wrote:
> On 25/12/17 09:08, Siddharth Sehgal wrote:
> 
> >....physics masters student. I am trying to use the Sellmeier Equation
> 
> >I originally state them as floats. However such a process apparently  > 
> >cannot be done with "floats" like these.
> 
> It can be done just with a large error (although as a physics
> grad you will know how to calculate the error I assume)

I don't think the numbers or equation is so ill-conditioned that the 
error will be "large", or at least not larger than the experimental 
uncertainty in the coefficients.

Floating point maths is tricky, but it isn't *that* tricky. Especially 
not for "reasonable" sized numbers, with only nine or ten significant 
figures. This is the huge advantage of IEEE-754 maths using 64-bit 
floats, as Python does: most of the time, the obvious formula "just 
works".



-- 
Steve


More information about the Tutor mailing list