Oxygen Basic

Programming => Bugs & Feature Requests => Topic started by: jcfuller on February 12, 2018, 04:11:30 AM

Title: str() issue
Post by: jcfuller on February 12, 2018, 04:11:30 AM
Charles,
  It appears str is not working correctly.
Should it not only have 3 places after the decimal?
James

Code: [Select]
% filename "jcf01.exe"
includepath "$/inc/"
uses "RTL64.inc"
uses "MinWin.inc" 
extern lib "User32.dll"
  ! GetActiveWindow() As sys
end extern

double d = 2.34342
string s = str(d,3)
MessageBox(GetActiveWindow(),s,"double",MB_APPLMODAL)
Print s
Title: Re: str() issue
Post by: Arnold on February 12, 2018, 07:17:10 AM
Using 32-bit Windows I will get the expected results, also with using RTL32.inc. But I have not tested with Win64.
Title: Re: str() issue
Post by: Aurel on February 12, 2018, 11:44:12 AM
..wait a moment
string function str(numVar)  :o
what can have two members ?
since when?
Title: Re: str() issue
Post by: Aurel on February 12, 2018, 11:49:50 AM
hiii Roland have a right
so second param is number of decimal places !
i really don't know that  ::)

[attachment deleted by admin]
Title: Re: str() issue
Post by: Charles Pegge on February 13, 2018, 01:42:28 AM
Hi James, I'm on the case.


PS:

void* a internaly translates to sys a

And the easiest way to get some clean heap space:

sys a=getmemory(1024)
...
freememory( a)
Title: Re: str() issue
Post by: Charles Pegge on February 13, 2018, 03:16:18 AM
Fixed!

https://github.com/Charles-Pegge/OxygenBasic/blob/master/OxygenProgress.zip

Tests:
Code: [Select]
'2018-02-13 T 08:39:32
'test hex and str
$ filename "t.exe"
uses rtl64
print hex 0xabcd
print hex 0xabcd,7
print pi
print str(pi(),5)