Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: Fixed-point...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 8 Topic 3983 of 4053
Post > Topic >>

Re: Fixed-point math, ANS, DPL and Win32Forth

by Albert van der Horst <albert@[EMAIL PROTECTED] > Apr 5, 2008 at 09:27 AM

In article
<b01ea954-46bb-4173-8c2b-feaf4fc19b9e@[EMAIL PROTECTED]
>,
 <m_l_g3@[EMAIL PROTECTED]
> wrote:
>Given that fixed-point math is 3 lines of code in Forth
>((
>10000 constant scale
>: x* scale */ ;
>: x/ scale swap */ ;
>))
>it is quite reasonable to have some built-in support for fixed point
>number input.
>
>Historically, there has been the variable DPL acquiring its value as a
>side efect of number conversion.
>
>For example,
>
>1000 \ single, dpl=-1
>1000. \ double, dpl=0
>10.00 \ double, dpl=2
>
>So,
>1) Why DPL is not in the standard?
>2) Why DPL is not in Win32Forth?
>3) Is there an elegant way to implement fixed-point input in ANS?
>
>I wrote fixed-point number input in ANS Forth, but it takes more lines
>of code than the whole non-ANS (DPL-based) fixed point number support.

I have still DPL in ciforth (ANS, certainly as far as this is concerned.)
After conversion ciforth makes DPL points to where the decimal
point was in the input.
So this is an ANS-compatible use of DPL, and could be added to
the standard.

I can't see why your DPL-based stuff would be non-ANS.

Note: DPL is only pleasant to use if you allow just one point and
no other special characters in input.

<SNIP>

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert@[EMAIL PROTECTED]
 &=n http://home.hccnet.nl/a.w.m.van.der.horst




 8 Posts in Topic:
Fixed-point math, ANS, DPL and Win32Forth
m_l_g3@[EMAIL PROTECTED]   2008-04-02 00:17:49 
Re: Fixed-point math, ANS, DPL and Win32Forth
Brad Eckert <nospaambr  2008-04-02 06:00:36 
Re: Fixed-point math, ANS, DPL and Win32Forth
Alex McDonald <blog@[E  2008-04-02 14:44:25 
Re: Fixed-point math, ANS, DPL and Win32Forth
George Hubert <georgea  2008-04-02 16:16:22 
Re: Fixed-point math, ANS, DPL and Win32Forth
m_l_g3 <m_l_g3@[EMAIL   2008-04-04 10:45:33 
Re: Fixed-point math, ANS, DPL and Win32Forth
Coos Haak <chforth@[EM  2008-04-04 20:06:46 
Re: Fixed-point math, ANS, DPL and Win32Forth
"Ed" <nospam  2008-04-05 11:43:43 
Re: Fixed-point math, ANS, DPL and Win32Forth
Albert van der Horst <  2008-04-05 09:27:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 0:47:33 CDT 2008.