1. Dmitry Grebeniuk
  2. ocaml_input_float

Overview

HTTPS SSH
(* OASIS_START *)
(* DO NOT EDIT (digest: 648405e3b013d4217e1366d5b2cd4fce) *)

input_float - Input floating point numbers with rounding and locale support
===========================================================================

See the file [INSTALL.txt](INSTALL.txt) for building and installation
instructions.

Copyright and license
---------------------

input_float is distributed under the terms of the GNU Lesser General Public
License version 2.1 with OCaml linking exception.

(* OASIS_STOP *)


  Proper decimal rounding of floating point numbers is an extremely hard task,
when precise result is needed.  For example, author
http://www.exploringbinary.com/ blog shows horrors that will be raised
in front of naive implementer of floating point parsing algorithm.

  Author of this mini-library had a much simpler task: read strings in decimal
notation and produce rounded floats of given precision.  So here numbers are
prepared (rounded too), then given to [float_of_string] OCaml function, which
internally uses [strtod].  No custom parsing of floats is actually done.
[strtod] is a "point of trust" here.