Talk About Network

Google


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: BETWEEN
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 74 of 151 Topic 3827 of 4285
Post > Topic >>

Re: BETWEEN

by "Ed" <nospam@[EMAIL PROTECTED] > Mar 15, 2008 at 12:05 PM

"Coos Haak" <chforth@[EMAIL PROTECTED]
> wrote in message
news:1n6bn53j9k93u.r2aah2jez3ac.dlg@[EMAIL PROTECTED]
> Op Fri, 14 Mar 2008 13:39:47 +1100 schreef Ed:
>
> > "Anton Ertl" <anton@[EMAIL PROTECTED]
> wrote in message
news:2008Mar13.111759@[EMAIL PROTECTED]
> >> Albert van der Horst <albert@[EMAIL PROTECTED]
> writes:
> >>>In article <20080312075319.57514ec7.jethomas5@[EMAIL PROTECTED]
>,
> >>>Jonah Thomas  <jethomas5@[EMAIL PROTECTED]
> wrote:
> >>>>William James <w_a_x_man@[EMAIL PROTECTED]
> wrote:
> >>>>> "Ed" <nos...@[EMAIL PROTECTED]
> wrote:
> >>>>>
> >>>>> > Playing with the algorithm for WITHIN (A.6.2.2440) one gets:
> >>>>> >
> >>>>> > : BETWEEN  ( n1|u1 n2|u2 n3|u3 -- flag )   OVER - -ROT - U< 0= ;
> >>>>>
> >>>>> Stuff like this leads one to believe that Forth code is
> >>>>> unreadable, cryptic, unsharable, and unmaintainable.
> >>>>> It's worse than some assembly language I've seen.
> >>>>> Forth needs to become a higher-level language.
> >>>>
> >>>>What are your standards for readability?
> >>>>
> >>>>I see six commands, and I understand every one of them. No control
> >>>>structures. It doesn't get much clearer than that.
> >>
> >> It does some stack shuffling, it uses the wrap-around properties of
> >> computer arithmetic (even a collegue of mine who likes to do much
more
> >> low-level optimization than is good for the code did not know the
> >> trick used by BETWEEN and WITHIN), so there can be clearer words.  We
> >> can do something about the stack shuffling by using locals:
> >>
> >>: between { x l u -- f }
> >>   x l - u l - u<= ;
> >>
> >> I believe this to be correct.  And obviously the factoring here is at
> >> least as good as with the stack-shuffling version.
> >>
> >> Still, if for religious or practical reasons people want to avoid
> >> locals, I think the original version also becomes a little more
> >> readable by using the return stack:
> >>
> >>: between ( x l u -- f )
> >>   over - >r - r> u<= ;
> >
> > Forth should be coded for performance.  I posted the -ROT
> > version because it's likely to work out better for most users.
> > Most forths have -ROT ; it results in one item less and thus
> > hopefully faster; x86 optimizers I tried did a better job on it.
>
> I disagree, using the pair >R and R> would be faster than -ROT, some
> primitive implementations could define : ROT SWAP >R SWAP R> ;

Very amusing.

If such a forth exists then I doubt performance is high on its
priority list.

> But it would make no difference with a native compiler that makes full
use
> of registers I assume.

It depends on the compiler.  As a general rule, less operators means
better performance.  On VFX and SwiftForth the -ROT version works
out better because when they see  >R ... R> they do, in fact, use the
return stack.  DTC/ITC forths, also, benefit from the -ROT version.

As far as the algorithm is concerned both forms are identical.
If one wishes to express it in Standard words, then by all means
use  >R ... R> .

For myself, I would use the code version because primitives
should be fast.
 




 151 Posts in Topic:
BETWEEN
"Ed" <nospam  2008-03-11 10:05:05 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-10 23:27:36 
Re: BETWEEN
"Ed" <nospam  2008-03-12 10:59:55 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-12 02:02:50 
Re: BETWEEN
"Ed" <nospam  2008-03-14 12:44:03 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-14 19:55:40 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-11 23:38:22 
Re: BETWEEN
Elizabeth D Rather <er  2008-03-11 21:57:31 
Re: BETWEEN
"Ed" <nospam  2008-03-14 12:50:14 
Re: BETWEEN
Bruce McFarling <agila  2008-03-21 06:59:32 
Re: BETWEEN
Andrew Haley <andrew29  2008-03-21 15:16:33 
Re: BETWEEN
Bruce McFarling <agila  2008-03-11 20:06:28 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-12 19:29:05 
Re: BETWEEN
William James <w_a_x_m  2008-03-12 02:28:18 
Re: BETWEEN
Bruce McFarling <agila  2008-03-12 11:56:09 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-12 20:21:19 
Re: BETWEEN
Bruce McFarling <agila  2008-03-12 12:43:41 
Re: BETWEEN
Bruce McFarling <agila  2008-03-13 18:59:54 
Re: BETWEEN
Bruce McFarling <agila  2008-03-13 19:07:20 
Re: BETWEEN
"Ed" <nospam  2008-03-14 14:50:16 
Re: BETWEEN
Bruce McFarling <agila  2008-03-14 06:45:40 
Re: BETWEEN
Bruce McFarling <agila  2008-03-14 07:32:38 
Re: BETWEEN
Bruce McFarling <agila  2008-03-14 07:38:48 
Re: BETWEEN
Bruce McFarling <agila  2008-03-14 13:57:04 
Re: BETWEEN
Bruce McFarling <agila  2008-03-16 13:27:20 
Re: BETWEEN
Bruce McFarling <agila  2008-03-18 08:51:45 
Re: BETWEEN
anton@[EMAIL PROTECTED]   2008-03-18 19:49:37 
Re: BETWEEN
Bruce McFarling <agila  2008-03-20 14:16:42 
Re: BETWEEN
Bruce McFarling <agila  2008-03-20 14:20:37 
Re: BETWEEN
Andrew Haley <andrew29  2008-03-21 11:44:48 
Re: BETWEEN
Bruce McFarling <agila  2008-03-20 15:31:50 
Re: BETWEEN
William James <w_a_x_m  2008-03-12 02:41:44 
Re: BETWEEN
Bruce McFarling <agila  2008-03-12 08:47:12 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-12 12:14:00 
Re: BETWEEN
Bruce McFarling <agila  2008-03-12 11:14:39 
Re: BETWEEN
mhx@[EMAIL PROTECTED] (M  2008-03-12 19:29:03 
Re: BETWEEN
Jonah Thomas <jethomas  2008-03-12 14:57:02 
Re: BETWEEN
Brad Eckert <nospaambr  2008-03-14 08:23:24 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-14 09:33:12 
Re: BETWEEN
William James <w_a_x_m  2008-03-15 12:56:09 
Re: BETWEEN
"Ed" <nospam  2008-03-16 17:44:01 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-16 08:57:06 
Re: BETWEEN
Andrew Haley <andrew29  2008-03-17 11:02:53 
Re: BETWEEN
Elizabeth D Rather <er  2008-03-17 10:31:11 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-16 08:08:44 
Re: BETWEEN
"Ed" <nospam  2008-03-20 11:38:02 
Re: BETWEEN
Bruce McFarling <agila  2008-03-15 13:43:21 
Re: BETWEEN
Bruce McFarling <agila  2008-03-15 17:09:04 
Re: BETWEEN
Aleksej Saushev <asau@  2008-03-16 04:15:04 
Re: BETWEEN
Bruce McFarling <agila  2008-03-15 21:11:00 
Re: BETWEEN
Josh Grams <josh@[EMAI  2008-03-16 13:09:01 
Re: BETWEEN
Bernd Paysan <bernd.pa  2008-03-16 14:21:15 
Re: BETWEEN
Bruce McFarling <agila  2008-03-16 13:34:47 
Re: BETWEEN
Bruce McFarling <agila  2008-03-16 13:41:06 
Re: BETWEEN
Brad Eckert <nospaambr  2008-03-20 07:55:09 
Re: BETWEEN
"Ed" <nospam  2008-03-29 12:50:55 
Re: BETWEEN
Bruce McFarling <agila  2008-03-31 10:32:03 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-31 13:40:23 
Re: BETWEEN
Bruce McFarling <agila  2008-03-31 11:09:41 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-31 16:17:43 
Re: BETWEEN
Bruce McFarling <agila  2008-03-31 14:43:42 
Re: BETWEEN
Bruce McFarling <agila  2008-03-31 15:46:09 
Re: BETWEEN
Robert Spykerman <robe  2008-03-31 20:38:09 
Re: BETWEEN
Robert Spykerman <robe  2008-03-31 21:17:44 
Re: BETWEEN
"Ed" <nospam  2008-04-02 00:00:00 
Re: BETWEEN
Bruce McFarling <agila  2008-04-04 08:15:18 
Re: BETWEEN
Jonah Thomas <jethomas  2008-03-12 07:53:19 
Re: BETWEEN
Albert van der Horst <  2008-03-12 18:13:20 
Re: BETWEEN
anton@[EMAIL PROTECTED]   2008-03-13 10:17:59 
Re: BETWEEN
"Ed" <nospam  2008-03-14 13:39:47 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-14 20:01:22 
Re: BETWEEN
mhx@[EMAIL PROTECTED] (M  2008-03-14 20:15:44 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-14 20:22:52 
Re: BETWEEN
"Ed" <nospam  2008-03-15 12:05:20 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-15 13:29:06 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-13 12:29:14 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-13 11:17:54 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-13 13:30:49 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-13 11:45:23 
Re: BETWEEN
David Thompson <dave.t  2008-03-31 04:27:44 
Re: BETWEEN
Bruce McFarling <agila  2008-03-12 10:58:12 
Re: BETWEEN
Bruce McFarling <agila  2008-03-12 12:35:02 
Re: BETWEEN
Jonah Thomas <jethomas  2008-03-12 14:54:19 
Re: BETWEEN
William James <w_a_x_m  2008-03-13 11:24:23 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-13 12:52:26 
Re: BETWEEN
William James <w_a_x_m  2008-03-13 12:17:12 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-13 13:33:20 
Re: BETWEEN
anton@[EMAIL PROTECTED]   2008-03-13 19:51:14 
Re: BETWEEN
William James <w_a_x_m  2008-03-13 14:48:22 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-13 18:04:08 
c-version, was Re: BETWEEN
Albert van der Horst <  2008-03-14 09:09:50 
Re: BETWEEN
anton@[EMAIL PROTECTED]   2008-03-14 11:37:38 
Re: BETWEEN
William James <w_a_x_m  2008-03-13 14:58:01 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-13 18:17:33 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-13 16:48:39 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-13 19:14:32 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-13 17:31:16 
Re: BETWEEN
Albert van der Horst <  2008-03-14 09:30:54 
Re: BETWEEN
Aleksej Saushev <asau@  2008-03-15 02:07:32 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-14 19:21:08 
Re: BETWEEN
Aleksej Saushev <asau@  2008-03-15 14:33:26 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-15 11:29:17 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-15 11:00:02 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-15 13:34:31 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-15 11:48:39 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-15 14:02:32 
Re: BETWEEN
Aleksej Saushev <asau@  2008-03-15 21:27:37 
Re: BETWEEN
Aleksej Saushev <asau@  2008-03-15 20:15:10 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-15 13:48:20 
Re: BETWEEN
Albert van der Horst <  2008-03-16 13:43:28 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-16 11:38:32 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-15 17:11:08 
Re: BETWEEN
Aleksej Saushev <asau@  2008-03-16 04:07:29 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-14 23:44:25 
Re: BETWEEN
Aleksej Saushev <asau@  2008-03-15 15:05:03 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-15 17:36:43 
Re: BETWEEN
Aleksej Saushev <asau@  2008-03-16 04:12:06 
Re: BETWEEN
Jonah Thomas <jethomas  2008-03-14 08:19:15 
Re: BETWEEN
Andrew Haley <andrew29  2008-03-14 14:18:34 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-18 00:00:17 
Re: BETWEEN
Andrew Haley <andrew29  2008-03-18 12:13:01 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-18 11:41:04 
Re: BETWEEN
Andrew Haley <andrew29  2008-03-18 16:15:39 
Re: BETWEEN
"Ed" <nospam  2008-03-15 12:40:01 
Re: BETWEEN
Andrew Haley <andrew29  2008-03-15 10:05:21 
Re: BETWEEN
"Ed" <nospam  2008-03-16 16:56:01 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-16 08:50:11 
Re: BETWEEN
"Ed" <nospam  2008-03-18 10:48:20 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-18 00:55:08 
Re: BETWEEN
"Ed" <nospam  2008-03-20 11:36:33 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-18 00:03:13 
Re: BETWEEN
Duke Normandin <dukeof  2008-03-17 23:28:44 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-18 00:52:09 
Re: BETWEEN
Andrew Haley <andrew29  2008-03-18 12:11:31 
Re: BETWEEN
Duke Normandin <dukeof  2008-03-18 00:51:56 
Re: BETWEEN
John Doty <jpd@[EMAIL   2008-03-17 19:10:30 
Re: BETWEEN
Duke Normandin <dukeof  2008-03-18 05:40:19 
Re: BETWEEN
Coos Haak <chforth@[EM  2008-03-18 18:32:33 
Re: BETWEEN
Duke Normandin <dukeof  2008-03-19 02:09:21 
Re: BETWEEN
Jonah Thomas <jethomas  2008-03-14 10:33:48 
Re: BETWEEN
Jonah Thomas <jethomas  2008-03-14 10:40:29 
Re: BETWEEN
William James <w_a_x_m  2008-03-14 09:21:41 
Re: BETWEEN
Bruce McFarling <agila  2008-03-14 09:49:52 
Re: BETWEEN
Jonah Thomas <jethomas  2008-03-16 10:24:22 
Re: BETWEEN
Jerry Avins <jya@[EMAI  2008-03-16 11:35:57 
Re: BETWEEN
Andrew Haley <andrew29  2008-03-17 10:37:08 
Re: BETWEEN
Bruce McFarling <agila  2008-03-20 04:32:31 
Re: BETWEEN
Jonah Thomas <jethomas  2008-03-31 17:21:03 
Re: BETWEEN
"Ed" <nospam  2008-04-05 01:28:53 
Re: BETWEEN
Jonah Thomas <jethomas  2008-03-31 18:05:58 
Re: BETWEEN
Jonah Thomas <jethomas  2008-04-04 14:46:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sun Oct 12 14:02:44 CDT 2008.