Talk:Convert decimal number to rational: Difference between revisions

→‎inaccuracies: added new section header. -- ~~~~
(→‎Decimal?: added comments about system registers and precision. -- ~~~~)
(→‎inaccuracies: added new section header. -- ~~~~)
Line 45:
:J uses an epsilon which is scaled by the value with the largest magnitude when checking for equality . The idea is that floating point numbers that are meant to be equal are usually quite close. In other words, when the difference between the two floating point values is less than (in the default case) 2<sup>-44</sup> times the larger magnitude value they are "equal". This does not always do the right thing (floating point subtraction can get awful), and can be turned off when the programmer is prepared to deal with proper numerical analysis, but it's usually the right thing to do when using an algorithm that cares about equality in the context of floating point numbers. --[[User:Rdm|Rdm]] 20:30, 14 June 2011 (UTC)
:: I see. 2<sup>-44</sup> epsilon makes it sound like J's doulbe is the typical 8 byte IEEE float, so if J were just taking the bits out of the float, the denominator would be a power of 2 or power of 10. It probably did something similar to the continued fraction, but with a rather large denominator limit. For the record, for .518518 my perl code also gives goofy numbers like 30117673588/58084142861 from 10<sup>11</sup> on, so it's just a matter of different rounding then. --[[User:Ledrug|Ledrug]] 21:15, 14 June 2011 (UTC)
 
==inaccuracies==
 
The first two examples (and fifth) aren't correctly presented. The left side doesn't (exactly) equal the right side --- close ... but no cigar. Unless, however, the equal sign is replaced with an approximately equal ('''≈''') or similar symbol, or the right side number is represented/indicated with some sort of a repeating fraction symbol(s), or an appended plus sign (or somesuch symbol) is used, or some statement to the effect, ''n/m = .dddddd'' to '''x''' places. Could it be assumed that the task is asking the program examples to use approximation methods? Then, what precision could/would be used? When using high precision arithmetic, crossing that "line" is really a far, far way down the pike. I was referring the '''high''' precision. -- [[User:Gerard Schildberger|Gerard Schildberger]] 20:07, 13 August 2012 (UTC)