[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | skaller <skaller@m...> |
| Subject: | How to format a float? |
How do I format a floating point number correctly in ocaml, with a given _variable_ width and precision? I can't find a routine in the library for this. Shouldn't there be one? Did I miss it? -- sprintf is not suitable, the format string must be a literal. string_of_float has no arguments, and it gives the wrong format if the number happens to be integral. I need to write a 'printf' like routine. It's relatively easy to write an integer formatting routine, but floats are somewhat more difficult. -- John Skaller, mailto:skaller@maxtal.com.au 1/10 Toxteth Rd Glebe NSW 2037 Australia homepage: http://www.maxtal.com.au/~skaller downloads: http://www.triode.net.au/~skaller