Anonymous user
Pathological floating point problems: Difference between revisions
Pathological floating point problems (view source)
Revision as of 03:27, 18 September 2018
, 5 years ago→The Chaotic Bank Society: increased decimal digits, included more information in the output section, added more wording to the REXX section header..
(Adding Fōrmulæ) |
m (→The Chaotic Bank Society: increased decimal digits, included more information in the output section, added more wording to the REXX section header..) |
||
Line 2,238:
===The Chaotic Bank Society===
To be truly accurate, the number of decimal digits for <big> ''' ''e'' ''' </big>
<br>
However, it makes a difference computing the balance (with 341 decimal digits) after '''183''' years (when at
<br>
With 150 decimal digits, the balance becomes negative after '''96''' years.
<lang rexx>/*REXX pgm (pathological FP problem): the chaotic bank society offering a new investment*/
e=2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713,
||8217852516642742746639193200305992181741359662904357290033429526059563073813232862794,
||3490763233829880753195251019011573834187930702154089149934884167509244761460668082264,
||8001684774118537423454424371075390777449920695517027618386062613313845830007520449338
d = length(e) - 1 /*subtract unity for the decimal point.*/
parse arg digs show y . /*obtain optional arguments from the CL*/
if digs=='' | digs=="," then digs=
if show=='' | show=="," then show= 20 /* " " " " " " */
if y=='' | y=="," then y= 25 /* " " " " " " */
numeric digits digs /*have REXX use "digs" decimal digits. */
$=
▲$=$ - 1 /*and subtract one 'cause that's that. */ /* [↑] 150 decimal digits of e */
/* [↑] value of newly opened account. */
do n=1 for y /*compute the value of the account/year*/
$= $*n -
end /*n*/
@
say @
<pre>
</pre>
|