Pathological floating point problems: Difference between revisions

Content deleted Content added
m added whitespace before the TOC, added a ;Task and ;See also (bold) headers.
m →‎{{header|REXX}}: added some comments in the REXX section header, fixed a type, re-shown the output for the 1st problem.
Line 231:
 
=={{header|REXX}}==
The REXX language uses character-based arithmetic. &nbsp; So effectively, it looks, feels, and tastes like <u>decimal</u> floating point <br>(implemented in software).
 
So, the only (minor) problem is how many decimal digits should be used to solve these pathological floating point problems.
===A sequence that seems to converge to a wrong limit===
<lang rexx>/*REXX pgm (pathological FP problem): a sequence that seems to converge to a wrong limit*/
parse arg digs show . /*obtain optional arguments from the CL*/
if digs=='' | digs=="," then digs=150 /*Not specified? Then use the default.*/
if show=='' | show=="," then show= 2920 /* " " " " " " */
numeric digits digs /*have REXX use "digs" decimal digits. */
#= 2 4 5 6 7 8 9 20 30 50 100 /*the indices to display value of V.n */
Line 249 ⟶ 252:
'''output''' &when using the default inputs:
<pre>
v.4 = 9.3783783783783783783783783783837837837837837837838
v.5 = 7.8011527377521613832853025936680115273775216138329
v.6 = 7.1544144809752493535278906538615441448097524935353
v.7 = 6.8067847369236329839417565962780678473692363298394
v.8 = 6.5926327687044383927420027763759263276870443839274
v.9 = 6.4494659337902879688684792201544946593379028796887
v.20 = 6.0435521101892688677774773641004355211018926886778
v.30 = 6.0067860930312057585305540479500678609303120575853
v.50 = 6.0001758466271871889456140207500017584662718718895
v.100 = 6.0000000193194779291040868034000000001931947792910
</pre>