Page 1 of 1

Convert Int to a decimal number

Posted: Fri Feb 05, 2021 8:30 pm
by KrisJeff
Can someone help with the attached. I want to be able to print an amps value in decimal to 2 decimal places?

Re: Convert Int to a decimal number

Posted: Fri Feb 05, 2021 8:43 pm
by mnf
In a calculation use:

str = FloatToString$(value, 2) (or change 2 to required number of digits...)

Then print str.. (str defined a string variable..)

Martin

Re: Convert Int to a decimal number

Posted: Sat Feb 06, 2021 3:01 pm
by KrisJeff
Dear Martin,
Thank you for your help to date. Done as instructed. Now get to 2 decimal places but still printing only the whole number.
Sorry, I'm not very good with string manipulations etc. Please see amended as per attached.

Re: Convert Int to a decimal number

Posted: Sat Feb 06, 2021 3:09 pm
by mnf
Sorry - not at computer now.. but is your value a float?

Just looked and it's an integer value - you'll need a floating point value for your result...

Martin

Re: Convert Int to a decimal number

Posted: Sat Feb 06, 2021 11:02 pm
by medelec35
Martin is correct.
I have change it for you.
Try the attached Flowchart.