Menu

Long integer variables

2020-03-07
2020-03-07
  • Chris Ferrante

    Chris Ferrante - 2020-03-07

    I'm trying to adapt an application for Basic 256. It runs into a problem when one of its variables exceeds 2^31, which can happen. The original program defined this variable as double word, allowing integers up to 2^63. Is it possible to define an integer variable in Basic 256 to handle integers up to 2^63? (Don't suggest I install FreeBasic. I want this to work in Basic 256.)

     
  • Jim Reneau

    Jim Reneau - 2020-03-07

    I took a look at the code and changing the Integer type to a "long long" will cause quite a lot of trouble. In addition to changing the "BasicTypes.h" file. We will need to change the variable class and all of the math functions in the interperter.

    What specifically are you trying to do?

    I am concerned what this will do to performance. Let me think bit on this one.

     
    • Chris Ferrante

      Chris Ferrante - 2020-03-07

      Thanks for your response.  We're looking for integers that solve a certain math problem, and the solutions can get really big, like sixteen digits long.  Interestingly, the program finds the pieces it needs to get a candidate number pretty quickly, but it goes haywire when it tests candidates that exceed 2^31.
      I was hoping it is possible to use a dim statement in Basic 256 to define an integer up to 2^63, but I suppose that's asking too much from a program language that's really meant to be a teaching tool for new programmers.  We may have to break down and convert the code to a language that allows for bigger integers.

      Sent from AT&T Yahoo Mail on Android

      On Sat, Mar 7, 2020 at 1:01 PM, Jim Reneaurenejm@users.sourceforge.net wrote:
      I took a look at the code and changing the Integer type to a "long long" will cause quite a lot of trouble. In addition to changing the "BasicTypes.h" file. We will need to change the variable class and all of the math functions in the interperter.

      What specifically are you trying to do?

      I am concerned what this will do to performance. Let me think bit on this one.

      Long integer variables

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/kidbasic/discussion/617729/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.