From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/116260 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: luigi scarso via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: atan2 function Date: Fri, 14 Oct 2022 15:05:18 +0200 Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3041227013719094751==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39839"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luigi scarso To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Oct 14 15:06:04 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ojKO4-000A67-8g for gctc-ntg-context-518@m.gmane-mx.org; Fri, 14 Oct 2022 15:06:04 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 635082A45AD; Fri, 14 Oct 2022 15:05:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fGclLhNKJ1jw; Fri, 14 Oct 2022 15:05:38 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id A20122A45AF; Fri, 14 Oct 2022 15:05:38 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 0B6C62A45AF for ; Fri, 14 Oct 2022 15:05:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xcgPL3U_duGT for ; Fri, 14 Oct 2022 15:05:36 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.167.46; helo=mail-lf1-f46.google.com; envelope-from=luigi.scarso@gmail.com; receiver= Original-Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 979442A45AD for ; Fri, 14 Oct 2022 15:05:35 +0200 (CEST) Original-Received: by mail-lf1-f46.google.com with SMTP id d6so7082670lfs.10 for ; Fri, 14 Oct 2022 06:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=rCXOYdfITk6s4yHrBq0TQDVXl8Uu+3gdmxNiH2bqUug=; b=L84jsnpt2aMxVrYoWO7csKcClg6S3KwYrZ49IFyuV0TpveKpQScsbVoQsnPKr6WaMB ctZS/xm8DMAP053ztGK86eR8C2mTioDi/AtKe33gIR13QOJPz/vYnO9Hy6C17KkzWGmC 5Cf4QunsH3L+4TyRUdJxBcDBlXckkCXRyYjx9MdBF2NVt1kS9cjiJUgAHrlM9imQ8H8A zjt1A6Mw1GrxpgPW+kmLc3q6MOKQQfgmk7qxNaEiVRyYdfTZ28K0B4J1jBxt3gnu2tds muxc4y+J5Sm6nTLbYoygmf83bb15iKc7tQP2r1ENpgNah4uNcKr2Qpy8MNYtFvdMXNhq tewA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rCXOYdfITk6s4yHrBq0TQDVXl8Uu+3gdmxNiH2bqUug=; b=iGD10z/w9LEJHzQ0j0klk72oA3cQHnvHKcwiKJ8CowHabaw1Sm8f3AS0dJrivO0dKf 0wEa0ZVwtq1B+CiNZfBgBy35m8ountfvNsHSo+D+9jusueTGdknQ/KhkMA7jkHM8DHx6 lO6B/1209GPisKg+KzXxDL6i4ymd4LtIzqhS/uwbiJL7KRqcGBoASi0hQ92qTjlFjQ+a zachIRxnqM+IGdp+QNFxDORkrFFt/JWA10zGm1gzZreU/qtwDRo9C9m0wfdUYpIbzxmJ sVOXzX5PCv9yJOo1IGbN0C8INo69zPFapqQIvpLIDZ9uggUBrh3E01GH2ntsk+EiX1ch UxcA== X-Gm-Message-State: ACrzQf3I0+ferDqnsd3tQxTbTs+r1tupIlONIsy/gpxYX7LdDDGXW7bL /mOIYCa2fOtDjCytLDITulV2bj/ZMFUJR1NsDnhE4FcjH4U= X-Google-Smtp-Source: AMsMyM7nFUyy5aeVn7Xx1Aia6SZVft8u4dwKGHXRVHNUlLghZFQ6oAn0iKVrUwrafX6My1phftvjsbpLedzesPzPjDk= X-Received: by 2002:a05:6512:2354:b0:4a2:5004:5216 with SMTP id p20-20020a056512235400b004a250045216mr1703980lfu.481.1665752734499; Fri, 14 Oct 2022 06:05:34 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:116260 Archived-At: --===============3041227013719094751== Content-Type: multipart/alternative; boundary="0000000000000609f205eafe4807" --0000000000000609f205eafe4807 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 14 Oct 2022 at 14:58, Taco Hoekwater via ntg-context < ntg-context@ntg.nl> wrote: > > > > On 14 Oct 2022, at 14:26, Alan Braslau via ntg-context < > ntg-context@ntg.nl> wrote: > > > > Are you using MP in scaled integer or in doubleprecision mode? > > > > I have not looked into the MP angle operator code, but my suspicion is > that it is based on some super-clever John Hobby scheme optimized for > scaled integer calculations. > > The scaled version of =E2=80=9Cangle=E2=80=9D is a handwritten approximat= ion in web, not > using > any math library. I really doubt that that code is faster than calling > atan2() > on a modern machine, but I=E2=80=99ve kept it in because using a lib migh= t give > slightly > different results. > iirc, in metapost the whole scaled number system has no dependency from any external math library (I have not checked the lmtx source yet). --0000000000000609f205eafe4807 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, 14 Oct 2022 at 14:58, Taco Ho= ekwater via ntg-context <ntg-conte= xt@ntg.nl> wrote:


> On 14 Oct 2022, at 14:26, Alan Braslau via ntg-context <ntg-context@ntg.nl> wro= te:
>
> Are you using MP in scaled integer or in doubleprecision mode?
>
> I have not looked into the MP angle operator code, but my suspicion is= that it is based on some super-clever John Hobby scheme optimized for scal= ed integer calculations.

The scaled version of =E2=80=9Cangle=E2=80=9D is a handwritten approximatio= n in web, not using
any math library. I really doubt that that code is faster than calling atan= 2()
on a modern machine, but I=E2=80=99ve kept it in because using a lib might = give slightly
different results.

iirc, in metapost=C2= =A0 the whole scaled number system has no dependency=C2=A0 from any externa= l math library
(I have not checked the lmtx source yet).


--0000000000000609f205eafe4807-- --===============3041227013719094751== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cHM6Ly93d3cubnRnLm5sL21haWxtYW4v bGlzdGluZm8vbnRnLWNvbnRleHQKd2VicGFnZSAgOiBodHRwczovL3d3dy5wcmFnbWEtYWRlLm5s IC8gaHR0cDovL2NvbnRleHQuYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHBzOi8vYml0YnVja2V0 Lm9yZy9waGcvY29udGV4dC1taXJyb3IvY29tbWl0cy8Kd2lraSAgICAgOiBodHRwczovL2NvbnRl eHRnYXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============3041227013719094751==--