Hacker News new | past | comments | ask | show | jobs | submit login

It depends on the application. In this case a lookup table would consume quite a bit more program memory (there isn't any spare), and the division routine is needed for other tasks, so it makes sense to use it for that conversion too. Speed is not an issue.



I just calculated, there are 1800 possible Celsius values. in this application. That would be quite some lookup table.


You can very likely compress the table and/or interpolate between entries. It's not like that those entries are totally random.


You can actually do that as well with the division itself. But you need a kind of fancy interpolation, I forget the name, used for rational functions. Polynomials won't do.

Edit: I think this is either Restrictive Pade's approximation or barycentric rational interpolation. Or both combined.

Normally instead division is approximated with Newton-Raphson iteration. I think 6 steps is enough for 16 bit.


It's a simple linear function, and the delta Y has enough digits to overcome significant rounding error in comparison to measurement error.

In this application no rounding is needed either since the difference between rounding and truncation is also not significant.

You don't need the computer to do any of your multiplication or store any table.

You can start from a sufficiently low reference point, then add delta Y as you increment X.

Xref + deltaX = Yref + deltaY




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: