See the files src/lib/floating_point.ml
and src/lib/floating_point.mli
in Frama-C. They implement the conversion from decimal representation to floating-point for single-precision and double-precision (you cannot obtain the former from the latter because of double rounding issues), without any external library. The files are covered by the LGPL 2.1. This implementation is the subject of a couple of blog posts starting at this one and continuing with this one.
This is probably close to the simplest conversion function one can make, as in writing this function, I had no performance constraints and only hoped to keep the code as simple and as correct as possible, without wanting a dependence towards an existing library such as MPFR.
...
type parsed_float = {
f_nearest : float ;
f_lower : float ;
f_upper : float ;
}
val single_precision_of_string: string -> parsed_float
val double_precision_of_string: string -> parsed_float
...