From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 919FC7FA6B for ; Tue, 25 Oct 2016 12:21:17 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jacques-henri.jourdan@normalesup.org; spf=Neutral smtp.mailfrom=jacques-henri.jourdan@normalesup.org; spf=None smtp.helo=postmaster@ulminfo.fr Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jacques-henri.jourdan@normalesup.org) identity=pra; client-ip=5.135.188.139; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jacques-henri.jourdan@normalesup.org"; x-sender="jacques-henri.jourdan@normalesup.org"; x-conformance=sidf_compatible Received-SPF: Neutral (mail3-smtp-sop.national.inria.fr: domain of jacques-henri.jourdan@normalesup.org does not assert whether or not 5.135.188.139 is permitted sender) identity=mailfrom; client-ip=5.135.188.139; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jacques-henri.jourdan@normalesup.org"; x-sender="jacques-henri.jourdan@normalesup.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@ulminfo.fr) identity=helo; client-ip=5.135.188.139; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jacques-henri.jourdan@normalesup.org"; x-sender="postmaster@ulminfo.fr"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3Acj/H2B2kdAnHxZGGsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?segRKvad9pjvdHbS+e9qxAeQG96KsbQa1KGM7ejJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL2PbrnD61zMOABK3bVMz?= =?us-ascii?q?fbWvXNCNxJ7pn8mJuLTrKz1SgzS8Zb4gZD6Xli728vcsvI15N6wqwQHIqHYbM8?= =?us-ascii?q?5fxGdvOE7B102kvpT4yrc4rH8V465pt5MYEPayQ6NtRrVdCHEiMnspzMztrxjK?= =?us-ascii?q?CwWVtVUGVWBDsBNDGhXI91TaU5Hrs2PYsfdn1CCcdZn0RLstRDm5qqdmTgXpzi?= =?us-ascii?q?UAKiQ1+Wf/jMtqiatfrQm8v1p42YGCM9LdD+Z3Yq6IJYBSfmFGRMsECnRM?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BCXAC/MA9YZIu8hwVcHAEBBAEBCgEBg?= =?us-ascii?q?zABAQEBAR1YExdUpDKUP4IHKYUuSgIIgXFAEwEBAQEBAQEBAQEBA0g+gjMEAwM?= =?us-ascii?q?HDoIRAQEEIxVRCxgCAiYCAlcTCAKITwQKtGWMejGBB4czgliFExeCIYJbBZoWh?= =?us-ascii?q?iqMJYc2hhGNCIQBIANTLoUShk8MgW8BAQE?= X-IPAS-Result: =?us-ascii?q?A0BCXAC/MA9YZIu8hwVcHAEBBAEBCgEBgzABAQEBAR1YExd?= =?us-ascii?q?UpDKUP4IHKYUuSgIIgXFAEwEBAQEBAQEBAQEBA0g+gjMEAwMHDoIRAQEEIxVRC?= =?us-ascii?q?xgCAiYCAlcTCAKITwQKtGWMejGBB4czgliFExeCIYJbBZoWhiqMJYc2hhGNCIQ?= =?us-ascii?q?BIANTLoUShk8MgW8BAQE?= X-Spam-Status: Yes X-IronPort-AV: E=Sophos;i="5.31,545,1473112800"; d="scan'208";a="198084411" Received: from ulminfo.fr ([5.135.188.139]) by mail3-smtp-sop.national.inria.fr with ESMTP; 25 Oct 2016 12:21:16 +0200 Received: from [139.19.168.39] (wks-50-28.mpi-sws.org [139.19.168.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ulminfo.fr (Postfix) with ESMTPSA id 5A539C087A for ; Tue, 25 Oct 2016 12:21:15 +0200 (CEST) To: caml-list@inria.fr References: From: Jacques-Henri Jourdan Message-ID: <12299aa2-d7d2-52b8-54fc-b81913b3b966@normalesup.org> Date: Tue, 25 Oct 2016 12:21:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Approximations when converting from string to float 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