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. 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=
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.
v.5 = 7.
v.6 = 7.
v.7 = 6.
v.8 = 6.
v.9 = 6.
v.20 = 6.
v.30 = 6.
v.50 = 6.
v.100 = 6.
</pre>
|