The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
wp34s - FIB problem (DBLON)
11-22-2018, 07:59 PM
Post: #1
wp34s - FIB problem (DBLON)
That's a minor problem, actually. In double precision mode FIB returns a near-integer for most arguments. For example:

     10 FIB --> 54.99999999999999999999999999999995

A simple workaround is

10 FIB CEIL --> 55

I found it when computing the Reciprocal Fibonacci constant on the wp34s:

0001 **LBL A
0002 RCL X
0003 # 002
0004 MOD
0005 STO+ X
0006 DEC X
0007 # 000
0008 ENTER[^]
0009 STOS 00
0010 R[^]
0011 FIB
0012 RCL L
0013 INC X
0014 FIB
0015 RCL 03
0016 STO+ X
0017 INC X
0018 FIB
0019 RCL L
0020 INC X
0021 FIB
0022 RCL- 02
0023 STOS 04
0024 **LBL 000
0025 RCL 07
0026 1/x
0027 STO+ 00
0028 RCL L
0029 STO- 06
0030 x[<->] 06
0031 STO 07
0032 RCL L
0033 x[^2]
0034 RCL[times] 02
0035 RCL 05
0036 RCL+ 01
0037 STO/ Y
0038 y[<->] 01
0039 RCL L
0040 STO- 04
0041 x[<->] 04
0042 STO 05
0043 DSE 03
0044 GTO 000
0045 RCL+ 01
0046 1/x
0047 RCL+ 00
0048 END

In theory 9 iterations would have sufficed for correct 34 significant digits, but the last three digits went wrong:

9 A --> 3.359885666243177553172011302918861

After CEILing and a few necessary changes, the program gets all of them right:

        3.359885666243177553172011302918927
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
wp34s - FIB problem (DBLON) - Gerson W. Barbosa - 11-22-2018 07:59 PM
RE: wp34s - FIB problem (DBLON) - ijabbott - 11-23-2018, 08:08 AM



User(s) browsing this thread: 1 Guest(s)