Author Topic: str() issue  (Read 85 times)

0 Members and 1 Guest are viewing this topic.

jcfuller

  • Jr. Member
  • **
  • Posts: 85
str() issue
« 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

Arnold

  • Hero Member
  • *****
  • Posts: 510
Re: str() issue
« Reply #1 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.

Aurel

  • Full Member
  • ***
  • Posts: 134
Re: str() issue
« Reply #2 on: February 12, 2018, 11:44:12 AM »
..wait a moment
string function str(numVar)  :o
what can have two members ?
since when?

Aurel

  • Full Member
  • ***
  • Posts: 134
Re: str() issue
« Reply #3 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  ::)

Charles Pegge

  • Author
  • *****
  • Posts: 3365
    • Oxygen Basic
Re: str() issue
« Reply #4 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)

Charles Pegge

  • Author
  • *****
  • Posts: 3365
    • Oxygen Basic
Re: str() issue
« Reply #5 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)