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 C323A3858412 for ; Mon, 14 Feb 2022 13:46:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C323A3858412 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=1644846364; h=from:from:reply-to: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=sxPGrIT61MFpm7lHumfuTd8dHoE+ivP8XUtdhCMWnN4=; b=KcwABU4DCPNWRmmUUpKkcGzm/iakVizNmdC+DYDEWSw/PZkWwRArluznU1m6XU8q2Wv4M0 bEVqYh3Q3GlTxzhhU6InLjSPJPihu/uqbz9Px1ZFVpDi+rZoCOH5LiO6CBooO7FfR8fWtk haxCTaiZM5y/aRSOla3UTT3bsiGmeX4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-401-h4E0k2lEOB6yIXkY6Pgkdw-1; Mon, 14 Feb 2022 08:46:03 -0500 X-MC-Unique: h4E0k2lEOB6yIXkY6Pgkdw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 282F6802924; Mon, 14 Feb 2022 13:46:02 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.36.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E991F2A18F; Mon, 14 Feb 2022 13:46:01 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 315B4A80D47; Mon, 14 Feb 2022 14:46:00 +0100 (CET) Date: Mon, 14 Feb 2022 14:46:00 +0100 From: Corinna Vinschen To: Andoni Arregi Cc: newlib@sourceware.org Subject: Re: [PATCH] Improve lgammaf range for very small cases Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: Andoni Arregi , newlib@sourceware.org References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=vinschen@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: Mon, 14 Feb 2022 13:46:06 -0000 On Feb 11 12:16, Andoni Arregi wrote: > The original cut for small arguments at |x|<2**-70 (copied from the > double version) produces that when computing nadj we get a subnormal > number for t*x and thus, the division of pi/subnormal will be INF and > the logarithm of it too, which is wrong as a result for lgammaf in this > range. > The proposed new limit seems to be safe and has been tested to > produce accurate results. > (Courtesy of Andreas Jung, ESA) > --- > newlib/libm/math/erf_lgamma.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/newlib/libm/math/erf_lgamma.c b/newlib/libm/math/erf_lgamma.c > index f88f63092..84d02159b 100644 > --- a/newlib/libm/math/erf_lgamma.c > +++ b/newlib/libm/math/erf_lgamma.c > @@ -168,7 +168,7 @@ static float zero= 0.0000000000e+00; > *signgamp = -1; > return one/(x-x); > } > - if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */ > + if(ix<0x30800000) { /* |x|<2**-30, return -log(|x|) */ > if(hx<0) { > *signgamp = -1; > return -__ieee754_logf(-x); > -- > 2.35.1 > Thanks, pushed. However, there's still something wrong with your patch file. In all lines with spaces following tabs, your patch is missing exactly one space. Please check this locally. Thanks, Corinna