Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert a float to string in F#?

Tags:

f#

How do I convert a float to a string in F#. I'm looking for a function with this signature:

float -> string

like image 810
Ramy Avatar asked Jan 28 '11 22:01

Ramy


People also ask

Can we convert float to string?

The Float. toString() method can also be used to convert the float value to a String. The toString() is the static method of the Float class.

Which function converts float data to string?

We can convert float to a string easily using str() function.


2 Answers

Use the 'string' function.

string 6.3f
like image 65
Joel Mueller Avatar answered Oct 22 '22 07:10

Joel Mueller


> sprintf "%f";;
val it : (float -> string) = <fun:it@8>
like image 29
Jimmy Avatar answered Oct 22 '22 07:10

Jimmy