Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Num.float_of_num depends on Arith_status.set_floating_precision #6896
Original bug ID: 6896
Num.float_of_num depends on the precision set with Arith_status.set_floating_precision, but that is not immediately obvious from the documentation: "This parameter is the number of digits displayed when approx_printing is on". approx_printing is not on in the example below.
Please document in Num.float_of_num that it depends on Arith_status.set_floating_precision, and in Arith_status.set_floating_precision that it influences Num.float_of_num.
Steps to reproduce
Comment author: @gasche
Arguably the implementation is wrong : I think the behaviour you observe is an artefact of the implementation of (Ratio.float_of_ratio r) as (float_of_string (string_of_ratio r)). There are certainly direct ways to convert a rational into a string, but at least there should be a way to obtain a float (or string representation of a float) that provides the maximal precision available for double.