The current method repeatedly divides (for large numbers) or multiplies (for 
small numbers) by 10 until the float is in the range [1,10). f/ is slow, which 
makes it slow to print large numbers. f* is faster because I saw a way to do 
the math with integers using m* -- I didn't see a similar good way to do this 
with division (partly since it's not left-distributive over addition -- 
a/(b+c) != a/b + a/c, which does hold for multiplication).

That's the short reason for way the small numbers print out faster than the 
large numbers.

I've got an idea or two to speed up fs. (e.g. can replace repeated division by 
repeated multiplication and one division), but f/ is what really needs 
optimization. I'm probably going to hold off on any of that until I get input 
working.

-Leon

>Saturday 04 September 2010
>From: "pito" <p...@volna.cz>
>Subject: Re: [Amforth-devel] printing floats
> Nooop, fs. still slow, even with fconstants:
> > measure
> 
> 3.1415851E-15
> 545 ms ok
> 
> > measure
> 
> 3.1415915E15
> 1646 ms ok
> 
> > measure
> 
> -3.1415915E15
> 1646 ms ok
> 
> > measure
> 
> -3.1415851E-15
> 545 ms ok
> 
> P.

------------------------------------------------------------------------------
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