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

Personally I like Universal CORDIC, you can calculate much more than Cosine, but it tends to be slower. See https://en.wikibooks.org/wiki/Digital_Circuits/CORDIC#The_Un... and a somewhat janky fixed point library that implements it https://github.com/howerj/q



The CORDIC algorithm is great! Just a few months ago, I implemented a sine generator with it and also used fixed point arithmetic. It is a real eye opener to see that you can substitute multiplications by bit shifting when you store the numbers in the “right“ format.


CORDIC is what many digital calculators use (along with decimal floating point).


> along with decimal floating point

Source? I'd find this a bit strange because:

1. I suspect decimal floating point is quite expensive to implement computationally.

2. Not an expert, but I think the floating-point algorithms and proofs for bases other than 2 are less well researched and less well known.

3. A calculator is a resource-constrained device.

4. Are there even any real benefits? Yes, some human-friendly numbers have an exact finite representation that is missing in base-2, but I can't see why would that matter, compared to just using 32-bit or 64-bit IEEE-754.


The TI-83 series of calculators not only uses decimal floating-point, but the format is documented:

http://merthsoft.com/linkguide/ti83+/vars.html

In practice, the cost is not that much different because four-function calculators do not do many calculations at once. Even in a graphing calculator, drawing a plot is never slow enough to make the device useless.


One of the more memorable examples: https://news.ycombinator.com/item?id=28559442

Decimal, and particularly BCD floating point, is much simpler than binary for a calculator since the numbers don't need any additional conversion steps to display.

And the fact that 0.1 + 0.1 works as expected is indeed a huge benefit.


Decimal floating point is pretty easy to impliment in hardware.


You may be confusing floating-point with fixed-point?

Hardware with decimal floating-point only appeared in 2007, and still doesn't seem to be easily available:

https://en.wikipedia.org/wiki/Decimal_floating_point

https://en.wikipedia.org/wiki/POWER6


I expect that's because the cost versus effort for having two kinds of floating point isn't very good. Not because decimal floating point is notably more expensive than binary floating point.




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

Search: