01-07-2020, 04:52 PM
All TI calculators allow to omit RETURN at the end of a program executed as a subroutine, this RETURN is implied automatically at the eng of that program. I type this code:
It's a simple Simpson's integration algorithm ported directly from a Citizen SRP-320. I take a=-1.96, b=1.96, m=2^9 or 2^11. And now the strangeness begins...
If I omit RETURN at the end, the calculation takes MORE time than with explicit RETURN. The difference is (at m=2^11) 13..15 seconds on a TI-86, 4 seconds on a TI-83, approx. 1 second on a TI-73 Explorer. The difference is very small, but it can be reliably measured and reproduced. Why does it happen?
PS, do other calculators (e. g. HP) have the possibility to omit RETURN? And does it affect the calculation time?
Code:
PROGRAM:INTEGRAL
Prompt A:Prompt B
Prompt N:2^N->M
A->G:prgmFN:P->I
(B-A)/(2*M)->D
M->O
Lbl Z
G+D->G:prgmFN:I+P*4->I
G+D->G:prgmFN:I+P*2->I
DS<(O,1)
Goto Z
B->G:prgmFN:I-P->I
I*D/3->I
Pause I
Stop
PROGRAM:FN
1/sqrt(2*pi)*e^(-G^2/2)->P
Return
If I omit RETURN at the end, the calculation takes MORE time than with explicit RETURN. The difference is (at m=2^11) 13..15 seconds on a TI-86, 4 seconds on a TI-83, approx. 1 second on a TI-73 Explorer. The difference is very small, but it can be reliably measured and reproduced. Why does it happen?
PS, do other calculators (e. g. HP) have the possibility to omit RETURN? And does it affect the calculation time?