Page 1 of 1

Str() and ValD() CONVERSIONS

Posted: Thu Apr 09, 2020 11:15 am
by RNBW
I am having problems with the Str() and ValD() conversions and I can't see why. I am entering 1.2345 at the prompt and would expect all the prints and debugs to output this same figure (or the floating point equivalent) but it doesn't happen.

My brain is not working. What am I doing wrong?

Code: Select all

OpenConsole()

Global gk.d
Global qk.d
Global gks.s
Global qks.s
PrintN("If I ENTER 1.2345 AT THE FOLLOWING PROMPT")
PrintN("I WOULD EXPECT THAT 1.2345 WOULD BE PRINTED")
PrintN("OUT AT EACH OF THE PRINT AND DEBUG STATEMENTS")
PrintN("BUT IT'S NOT.  WHAT AM I DOING WRONG?")
PrintN("")


Print("ENTER Gk:  ")
gks.s = Input()
PrintN(gks)
Debug gks
gk = ValD(gks)
Debug gk
PrintN(Str(gk))
Debug gk
Debug ""
Debug ""


gk = 1.2345
gks = Str(gk)
Debug gks
PrintN(gks)
gk = ValF(gks)
PrintN(gks)
Debug gks
Debug gk


Input()

CloseConsole()
End


Re: Str() and ValD() CONVERSIONS

Posted: Thu Apr 09, 2020 11:38 am
by infratec
The main point: StrD()

Code: Select all

EnableExplicit

OpenConsole()

Define.d gk, qk
Define.s gks, qks
PrintN("If I ENTER 1.2345 AT THE FOLLOWING PROMPT")
PrintN("I WOULD EXPECT THAT 1.2345 WOULD BE PRINTED")
PrintN("OUT AT EACH OF THE PRINT AND DEBUG STATEMENTS")
PrintN("BUT IT'S NOT.  WHAT AM I DOING WRONG?")
PrintN("")


Print("ENTER Gk:  ")
gks = Input()
PrintN(gks)
Debug gks
gk = ValD(gks)
Debug gk
PrintN(StrD(gk))
Debug gk
Debug ""
Debug ""


gk = 1.2345
gks = StrD(gk)
Debug gks
PrintN(gks)
gk = ValF(gks)
PrintN(gks)
Debug gks
Debug gk


Input()

CloseConsole()

Re: Str() and ValD() CONVERSIONS

Posted: Thu Apr 09, 2020 12:11 pm
by RNBW
Infratec: Thanks for the very quick response.

It's the little things that you miss and feel so stupid when you ask the question. I can get over my headache now.