Forum Discussion
1 Reply
Sort By
- _anomDiebolt_Qrew EliteSee this:
Number To Fraction ~ Add New Record
https://haversineconsulting.quickbase.com/db/bm6bhiqar?a=nwr
Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=607
Text Formula with some HTML allowed:"<img src onerror='this.outerHTML=( function(x) { var tolerance = 1.0E-6; var h1=1; var h2=0; var k1=0; var k2=1; var b = x; do { var a = Math.floor(b); var aux = h1; h1 = a*h1+h2; h2 = aux; aux = k1; k1 = a*k1+k2; k2 = aux; b = 1/(b-a); } while (Math.abs(x-h1/k1) > x*tolerance); return h1+"/"+k1; } )(" & [Number] & ")'>"
Notes:
(1) Continued Fraction expansion algorithm:
http://jonisalonen.com/2012/converting-decimal-numbers-to-ratios/
(2) In the formula you could easily convert the "/" to ":" to produce a ratio.
(3) This solution uses the OEH Technique - the On Error HTML Technique named of course after the "Ooo - eeeee - hoo!" chant sung by the Winkie Guards in the Wizard of Oz (that is what they are singing - it is in the script if you don't believe me):
https://community.quickbase.com/quickbase/topics/are-there-any-new-pre-service-worker-disruptive-tec...