Author Topic: i need to know  (Read 3416 times)

0 Members and 1 Guest are viewing this topic.

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
i need to know
« 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

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: i need to know
« Reply #1 on: October 02, 2020, 05:08:20 pm »
What is your target?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: i need to know
« Reply #2 on: October 02, 2020, 05:19:45 pm »
LONG is good for number of records, it will cover 10 million records at least :)
« Last Edit: October 02, 2020, 05:21:12 pm by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: i need to know
« Reply #3 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
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: i need to know
« Reply #4 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.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: i need to know
« Reply #5 on: October 02, 2020, 05:23:37 pm »
Ask is, why you try to convert LONG to _INTEGER64 type?

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: i need to know
« Reply #6 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

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: i need to know
« Reply #7 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?
« Last Edit: October 02, 2020, 05:52:44 pm by Petr »

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: i need to know
« Reply #8 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

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: i need to know
« Reply #9 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.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: i need to know
« Reply #10 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
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/