From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr 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 9A08F7ED9B for ; Tue, 20 May 2014 17:33:28 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of thomas.braibant@gmail.com) identity=pra; client-ip=74.125.82.177; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="thomas.braibant@gmail.com"; x-sender="thomas.braibant@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of thomas.braibant@gmail.com designates 74.125.82.177 as permitted sender) identity=mailfrom; client-ip=74.125.82.177; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="thomas.braibant@gmail.com"; x-sender="thomas.braibant@gmail.com"; 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@mail-we0-f177.google.com) identity=helo; client-ip=74.125.82.177; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="thomas.braibant@gmail.com"; x-sender="postmaster@mail-we0-f177.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgIBAI50e1NKfVKxlGdsb2JhbABZg1dYgmmpNJd5AYETCBYOAQEBAQcLCwkSKoIlAQEFIx0BGxILAQMMBgULDQICCR0CAiEBAREBBQEKEgYTEogaAQMRDaJYjBGBRYMNmQ0KGScDCmSFSxEBBQyBHosPghUHgnWBSwSEXgIDkxGBdIE9i3KEABgphGk8 X-IPAS-Result: AgIBAI50e1NKfVKxlGdsb2JhbABZg1dYgmmpNJd5AYETCBYOAQEBAQcLCwkSKoIlAQEFIx0BGxILAQMMBgULDQICCR0CAiEBAREBBQEKEgYTEogaAQMRDaJYjBGBRYMNmQ0KGScDCmSFSxEBBQyBHosPghUHgnWBSwSEXgIDkxGBdIE9i3KEABgphGk8 X-IronPort-AV: E=Sophos;i="4.98,874,1392159600"; d="scan'208";a="62844880" Received: from mail-we0-f177.google.com ([74.125.82.177]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 20 May 2014 17:33:28 +0200 Received: by mail-we0-f177.google.com with SMTP id x48so704278wes.36 for ; Tue, 20 May 2014 08:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=PInp+l16uni5esHKhg3tC7tDNYhev/zTaKiAw2VBE+o=; b=S1XcK4xU3VCPic7jBihiZShyLhQ9yaH+o/YQB4YEXXxaB2F5vEqpfEYCdKFtx60Oz4 bwLvgYwEn7yO3uVc2ycHUS56xIk9dMKxy32li7SkxG0J4vnNvSJsq2aa/JfaLPEOXP30 8Yf4y3rcAU3N5RwZxUE//iwQAgiQIKCdwFJgeeMrz81dD5sygHyOquDrog3BBJQjRUR0 l6asAyjeEVIdTQzqnCHwX3a5m+ZMXNYtrZ1hJljJv5iS/tEqKgM5RzVph7OfbqkMODwi UWOTlm1LC1Dvqprxy207FttBtQjr5j/0JR/vDf86E2h4sO3Sxxr8uoCffB1lTzYKmXS1 RuPg== X-Received: by 10.180.183.5 with SMTP id ei5mr4821337wic.54.1400600007847; Tue, 20 May 2014 08:33:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.138.15 with HTTP; Tue, 20 May 2014 08:33:07 -0700 (PDT) In-Reply-To: References: From: Thomas Braibant Date: Tue, 20 May 2014 16:33:07 +0100 Message-ID: To: Xavier Leroy Cc: OCaML Mailing List Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Arbitrary precision unsigned integers Thanks for the quick reply. I guess I will do exactly that and release the wrapper library. On Tue, May 20, 2014 at 4:29 PM, Xavier Leroy wrote: > Hi Thomas, > > In a pinch, you can use Zarith and follow each arithmetic operation by a > Z.extract or Z.signed_extract operation to normalize the result to the > desired range (N-bit unsigned or N-bit signed). It's not as fast as it > could be, but should be reasonably efficient. > > - Xavier Leroy > > > > 2014-05-20 17:18 GMT+02:00 Thomas Braibant : >> >> Hi list, >> >> >> I wonder if there is a publicly available library that implements >> arbitrary precision (un)signed integers. I could not find anything >> relevant with Google, nor on Opam. >> >> By arbitrary, I mean that I want to implement e.g., 43 bits unsigned >> arithmetic, and have the right overflow behaviors. I know of zarith >> which seems to implement arbitrary precision in the sense that the >> precision of the numbers grows as needed. >> >> Best, >> Thomas >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >> >