In the general case (for values of n bigger than double precision floats support), the Binet formula is slower.
The author’s proposed solution only works up to n = 78. If you want to speed up the calculation for small values, just cache them all.
The author’s proposed solution only works up to n = 78. If you want to speed up the calculation for small values, just cache them all.
Personally I don’t ever want a compiler trying to replace straight-forward integer algorithms with floating point formulas. YMMV.