QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: badger on October 02, 2020, 04:23:39 pm

Title: i need to know
Post by: badger on October 02, 2020, 04:23:39 pm
hello

anything z is integer64, anything l is long

zcustrecnum =lof(1) / lcustreclen


is this ok to do due to the different types

Badger
Title: Re: i need to know
Post by: Petr on October 02, 2020, 05:08:20 pm
What is your target?
Title: Re: i need to know
Post by: bplus on October 02, 2020, 05:19:45 pm
LONG is good for number of records, it will cover 10 million records at least :)
Title: Re: i need to know
Post by: Pete on October 02, 2020, 05:21:16 pm
In QB64, you can use: DEFLNG L

So now any numeric variable that starts with "L" or "l" will be long. Funny though, by default any undefined numeric variable is already long. This makes me wonder why we haven't seen a _DEFINT64 new QB64 keyword yet, as back to your question, there is only DEFINT available in QB64, from the old QB45 days.

Assigning with TYPE is something I seldom do, but I would think you would have to type each variable, and not just the starting letter of any variable, but I might be mistaken.

Pete
Title: Re: i need to know
Post by: bplus on October 02, 2020, 05:23:17 pm
Default is SINGLE not LONG

 and

_DEFINE A-Z AS _INTEGER64 is how you'd do that.
Title: Re: i need to know
Post by: Petr on October 02, 2020, 05:23:37 pm
Ask is, why you try to convert LONG to _INTEGER64 type?
Title: Re: i need to know
Post by: badger on October 02, 2020, 05:31:35 pm
hello

looks like i opened a can of worms LOL... to set an integer64 = to a number divide by a long just gives a warning just need to know if that is going to cause problems later.   

here is my type defs

REM ***************************************************************************
_DEFINE I AS INTEGER : _DEFINE S AS STRING : _DEFINE D AS DOUBLE
_DEFINE F AS _FLOAT : _DEFINE L AS LONG : _DEFINE Z AS _INTEGER64
Badger
Title: Re: i need to know
Post by: Petr on October 02, 2020, 05:38:57 pm
There will be no problems with data types if you use integers for integer types. I don't know what the two variables at the beginning of this thread are, zcustrecnum and lcustreclen. The difference between type LONG and _INTEGER64 is only in the maximum possible value and memory usage: LONG use 4 bytes in memory/file and _INTEGER64 use 8 bytes in memory/file . What are this two variables?
Title: Re: i need to know
Post by: badger on October 02, 2020, 05:58:06 pm
Hellp

@Petr

zcustrecnum and lcustreclen these two variables are record number and the length of my type def it has id number first name last name address city state zip phone number

Badger
Title: Re: i need to know
Post by: luke on October 02, 2020, 09:46:38 pm
QB64 implicitly adds casts when assigning values to a different numeric type so everything Just Works.

Keep in mind if the division produces a fraction, it will be rounded to a whole number before being assigned.
Title: Re: i need to know
Post by: Pete on October 02, 2020, 10:34:31 pm
Default is SINGLE not LONG

 and

_DEFINE A-Z AS _INTEGER64 is how you'd do that.

It's crazy how I have that twisted in my head. I always SWAP those terms, but I know the default symbol is the exclamation point.

Now I have to go look up _DEFINE. I've never used it before. Thanks Mark!

Pete