caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques-Henri Jourdan <jacques-henri.jourdan@normalesup.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Approximations when converting from string to float
Date: Tue, 25 Oct 2016 12:21:14 +0200	[thread overview]
Message-ID: <12299aa2-d7d2-52b8-54fc-b81913b3b966@normalesup.org> (raw)
In-Reply-To: <CAFxmOcR4uoy174N3HzGO6=NRvrQGbuse_RAwmjxqJD5v5zQ6tg@mail.gmail.com>

Hi,

I would say that the easiest is to use the ZArith library: you convert 
from tring to Z.t, then from Z.t to float.

By doing so,you get only an approximation, but you do not know whether 
this is a lower or upper rounding. You need then to convert back to Z.t 
and compare with the original number. Depending on whether this is a 
lower, exact or upper rounding, you can then get your interval by adding 
or removing an ulp....


-- 
JH

On 10/24/2016 04:01 PM, Tung Vu Xuan wrote:
> Hi,
>
> I am having a problem when converting from string to float as 
> described in this question:
> http://stackoverflow.com/questions/40219852/string-to-float-in-ocaml-over-and-under-approximation. 
>
> Your helps are mostly appreciated! Thanks a lot!
>
> Best Regards,
> Tung


  reply	other threads:[~2016-10-25 10:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 14:01 Tung Vu Xuan
2016-10-25 10:21 ` Jacques-Henri Jourdan [this message]
2016-10-25 11:20 ` Soegtrop, Michael
2016-10-25 11:24   ` Soegtrop, Michael
2016-10-25 14:19   ` Jacques-Henri Jourdan
2016-10-25 15:28     ` Soegtrop, Michael
2016-10-25 16:58       ` Tung Vu Xuan
2016-10-25 17:04         ` Jacques-Henri Jourdan
2016-10-25 18:07         ` Xavier Leroy
2016-10-26  9:38           ` Tung Vu Xuan
2016-10-26  8:08         ` Soegtrop, Michael

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=12299aa2-d7d2-52b8-54fc-b81913b3b966@normalesup.org \
    --to=jacques-henri.jourdan@normalesup.org \
    --cc=caml-list@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).