jkotlinski / durexforth

Modern C64 Forth
Other
230 stars 28 forks source link

Idea: Double Literals and M*/ #433

Closed burnsauce closed 2 years ago

burnsauce commented 2 years ago

Some forths feature double literals via a trailing period, e.g.: 40000. , -1234567.

While double literals themselves are not that big a feature, they require implementation of m*/ to operate. From the standard:

M*/ was once described by Chuck Moore as the most useful arithmetic operator in Forth. It is the main workhorse in most computations involving double-cell numbers.

It's the only operator that multiplies with a double as an input.

Should these be added to Durexforth?

jkotlinski commented 2 years ago

What is the use case? Personally I never had much of a desire to use double numbers.

On Fri, 14 Jan 2022 at 08:49, Poindexter Frink @.***> wrote:

Some forths feature double literals via a trailing period, e.g.: 40000. , -1234567.

While double literals themselves are not that big a feature, they require implementation of m*/ to operate. From the standard:

M*/ was once described by Chuck Moore as the most useful arithmetic operator in Forth. It is the main workhorse in most computations involving double-cell numbers.

It's the only operator that multiplies with a double as an input.

Should these be added to Durexforth?

— Reply to this email directly, view it on GitHub https://github.com/jkotlinski/durexforth/issues/433, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAY34OZ3CYC6XL2RNLHJRH3UV7IQPANCNFSM5L6CDWUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

burnsauce commented 2 years ago

Fixed point math would benefit greatly from M*/

burnsauce commented 2 years ago

Fixed point math would benefit greatly from M*/

The single-precision divisor limits fractional components to 14-bits, as, say fractional multiply requires f1 * f2 / 1 << fbits. As we cannot divide by a signed $8000 we must set the fractional component at 14 to divide by $4000.

Therefore, M*/ offers no great automatic advantage in fractional math for multiplication. I will continue to explore this space.