Jump to content

Photo

Fixed numbers in intybasic v1.2.9

intybasic

4 replies to this topic

#1 artrag OFFLINE  

artrag

    Stargunner

  • 1,212 posts

Posted Fri Aug 10, 2018 8:12 AM

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 ?



#2 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 12,032 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Fri Aug 10, 2018 9:32 AM

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.

#3 nanochess OFFLINE  

nanochess

    Processorus Polyglotus

  • 5,797 posts
  • Coding something good
  • Location:Mexico City

Posted Fri Aug 10, 2018 12:39 PM

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.

#4 artrag OFFLINE  

artrag

    Stargunner

  • Topic Starter
  • 1,212 posts

Posted Fri Aug 10, 2018 1:21 PM

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, Fri Aug 10, 2018 1:51 PM.


#5 artrag OFFLINE  

artrag

    Stargunner

  • Topic Starter
  • 1,212 posts

Posted Fri Aug 10, 2018 2:59 PM

Actually if you keep the same convention used for usual integers you should end up with this
+. = +
-. = -
/. = /
*. = * on 32 bits >>16





Also tagged with one or more of these keywords: intybasic

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users