Leon, I did following - I put print"#" in f* and print"%" in f/:
> 987654321. d>f _1e9 f*
# ok
> fs.
%%%%%%%%%%%%%%%%%9.###8###7###6###5###3###6###4E17  ok
> 987654321. d>f _1e-9 f*
# ok
> fs.
#9.###8###7###6###5###3###2###6E-1  ok
> 987654321. d>f _1e-9 f/
% ok
> fs.
%%%%%%%%%%%%%%%%%9.###8###7###6###5###4###5###9E17  ok
> 987654321. d>f _1e-18 f/
% ok
> fs.
%%%%%%%%%%%%%%%%%%%%%%%%%%9.###8###7###6###5###5###0###7E26  ok
> 987654321. d>f _1e-18 f* _1e-12 f*
## ok
> fs.
######################9.###8###7###6###4###9###8E-22  ok
> 
ok
> 987654321. d>f _1e9 f* _1e12 f*
## ok
> fs.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%9.###8###7###6###5###3###4###5E29  ok

So when result with positive exponents E+XX the XX divisions are
made. Therefore I changed the f/ (13ms) with f*(4ms) in the
following routine:

\ if it's too large, make it smaller
begin
fdup _10 f>= \ [ 10 s>f ]
while
_.1 f*  \ _10 f/ \ [ 10 s>f ] <<<<<<<<< Here
fnswap 1+ nfswap
\  ." f>="
repeat

So now:
> 987654321. d>f _1e9 f* _1e12 f*
## ok
> fs.
#############################9.###8###7###6###5###1###2###5E29  ok
> 987654321. d>f _1e-18 f* _1e-12 f*
## ok
> fs.
######################9.###8###7###6###4###9###8E-22  ok
> 

So now the conversion with positive exponens (previous f/) i 3x
faster:
> : measure
oktimer-start _1 _pi f* _1e15 f* fs. timer-stop fs. ." sec";
ok
> measure
3.1415874:E15 4.9283066E-1 sec ok
> : measure
oktimer-start _1 _pi f* _1e-15 f* fs. timer-stop fs. ." sec";
ok
> measure
3.1415851E-15 5.4525948E-1 sec ok
> : measure
oktimer-start _-1 _pi f* _1e15 f* fs. timer-stop fs. ." sec";
ok
> measure
-3.1415874:E15 4.9283066E-1 sec ok
> : measure
oktimer-start _-1 _pi f* _1e-15 f* fs. timer-stop fs. ." sec";
ok
> measure
-3.1415851E-15 5.4525948E-1 sec ok
> 
So all fs. are now ~0.5sec.
I do not know why the colon in the number (:E15), but probably an
induced bug (:-)).
Pito




------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Amforth-devel mailing list
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to