Float to String Problem

wdegler

Active Member
Licensed User
Longtime User
I wish to convert floating point values to strings.

Here is example code:

Dim Str As String
Dim Flt As Float
Flt=10.2
Str=Flt
Msgbox(Str,"Str=")

I get Str=10.199999809265137.
I want Str=10.2.

What can I do to get the results I want without limiting needed precision?
 

wdegler

Active Member
Licensed User
Longtime User
The problem remains

Thank you for your response. The problem is that this solution limits precision. For example:

If Flt=10.256, then

I get Str=10.26.
I want Str=10.256.
 
Upvote 0

wdegler

Active Member
Licensed User
Longtime User
I have to use a way around this problem

Thanks again for your input.

I now see that the origin of the numbers are from file or keyboard input and hence, were originally strings. I will have to go back to the original input form rather than use the floating point form to get what I want.
 
Upvote 0
Top