Author Topic: CURRENCY data type  (Read 3349 times)

0 Members and 1 Guest are viewing this topic.

Offline Kosta

  • Newbie
  • Posts: 9
    • View Profile
CURRENCY data type
« on: August 02, 2019, 05:50:51 pm »
Hi guys.  I just downloaded QB64 for the first time and tried to compile some of my old PDS 7.1 (QBX) code, but I got a couple of errors.  Didn't find a help file in the menu on the IDE either.

Apparently, QB64 does not support the @CURRENCY data type?  This was an 8 byte scaled integer in QBX.  My DIM statement produces the error "Unknown type."

What is the QB64 equivalent?  And, is there a help file?

Thanks, and forgive my ignorance, as I've only had this for 10 minutes!

Kosta

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: CURRENCY data type
« Reply #1 on: August 02, 2019, 06:17:25 pm »
I can't say I'm familiar with QBX. I went from QuickBasic 4.5 to QB64

Here is the list of QB64 variable types, complete so far as I know.

http://www.qb64.org/wiki/Variable_Types

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: CURRENCY data type
« Reply #2 on: August 02, 2019, 06:42:50 pm »
Welcome Kosta,

Help is on the right side of the menu in the IDE.

It is also here:
http://qb64.org/wiki/Main_Page

Also Function Key #1 when cursor is on any keyword.

Single data type is closest to Currency (wasn't that in QB 4.5 or VB for MS Dos?)

You can create a function to convert single to 2 decimals for show.
« Last Edit: August 02, 2019, 06:59:06 pm by bplus »

Offline Kosta

  • Newbie
  • Posts: 9
    • View Profile
Re: CURRENCY data type
« Reply #3 on: August 02, 2019, 06:50:19 pm »
Oh now I see where it is... Way, way over there.  I should have noticed that.  But too bad about the data type? The CURRENCY data type is supported in Power Basic and quick basic's last iteration, QBX.EXE (Professional Development System 7.1., circa Q3 1990). It's an 8 byte data type with four decimal points typically used for financial calculations. I've been using it for 30 years. Surprised it's not supported in QB64.

But thanks pointing out where that help link is.

Kosta

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: CURRENCY data type
« Reply #4 on: August 02, 2019, 06:51:16 pm »
FUNCTION MKC$ (CurrVal AS _FLOAT) 'converts currency amount to PDS or VB currency string
DIM CVal AS _INTEGER64
CVal = CurrVal * 10000 '        multiply float value by 10 thousand
MKC = _MK$(_INTEGER64, CVal)
END FUNCTION 

FUNCTION CVC## (CurrStr AS STRING) 'converts currency string to a _FLOAT currency amount
DIM CV AS _INTEGER64
CV = _CV(_INTEGER64, CurrStr)
CVC = CV / 10000 '                   divide by 10 thousand
END FUNCTION 
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Kosta

  • Newbie
  • Posts: 9
    • View Profile
Re: CURRENCY data type
« Reply #5 on: August 02, 2019, 06:56:54 pm »
Thanks. I'll try doing it that way and see how it goes...

Kosta

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: CURRENCY data type
« Reply #6 on: August 02, 2019, 09:32:43 pm »
Here's the link to the whole wiki

http://www.qb64.org/wiki/PDS_(7.1)_Procedures

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: CURRENCY data type
« Reply #7 on: August 02, 2019, 11:29:45 pm »
Oh wow, a whole section and look there are the functions too :)