08-15-2015, 04:35 PM
Below are two programmes to find the number of prime integers up to the input limit.
The programme using long reals requires less time than the one with reals.
Why?
The programme using long reals requires less time than the one with reals.
Why?
Code:
::
CK1&Dispatch
BINT1
::
DUP
%LN
DUPUNROT
%/
DUPUNROT
OVER
%IP
%3
%-
COERCE
ONE_DO
INDEX@
UNCOERCE
%*
OVER
%/
ROTOVER
%+
3UNROLL
LOOP
2DROP
;
;
::
CK1&Dispatch
BINT1
::
%>%%
DUP
%%LN
DUPUNROT
%%/
DUPUNROT
OVER
%%INT
%%3
%%-
%%>%
COERCE
ONE_DO
INDEX@
UNCOERCE%%
%%*
OVER
%%/
ROTOVER
%%+
3UNROLL
LOOP
2DROP
%%>%
;
;