Alexey Beshenov on Sat, 19 Sep 2020 07:03:35 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Fortran compatibility
|
- To: Another Loco y ya <0xccaaffee@gmail.com>
- Subject: Re: Fortran compatibility
- From: Alexey Beshenov <alexey.beshenov@cimat.mx>
- Date: Sat, 19 Sep 2020 00:03:21 -0500
- Cc: pari-users@pari.math.u-bordeaux.fr
- Delivery-date: Sat, 19 Sep 2020 07:03:35 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cimat.mx; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=UlHMlXaytbZOHNWFd5RwJ9MwQovJFbY1gCTDX/MBH1Q=; b=ZkAH5IHROc1VRrY0yhEuo9hCjLpuRebJ9T86G5ezX9t+ZoD/lEtGX1evTB3I3UgH0Q 09mphwR8u3Hh7zYNipU26lnPbDqiLt6RaEVd/Z3XHJ38ImuVzEjnTN09l8rCvf98jYFa kni+baZq8fiuz5Y6ajp+qAD7NY6nlIOkTfJv8=
- In-reply-to: <CADVou1nxzsBL=0v=n0yoth2-3QWsSB8ip3y4U=Hsw7FrvphV-Q@mail.gmail.com>
- References: <bcc69ca9c69d4f039dc89938da3a40fe@liverpool.ac.uk> <20200916055133.GA27324@yellowpig> <f86f61c41efb4d99a82bb0f262a51cbe@liverpool.ac.uk> <20200918143947.GH28959@yellowpig> <20200918174936.GL28959@yellowpig> <CADVou1nxzsBL=0v=n0yoth2-3QWsSB8ip3y4U=Hsw7FrvphV-Q@mail.gmail.com>
Hello,
I think it's slightly off-topic :-)
There's a Wikipedia article with detailed explanations:
https://en.wikipedia.org/wiki/Fast_inverse_square_root
--
A
El vie., 18 sept. 2020 a las 23:23, Another Loco y ya
(<0xccaaffee@gmail.com>) escribió:
>
> Dear Bill, and friends here, have you ever seen it? this ( C? ) code:
>
> float InvSqrt (float x){
> float xhalf = 0.5f*x;
> int i = *(int*)&x;
> i = 0x5f3759df - (i>>1);
> x = *(float*)&i;
> x = x*(1.5f - xhalf*x*x);
> return x;
> }
>
> At some point of history, it is supposed to have been used widely for
> calculating the 1 / sqrt(x).
>
> i still wonder how it works, and inspired by the FORTRAN question you
> just solved, i thought this would be worthy of some contemplation...
> perhaps later. (At least me) Not hurried.
>
> :-) Merci