From owner-freebsd-numerics@FreeBSD.ORG Sun Aug 12 22:37:39 2012 Return-Path: Delivered-To: freebsd-numerics@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F5D7106566B for ; Sun, 12 Aug 2012 22:37:39 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au [122.100.2.194]) by mx1.freebsd.org (Postfix) with ESMTP id CDE2A8FC08 for ; Sun, 12 Aug 2012 22:37:38 +0000 (UTC) Received: from server.rulingia.com (c220-239-249-137.belrs5.nsw.optusnet.com.au [220.239.249.137]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id q7CMbcuM075423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 13 Aug 2012 08:37:38 +1000 (EST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.14.5/8.14.5) with ESMTP id q7CMbVlX020584 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 13 Aug 2012 08:37:31 +1000 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.5/8.14.5/Submit) id q7CMbV2c020583 for freebsd-numerics@freebsd.org; Mon, 13 Aug 2012 08:37:31 +1000 (EST) (envelope-from peter) Resent-From: Peter Jeremy Resent-Date: Mon, 13 Aug 2012 08:37:31 +1000 Resent-Message-ID: <20120812223731.GD20453@server.rulingia.com> Resent-To: freebsd-numerics@freebsd.org Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au [122.100.2.194]) by server.rulingia.com (8.14.5/8.14.5) with ESMTP id q6H4CXQW070041 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Jul 2012 14:12:33 +1000 (EST) (envelope-from imp@bsdimp.com) Received: from mail-gg0-f177.google.com (mail-gg0-f177.google.com [209.85.161.177]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id q6H4CUhu065892 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 17 Jul 2012 14:12:33 +1000 (EST) (envelope-from imp@bsdimp.com) Received: by ggcs5 with SMTP id s5so6243697ggc.36 for ; Mon, 16 Jul 2012 21:12:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=kINev5HP/nExsHpfB9JvNN+ucoEDgSZ4ULGnyl+tuSk=; b=mCZdIPUcoCX+xklQV1FoKB8lIDnXqs8H1UM3OPPufSr7Q2LvSOXX649QcapRFk7QTk PfjVj6EtPKlfZHhmWPNfTMjSaMgFDyjI9vq5xcirH4RTW4WN0WSBF4DLepfG0D1IJ9MK QpZBkLqTScvFsl/Xz04vwdnMPrXbiidHlJ3c88ByXglXtJriu6EON/uBjCVdUMDjHQ+r O1AQJaem/7o0ksLgOuvznkfh/Z4Er94CnEPy1FjdJBc/YcLaXpntm0+VKdypaIzpCsgu ggY5oYG9DA7277bIWrDzEzzGwN+MjnyQdIUUXfllO3XQ5llhuMD/WTUwZZ3vDkZjjrPa YJUw== Received: by 10.66.76.231 with SMTP id n7mr1970636paw.68.1342498343866; Mon, 16 Jul 2012 21:12:23 -0700 (PDT) Received: from [172.16.1.217] ([4.53.41.66]) by mx.google.com with ESMTPS id ot4sm13181996pbb.65.2012.07.16.21.12.22 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jul 2012 21:12:23 -0700 (PDT) Sender: Warner Losh Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <20120717040118.GA86840@troutmask.apl.washington.edu> Message-Id: <6F750F84-34FF-4961-A2EA-F3E67A6872AE@bsdimp.com> References: <20120711223247.GA9964@troutmask.apl.washington.edu> <20120713114100.GB83006@server.rulingia.com> <201207130818.38535.jhb@freebsd.org> <9EB2DA4F-19D7-4BA5-8811-D9451CB1D907@theravensnest.org> <20120713155805.GC81965@zim.MIT.EDU> <20120714120432.GA70706@server.rulingia.com> <20120717084457.U3890@besplex.bde.org> <5004A5C7.1040405@missouri.edu> <5004DEA9.1050001@missouri.edu> <20120717040118.GA86840@troutmask.apl.washington.edu> To: Steve Kargl X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQkGeHx4TgLmtguEy3nTXwlADeCEh75sl1lGJfgjth/HEmzfarhzj0KBE9kd8wm6EjB5ADvp Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by server.rulingia.com id q6H4CXQW070041 Cc: Diane Bruce , John Baldwin , David Chisnall , Stephen Montgomery-Smith , Bruce Evans , Bruce Evans , David Schultz , Peter Jeremy Subject: Re: Use of C99 extra long double math functions after r236148 X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussions of high quality implementation of libm functions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Sun, 12 Aug 2012 22:37:39 -0000 X-Original-Date: Mon, 16 Jul 2012 22:12:21 -0600 X-List-Received-Date: Sun, 12 Aug 2012 22:37:39 -0000 On Jul 16, 2012, at 10:01 PM, Steve Kargl wrote: > On Mon, Jul 16, 2012 at 10:40:25PM -0500, Stephen Montgomery-Smith wrote: >> >> I came up with pseudo code that looks a bit like this. >> >> complex casinh(complex z) { >> double x = z.re, y = z.im; >> >> if (y==0) >> return asinh(x); >> if (x==0) { >> if (fabs(y)<=1) return I*asin(y); >> else return signum(y)* ( >> log(fabs(y)+sqrt(y*y-1)) >> + I*PI/2); > > Stop. Please see msun/src/math_private.h. You cannot > use I in any expression. gcc in base and clang do not > do the arithmetic correctly. See msun/src/s_ccosh.c > for how one might approach writing these functions. > Also, consult n1256.pdf for x,y = +-0, +-inf, nan. > There are specific requirements that must be met. Yes. Pseudo code is OK for following the flow, but look at the exp code for why that's not entirely sufficient. You have to be extremely fussy about all kinds of things. Then again, exp is a lot more important to get right than the complex trig functions... The pseudo code is a good place to start, but it just the barest start in the integration process... Warner