Round a decimal value to fraction using Farey series
|
12-11-2013, 08:44 PM
(This post was last modified: 12-13-2013 06:10 AM by patrice.)
Post: #1
|
|||
|
|||
Round a decimal value to fraction using Farey series
Round Vl to best fraction with denominator smaller than DMax
Code: EXPORT FareyMax(Vl, DMax) Round Vl to best fraction with Vl-Error < Fraction < Vl+Error Code: EXPORT FareyDelta(Vl, Error) Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein |
|||
12-13-2013, 04:18 AM
Post: #2
|
|||
|
|||
RE: Round a decimal value to fraction using Farey series
FYI: The INT (integer-part) function no longer exists in the current firmware. You must replace INT with IP for the above programs to work.
<0|ɸ|0> -Joe- |
|||
12-13-2013, 06:13 AM
(This post was last modified: 12-13-2013 06:24 AM by patrice.)
Post: #3
|
|||
|
|||
RE: Round a decimal value to fraction using Farey series
Ooops, forgot to recheck before posting.
Done. Note the simplified RETURN Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein |
|||
12-21-2013, 09:04 PM
Post: #4
|
|||
|
|||
RE: Round a decimal value to fraction using Farey series
Here is an update.
The program is made for Home but should work in CAS It list all successives fractions in terminal as they get better Exemple: FareyMax(π;10000) Code: EXPORT FareyMax(Vl, DMax) Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein |
|||
06-07-2014, 02:21 AM
(This post was last modified: 06-17-2014 12:44 AM by patrice.)
Post: #5
|
|||
|
|||
RE: Round a decimal value to fraction using Farey series
Update for Rev 6030
Code: #pragma mode( separator(.,;) integer(h64) ) Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein |
|||
06-14-2014, 07:01 PM
Post: #6
|
|||
|
|||
RE: Round a decimal value to fraction using Farey series
This is great, Patrice!
|
|||
06-17-2014, 12:45 AM
Post: #7
|
|||
|
|||
RE: Round a decimal value to fraction using Farey series
Corrected a typo in my last message (in function FareyDelta)
Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)