From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0B43F385841A for ; Tue, 4 Jan 2022 18:01:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B43F385841A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641319281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uQZCqn7vW7btACW0qd4DDuttCuAUasRw0YpNM3TnA2Q=; b=Hc8wugLX9RfdokAcaYR6PbMPRUSLQ76nj3oP47RnO/4ADSYjdH1pgzhVPIdHzRvsrnlFev 5Bj2AQwkPAF0iBt2V18aKzWOY/IpGFKuqxBhJETF+1hj+GkzVm1Oja0wCSXL3Mx19LMNsK A6IAUu71VQeAPgMh+SHU3vaFvLddWhU= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-269-W9_gAOmXOpeWCp6foq61ug-1; Tue, 04 Jan 2022 13:01:18 -0500 X-MC-Unique: W9_gAOmXOpeWCp6foq61ug-1 Received: by mail-yb1-f198.google.com with SMTP id b6-20020a256706000000b0060aa7315dd9so55153856ybc.9 for ; Tue, 04 Jan 2022 10:01:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uQZCqn7vW7btACW0qd4DDuttCuAUasRw0YpNM3TnA2Q=; b=dzLoUtNLKJtN1WyfHYlonvz9tEcdVZLboh/HdBjb+vr90fOmJtyE+jNMwP1JRoejnS /jIeU5fqOv8qFWcH46mJ7iYegTKsuoOsIE3m3EA0hvJ7iPYW/TS7SIftxgH+6P5CpptP pW2vz15yE3vs+7nfyv9CWI6QMCsQ6xcDqAETZ3ARkVgLDyOono47ahHt0AfPJmwiXAc9 /OjPauNzTHIm8Zbj1qEUsam/BbY2R/jwbqfrzn0S+F9ydxzM0ZQSrio+QxsI8CkRVrR6 oHivcU9ulztye+i2+eUxh54YuoGT+NUDNymD4oj2gY5twMUjytWaVG1i/MOItLVL6qvu WeLw== X-Gm-Message-State: AOAM530gOJMWa6dOvWUJgqQfnVNSm8NwsxvEvS7Qv0RupVprit9oClhg gs6RaZ49pF7kgvybNS/w31KNHX9h4DAVqiG5d11je0WcfxP8zDdxyBIzgmHbkJtpwQRvEV5P7dg vAMw/UCb2iDw4XBY84TJufXkeYC41ENg= X-Received: by 2002:a25:d711:: with SMTP id o17mr47607606ybg.689.1641319276233; Tue, 04 Jan 2022 10:01:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2ii0b2ySNzPQm+fJkFr9H54ng3v5aW8NBTcH/VW+Npdeh0vSQfOT6mkjEQQXljeAvYM41biktfxtPKEyLgQY= X-Received: by 2002:a25:d711:: with SMTP id o17mr47607586ybg.689.1641319276052; Tue, 04 Jan 2022 10:01:16 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jeff Johnston Date: Tue, 4 Jan 2022 13:01:05 -0500 Message-ID: Subject: Re: correctly rounded mathematical functions To: joel@rtems.org Cc: Paul Zimmermann , Newlib , christoph.lauter@christoph-lauter.org, Jean-Michel.Muller@ens-lyon.fr, sibid@uvic.ca Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jjohnstn@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jan 2022 18:01:24 -0000 See below. On Tue, Jan 4, 2022 at 10:23 AM Joel Sherrill wrote: > On Tue, Jan 4, 2022 at 3:44 AM Paul Zimmermann > wrote: > > > > Dear Joel, > > > > thank you for your answer. > > > > > From: Joel Sherrill > > > Date: Mon, 3 Jan 2022 14:41:20 -0600 > > > > > > On Mon, Jan 3, 2022 at 6:58 AM Paul Zimmermann < > Paul.Zimmermann@inria.fr> wrote: > > > > > > > > Dear Newlib developers, > > > > > > > > the current C working draft [1, p392] has reserved names for > correctly > > > > rounded functions (cr_exp, cr_log, cr_sin, ...). > > > > > > > > We propose to provide such correctly rounded implementations > > > > for the three IEEE formats (binary32, binary64, binary128) and the > > > > "extended double" format (long double on x86_64). > > > > > > > > These implementations will be correctly rounded for all rounding > modes, > > > > for example one could do the following to emulate interval > arithmetic: > > > > > > > > fesetround (FE_DOWNWARD); > > > > y_lo = cr_exp (x_lo); > > > > fesetround (FE_UPWARD); > > > > y_hi = cr_exp (x_hi); > > > > > > > > Users who want a fast implementation will call the exp/log/sin/... > functions, > > > > users who want a correctly rounded function and thus reproducible > results > > > > (whatever the hardware, compiler or operating system) will use the > > > > cr_exp/cr_log/cr_sin/... functions. Our goal is nevertheless to get > the > > > > best performance possible. > > > > > > > > Our objective is to provide open-source implementations that can be > integrated > > > > in the major mathematical libraries (GNU libc, Intel Math Library, > AMD Libm, > > > > Redhat Newlib, OpenLibm, Musl, llvm-libc, CUDA, ROCm). > > > > > > > > Are developers of Newlib interested by such functions? > > > > If so, we could discuss what would be the requirements for > integration in > > > > Newlib in terms of license, table size, allowed operations. > > > > > > Speaking from the RTEMS perspective, we are very interested > > > in the addition of more POSIX and C Standard Library methods. > > > We have been having GSoC students add them where possible > > > for a few years. > > > > great! > > > > > The license has to be permissive and should have no advertising > > > although based on COPYING.NEWLIB, some must have a BSD > > > advertising clause still. Possibly those need review. > > > > > > > https://sourceware.org/git/?p=newlib-cygwin.git;a=blob_plain;f=COPYING.NEWLIB;hb=HEAD > > > > since some Newlib files are already under LGPL v3+, for example > > include/cgen/basic-ops.h, I guess the current > > license we have (LGPL v3+) should be ok for Newlib. > > I think those files are all under a linux/ or rdos/ subdirectory and do not > impact any other target unless they use iconvdata/. I grep'ed and didn't > see anything else. Jeff or Corrina should speak up and provide a > definitive answer. > > Shared newlib code cannot have an LGPL license. Our Linux code is for a shared library and uses code from glibc (including depending on glibc headers) so it is permitted, but the code is not shared with other platforms. > > As long as the method's footprint only impacts applications that use > > > it, there shouldn't be a huge concern on size but the target domain is > > > mostly smaller single process, no-MMU embedded systems. That is > > > ignoring Cygwin which has fewer constraints. If you end up adding > > > megabytes, that's going to be bad in general. > > > > we'll try to have reasonable table sizes. And maybe for some functions > > we'll provide several implementations, with different table sizes. > > Great! It's hard to comment on size without something to complain about. :) > > > > > We have started to work on two functions (cbrt and acos), for which > we > > > > provide presumably correctly rounded implementations (up to the > knowledge > > > > of hard-to-round cases) [2]. > > > > > > Great! What's the size profile on those? > > > > the binary32 cbrt code is quite small: > > > > -rw-r--r-- 1 zimmerma caramba 2766 Dec 23 14:27 cbrtf.c > > > > the binary128 code is larger: > > > > -rw-r--r-- 1 zimmerma caramba 38450 Dec 22 18:06 cbrtf128-v2.patch > > How is binary128 implemented on target CPUs without native support? > Is this something GCC will include soft methods for? > > > > What's the minimum compiler or C language version to build these? > > > > good question. So far we work with current gcc versions (for example > 11.2.0) > > but did not exercise with older version. We don't use advanced C feature, > > except the "glibc patches" use some GNU libc macros (for example > mul_split > > to split the product of two doubles into a+b, fast_two_sum, ...). > > I didn't expect anything too fancy. Will they compile with -std=c99, c11? > newlib > generally provides all methods but the header file guards protect the > prototype > visibility. > > glibc specific macros can be reimplemented. I assume that's going to be an > issue on other non-glibc libraries. Hopefully that's not too hard to deal > with. > > --joel > > > Best regards, > > Paul > >