Jump to content
Sign in to follow this  
artrag

Fixed numbers in intybasic v1.2.9

Recommended Posts

Apart the bug spotted elsewhere that leads this kind of expressions #ex(0) = -1.0+.#ex(0) to fail, it seems that it is missing a proper support to multiplications/divisions.

 

I was trying to multiply a fixed point number by a constant, but due to the fact that the fractional part in in the high byte, normal multiplication fails...

Is there a dedicated multiplication for 8.8 fixed point numbers ? BTW what is the reason for this inversion (high/low byte)?

 

Am I missing something or the support for fixed point numbers is just immature in v1.2.9 ?

Share this post


Link to post
Share on other sites

Apart the bug spotted elsewhere that leads this kind of expressions #ex(0) = -1.0+.#ex(0) to fail, it seems that it is missing a proper support to multiplications/divisions.

 

I was trying to multiply a fixed point number by a constant, but due to the fact that the fractional part in in the high byte, normal multiplication fails...

Is there a dedicated multiplication for 8.8 fixed point numbers ? BTW what is the reason for this inversion (high/low byte)?

 

Am I missing something or the support for fixed point numbers is just immature in v1.2.9 ?

Perhaps the multiplication by constant uses the macro Joe Z. and I worked on which assumed 16-bit integers.

Share this post


Link to post
Share on other sites

I'm afraid I forgot completely about the fixed point number support in IntyBASIC.

 

Supposedly it would have helped to integrate fractions to ease writing of Asteroids-like game but the support come with far too many bugs because it was too early.

Share this post


Link to post
Share on other sites

Well, once you fix addition and subtraction by constants, product of two 8.8 numbers is just a 32 bit multiplication where you keep the upper 16 bits as result.

 

You need

+.

-.

*.

/.

 

 

But, why the up/down bytes inversion? Does it help somehow?

Edited by artrag

Share this post


Link to post
Share on other sites

Actually if you keep the same convention used for usual integers you should end up with this

+. = +

-. = -

/. = /

*. = * on 32 bits >>16

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...