Talk:Convert decimal number to rational: Difference between revisions

Content added Content deleted
(→‎inaccuracies: added new section header. -- ~~~~)
(Yes -- goes without saying in all floating point contexts)
Line 49: Line 49:


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)
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)

: Given that floating point representation can only exactly represent fractions whose denominators are powers of 2, I think that we have to assume that an approximation is demanded here (and, frankly, this should hold -- that we are dealing with approximations -- in any context where floating point is used to represent fractions [unless all denominators are explicitly declared to be powers of 2], and also where floating point is used to represent integers which are larger than the floating point mantissa [unless, of course, the mantissa times power-of-two multiplier is explicitly declared to have sufficient precision for complete accuracy]). --[[User:Rdm|Rdm]] 20:26, 13 August 2012 (UTC)