Jump to content
IGNORED

using math in intybasic?


CrazyBoss

Recommended Posts

thats good so no need to worry to use math in the code :) you know sometimes you make something like a=a+20+5+(2*a)

 

i did experience that sometimes you need to use () where your normal dont have to (compared to other basics or pascal).

 

actually I think inty basic do it "wrong" if you dont use the () in this example: a=10+(5*a)

Link to comment
Share on other sites

thats good so no need to worry to use math in the code :) you know sometimes you make something like a=a+20+5+(2*a)

 

i did experience that sometimes you need to use () where your normal dont have to (compared to other basics or pascal).

 

actually I think inty basic do it "wrong" if you dont use the () in this example: a=10+(5*a)

 

IntyBASIC has standard precedence rules. The multiply and division operators have higher precedence than the addition and substraction operators. So the expression will work just fine without parenthesis.

Link to comment
Share on other sites

It has problems due to signs and byte and words. Division is only signed, product is 16 bit even between bytes and is silently truncated to bytes but it should deal correctly with precedence among operators.

 

Actully due to the integer nature of the variables you can have problems according to the order of products and divisions.

 

A/5*8 is very different by A*8/5

Edited by artrag
Link to comment
Share on other sites

It has problems due to signs and byte and words. Division is only signed, product is 16 bit even between bytes and is silently truncated to bytes but it should deal correctly with precedence among operators.

 

Actully due to the integer nature of the variables you can have problems according to the order of products and divisions.

 

A/5*8 is very different by A*8/5

 

Does it behave much differently than C here? Because division and multiplication are at the same precedence, I would expect A/5 to truncate before the multiplication. Maybe it's less surprising to me because I've been programming C for so long.

 

If you're coming from a Microsoft BASIC background (which is many or most of us who learned BASIC in the 80s) where everything is floating point by default, I can definitely see how it can be a surprise.

Link to comment
Share on other sites

No, coding in c it is normal.

You have only to know that here bytes are unsigned by default (now can be also signed) and that division is unsigned ;)

 

The main difference anyway is with old basic where everything is float by default and all integers are signed 16 bit.

But none needs floats here, it isn't a feature request.

Edited by artrag
  • Like 1
Link to comment
Share on other sites

No, coding in c it is normal.

You have only to know that here bytes are unsigned by default (now can be also signed) and that division is unsigned ;)

 

The main difference anyway is with old basic where everything is float by default and all integers are signed 16 bit.

But none needs floats here, it isn't a feature request.

 

Makes sense. I figured you were speaking from the perspective of someone who grew up with a floating-point BASIC. :) And yeah, implementing floating point on the Intellivision would be a bad idea. I didn't think you were requesting it. :)

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...