Re: [go-nuts] float accuracy when calculating Fibonacci numbers

2018-05-06 Thread Yuval Lifshitz
seems like math accuracy issues are known, or even, by design. see: https://github.com/golang/go/issues/9546 https://github.com/golang/go/issues/9545 On Sunday, 6 May 2018 00:05:13 UTC+3, Paul Hankin wrote: > > On Friday, 27 April 2018 23:57:42 UTC+2, Michael Jones wrote: >> >> Yuval, >> >> There

Re: [go-nuts] float accuracy when calculating Fibonacci numbers

2018-04-29 Thread Yuval Lifshitz
n (and more quickly) generate values up to > F(92), which is the greatest Fibonacci value (7540113804746346429) > representable as a 64-bit unsigned integer. > > For completeness, there is also the Ceiling function: > ceil(e) => 3 > ceil(pi) => 4 > > hope this helps.

Re: [go-nuts] float accuracy when calculating Fibonacci numbers

2018-04-29 Thread Yuval Lifshitz
ay > too long on these things (and I am not a fan of floats anyway, give me some > fixed precision pls). > > On Sunday, 29 April 2018 10:08:15 UTC+3, Yuval Lifshitz wrote: >> >> (1) I understand the issue of limited precision, this is why I did not >> try anything

Re: [go-nuts] float accuracy when calculating Fibonacci numbers

2018-04-29 Thread Yuval Lifshitz
t; > On Sun, Apr 29, 2018 at 12:08 AM Yuval Lifshitz > wrote: > >> (1) I understand the issue of limited precision, this is why I did not >> try anything above F(59) But my concern was not the difference between >> algebra and the go implementation it was the differe

Re: [go-nuts] float accuracy when calculating Fibonacci numbers

2018-04-29 Thread Yuval Lifshitz
s://www.google.com/url?q=https%3A%2F%2Fir.library.oregonstate.edu%2Fdownloads%2Ft435gg51w&sa=D&sntz=1&usg=AFQjCNFeFx9ebd-m_yzIjw4H29wdLpzmVw> > > > On Thu, Apr 26, 2018 at 10:22 AM, Ian Lance Taylor > wrote: > >> On Thu, Apr 26, 2018 at 1:17 AM, Yuval Lifshitz &g

[go-nuts] float accuracy when calculating Fibonacci numbers

2018-04-26 Thread Yuval Lifshitz
Dear community, I ran into the following issue when started playing with go. Had the following small program to calculate Fibonacci numbers using the closed form: package "fib" import "math" var sqrt_5 = math.Sqrt(5.0) var psi = -1.0/math.Phi // had to add this to solve accuracy issue func ro