SAFE-UM/MOD would unsigned divide a double on the double stack...
by a number on the single stack, then push the double-precision
remainder and quotient to the double stack.
etc.
Note also that SAFE-UM/MOD can't be written in ANS-Forth,
despite the fact that it is used internally by # for pictured numbers.
ANS-Forth provides UM/MOD (6.1.2370) but says:
"An ambiguous condition exists if [the denominator] is zero or if=20
the quotient lies outside the range of a single-cell unsigned integer."
What are you supposed to do if your quotient overflows, which will
happen if you have a small denominator?
What are you supposed to do if your remainder overflows, which will
happen if you have a large denominator?
Hugh Aguilar <hughag...@gmail.com> writes:
SAFE-UM/MOD would unsigned divide a double on the double stack...
by a number on the single stack, then push the double-precision
remainder and quotient to the double stack.
etc.
Note also that SAFE-UM/MOD can't be written in ANS-Forth,
despite the fact that it is used internally by # for pictured numbers.
Gforth has:
: ud/mod ( ud1 u2 -- urem udquot ) \ gforth
With a single-cell divisor, the remainder is guaranteed to fit into a
single cell.
My other point that I was making is that ANS-Forth is badly designed
because single and double precision numbers are mixed together
on the same stack --- this results in very convoluted stack juggling.
The obvious solution is to have a separate stack for double precision numbers. This was obvious in 1994.
On 1/10/2023 2:29 pm, Hugh Aguilar wrote:
My other point that I was making is that ANS-Forth is badly designed because single and double precision numbers are mixed togetherNot obvious to anyone AFAIK. Hopefully you patented it before sharing.
on the same stack --- this results in very convoluted stack juggling.
The obvious solution is to have a separate stack for double precision numbers. This was obvious in 1994.
Nowadays, with 64bit becoming the norm I don't know why one would want or need double words for ordinary integer programs. The range is so huge that double numbers are hardly ever needed to get the job done.
...
Nowadays, with 64bit becoming the norm I don't know why one would want or need double words for ordinary integer programs. The range is so huge that double numbers are hardly ever needed to get the job done.
Nowadays, with 64bit becoming the norm I don't know why one would want or need double words for ordinary integer programs. The range is so huge that double numbers are hardly ever needed to get the job done. Even "Brody math" (fixed point calculation) has become a viable option for many applications. I've
even experimented with the concept in my "integer only" uBasic.
On Sunday, October 1, 2023 at 3:33:13 PM UTC+2, Hans Bezemer wrote:
[..]
Nowadays, with 64bit becoming the norm I don't know why one would want or
need double words for ordinary integer programs. The range is so huge that >> double numbers are hardly ever needed to get the job done.
A double number does not have enough bits to convert an extended precision float (80-bits). ISTR it was not enough to convert a 64bit float, either.
On Sunday, October 1, 2023 at 6:59:36 AM UTC+2, dxf wrote:
On 1/10/2023 2:29 pm, Hugh Aguilar wrote:
Not obvious to anyone AFAIK. Hopefully you patented it before sharing.
My other point that I was making is that ANS-Forth is badly designed
because single and double precision numbers are mixed together
on the same stack --- this results in very convoluted stack juggling.
The obvious solution is to have a separate stack for double precision
numbers. This was obvious in 1994.
I don't know if a separate stack helps much - but I do support more distinction
between single and double numbers. In the standard there are a few core words >that do require a double word input or output. They do stand out like a pig in a
dog show IMHO. In 4tH no such words exist. They're confined to double word >libraries (yes, even <# # #> are single words in 4tH - with a double word >equivalent).
I hardly ever used double words. I once did a few IBAN programs which required >triple words - but that's about it. However, once I tackled floating point
- yes, there
I needed the extended precision of double words - and that's where they came in.
Nowadays, with 64bit becoming the norm I don't know why one would want or >need double words for ordinary integer programs. The range is so huge that >double numbers are hardly ever needed to get the job done. Even "Brody math" >(fixed point calculation) has become a viable option for many applications. I've
even experimented with the concept in my "integer only" uBasic.
https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/apps/basic/fraction.bas
Hans Bezemer--
In 4tH no such words exist. They're confined to double wordIt is not a good idea to have meaning of words changed.
libraries (yes, even <# # #> are single words in 4tH - with a double word >equivalent).
In competition with jonesforth (loosely based on ciforth) I made
yourforth intended to be as simple as possible.
I have introduced the <% % %> to be single equivalents, and
leave the possibility to load <# # #> lateron.
I subscribe to your idea that it's not a good idea to redefine
(standard) words
...
So, where <#, # and #> are concerned - I'm pretty happy with them.
On Monday, October 2, 2023 at 3:30:14 AM UTC-7, Hans Bezemer wrote:
Also, you
can't nest <# #> within each other. Anybody who claims to be "pretty happy" with <# #> in the post-PDP-11 era (after 1982) is utterly incompetent.
Anybody who says that it is not a good idea to redefine ANS-Forth words
is a disgusting little sycophant of Elizabeth Rather --- not a Forth programmer!
On Monday, October 2, 2023 at 3:30:14 AM UTC-7, Hans Bezemer wrote:
I subscribe to your idea that it's not a good idea to redefine
(standard) words
...
So, where <#, # and #> are concerned - I'm pretty happy with them.
ANS-Forth was designed for the PDP-11.
As I mentioned before, the lack of a double-stack was due to
Charles Moore not having an available register to use as the
double-stack pointer.
Another weakness of the PDP-11 is that it only addressed 64KB
of memory, that had to contain the compiler, the RTOS, and the
application program. This is why PolyForth for the 8086 used only
64KB (all segment registers set the same) --- PolyForth for the 8086
was just a line-by-line port of Charles Moore's PDP-11 Forth.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 504 |
Nodes: | 16 (2 / 14) |
Uptime: | 19:50:06 |
Calls: | 9,904 |
Files: | 13,797 |
Messages: | 6,345,221 |