Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> No, all finite continued fractions express a rational number

Any real number x has an infinite continued fraction representation. By efficient I mean that the information of the continued fraction coefficients is an efficient way to compute rational upper and lower bounds that approximate x well (they are the best rational approximations to x).

> They are occasionally convenient for certain problem structures but, as I'm sure you've already discovered, somewhat less convenient for a wide range of common problems.

I'm curious what you mean exactly. I've found them to be very convenient for evaluating arithmetic expressions (involving both rational and irrational numbers) to fairly high accuracy. They are not the most efficient solution for this, but their simplicity and not having to do error analysis is far better than any other purely numerical system.

> fundamentally equivalent to simple fractions.

This feels like it is a bit too reductionist. I can come up with a lot of example, but it's quite hard to find the best rational approximations of a number with just fractions, while it's trivial with continued fractions. Likewise, a number like the golden ratio, e, or any algebraic number has a simple description in terms of continued fractions, while this is certainly not the case for normal fractions.

That continued fractions can be easily converted to normal fractions and vice versa, is a strength of continued fractions, not a weakness.



Fractions do pose a non-trivial issue when they have to be converted to decimal representations. So that is indeed a weakness, although not a direct one. (You can argue the same for big decimals with a binary mantissa, for example.)


As to my understanding continued fractions can represent any number to as many decimal points as you need. So if you need π you can just calculate 2 decimal points and write 3.14 if you want to calculate π*10^9 you can calculate i.e. 11 digits and write 3141592653.58 I think this is what OP means and I am not sure why you do not agree.


But here continued fractions are used to progressively generate approximations to the true real number. So you have no control over denominator and as you mentioned repeated division is necessary for most numbers. In comparison, digit generation approach can be tailored to the output radix (typically 10). Division still does likely happen, but only in the approximation routine itself and thus can be made more efficient.


I agree though the article is about calculator app and user typically won't care if this is 10ns or 100ms to gen an output - it would look like an instant response anyway.




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

Search: