Str() and ValD() CONVERSIONS

Just starting out? Need help? Post your questions and find answers here.
RNBW
User
User
Posts: 65
Joined: Thu Jan 02, 2014 5:01 pm

Str() and ValD() CONVERSIONS

Post 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

infratec
Always Here
Always Here
Posts: 6886
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Str() and ValD() CONVERSIONS

Post 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()
RNBW
User
User
Posts: 65
Joined: Thu Jan 02, 2014 5:01 pm

Re: Str() and ValD() CONVERSIONS

Post 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.
Post Reply