Approximation mode Message #1 Posted by Karl-Ludwig Butte on 10 Feb 2002, 10:00 a.m.
Hello,
I'm absolutely puzzled with the following. I wrote program TST as follows:
« -> SB Z M
« SB DUP 30. * 100.
/ 360. Z / /
»
»
It gets 3 values from the stack, does the calculation and leaves the result on the stack and because I switched the approximation mode always on (the same is true vor the RPN mode), the result is e.g. 0.25. OK.
Then I wrote program Z as follows:
« "program Z"
{
{ "S " "" 0. }
{ "Z " "" 0. }
{ "A " "" 0. }
}
{ } DUP DUP
INFORM
DROP -> TAB
« 'TAB' 1. GET
'TAB' 2. GET
'TAB' 3. GET
-> S Z M
'0.' -> I
'0.' -> K
« K S + 30. * 100. / 360. Z / /
»
»
»
Program Z is nearly identical to program TST except that it displays the result in the exact mode, e.g.:
S*30.000
--------
100.000
360.000
-------
Z
I mean, the main difference of the 2 programs is only the way I'm providing the parameters: For TST I'm putting them on the stack and for Z I'm using an INFORM-statement. Does this statement has anything to do with that or what am I doing wrong ? Any hint will be very much appreciated. Thank you.
|