QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Kosta on August 02, 2019, 05:50:51 pm

Title: CURRENCY data type
Post by: Kosta 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
Title: Re: CURRENCY data type
Post by: OldMoses 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
Title: Re: CURRENCY data type
Post by: bplus 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.
Title: Re: CURRENCY data type
Post by: Kosta 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
Title: Re: CURRENCY data type
Post by: SMcNeill 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 
Title: Re: CURRENCY data type
Post by: Kosta on August 02, 2019, 06:56:54 pm
Thanks. I'll try doing it that way and see how it goes...

Kosta
Title: Re: CURRENCY data type
Post by: OldMoses 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
Title: Re: CURRENCY data type
Post by: bplus on August 02, 2019, 11:29:45 pm
Oh wow, a whole section and look there are the functions too :)