caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mohamed Iguernlala <iguer.auto@gmail.com>
To: Xavier Leroy <xavier.leroy@inria.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] Is this a bug in Num.float_of_num ?
Date: Thu, 26 May 2016 11:16:18 +0200	[thread overview]
Message-ID: <5746BEE2.3020907@gmail.com> (raw)
In-Reply-To: <5746BA85.4030100@inria.fr>

Le 26/05/2016 10:57, Xavier Leroy a écrit :
> On 26/05/2016 10:24, Mohamed Iguernlala wrote:
>> Hi,
>>
>> I came to the following "stange" behavior when using the function
>> float_of_num. I don't know if this should be considered as a bug,
>> since this function has no specification (in num.mli *)
>>
>> The float "f = 6004799503160661. /. 18014398509481984." has an
>> exact representation on 64 bits. Its value is
>>
>> 0.333333333333333314829616256247390992939472198486328125
>>
>> However, when using float_of_num to compute the float corresponding to
>> the number above represented as a num, the result is slightly different.
> float_of_ratio and float_of_num are very imprecise in OCaml 4.02 and
> earlier.  They were reimplemented in OCaml 4.03 in a way that should
> give correct roundings.  So, make sure you're using 4.03, and if the
> bug is still there, please file a report on Mantis.
Thanks, the result is correct with OCaml 4.03.0.

I hadn't tried before because the constant "let floating_precision = ref 12"
is still there in OCaml 4.03.0 ... Sorry.

Regards,

Mohamed.

      reply	other threads:[~2016-05-26  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26  8:24 Mohamed Iguernlala
2016-05-26  8:57 ` Xavier Leroy
2016-05-26  9:16   ` Mohamed Iguernlala [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5746BEE2.3020907@gmail.com \
    --to=iguer.auto@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=xavier.leroy@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).