Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #14351

Re: Writing efficient normal distribution function (for learning purposes).

From 88888 Dihedral <dihedral88888@googlemail.com>
Newsgroups comp.lang.c++
Subject Re: Writing efficient normal distribution function (for learning purposes).
Date 2012-02-21 01:10 -0800
Organization http://groups.google.com
Message-ID <12671157.400.1329815451838.JavaMail.geo-discussion-forums@pbux2> (permalink)
References (5 earlier) <67abe3b8-4dbf-445d-bda9-d51864fe9584@pq6g2000pbc.googlegroups.com> <jhrs02$o2n$1@news-rocq.inria.fr> <4f421f54$0$2815$7b1e8fa0@news.nbl.fi> <4f42a7bf$0$14708$5fc3050@news.tiscali.nl> <4f4358aa$0$3083$7b1e8fa0@news.nbl.fi>

Show all headers | View raw


Juha Nieminen於 2012年2月21日星期二UTC+8下午4時41分14秒寫道:
> Dombo <dombo@disposable.invalid> wrote:
> > Now SSE instructions (which do not have 80-bit registers) are commonly 
> > used for floating point math on x86 platforms I'm not quite sure how 
> > this settings would affect floating point math.
> 
>   As someone pointed out, something like this:
> 
>     x = a / c;
>     y = b / c;
> 
> does not (usually) give the *exact* same result as:
> 
>     tmp = 1 / c;
>     x = a * tmp;
>     y = b * tmp;
> 
>   The difference will happen in the few least-significant bits of the
> mantissa (iow. somewhere around the 15th least-significant digit with
> doubles), which is extremely small, but might count in some rare
> circumstances.
> 
>   The latter, however, is often faster than the former (because floating
> point multiplication will usually be something like 1 clock cycle while
> division will be a dozen or so).



Juha Nieminen於 2012年2月21日星期二UTC+8下午4時41分14秒寫道:
> Dombo <dombo@disposable.invalid> wrote:
> > Now SSE instructions (which do not have 80-bit registers) are commonly 
> > used for floating point math on x86 platforms I'm not quite sure how 
> > this settings would affect floating point math.
> 
>   As someone pointed out, something like this:
> 
>     x = a / c;
>     y = b / c;
> 
> does not (usually) give the *exact* same result as:
> 
>     tmp = 1 / c;

tmp is trucated for finite precision here, 
if err(tmp, tru(1/c)) *a affects the tail bits of a*tmp, 
then the result is different from a/c computed 
by a float or double instruction
 
 
>     x = a * tmp;
>     y = b * tmp;
> 
>   The difference will happen in the few least-significant bits of the
> mantissa (iow. somewhere around the 15th least-significant digit with
> doubles), which is extremely small, but might count in some rare
> circumstances.
> 
>   The latter, however, is often faster than the former (because floating
> point multiplication will usually be something like 1 clock cycle while
> division will be a dozen or so).

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Writing efficient normal distribution function (for learning purposes). Luca Cerone <luca.cerone@gmail.com> - 2012-02-17 07:41 -0800
  Re: Writing efficient normal distribution function (for learning purposes). "Asger Joergensen" <Junk@Asger-P.dk> - 2012-02-17 16:45 +0000
    Re: Writing efficient normal distribution function (for learning purposes). lucacerone <luca.cerone@gmail.com> - 2012-02-17 09:36 -0800
      Re: Writing efficient normal distribution function (for learning purposes). "Asger Joergensen" <Junk@Asger-P.dk> - 2012-02-17 17:50 +0000
        Re: Writing efficient normal distribution function (for learning purposes). lucacerone <luca.cerone@gmail.com> - 2012-02-19 01:59 -0800
          Re: Writing efficient normal distribution function (for learning purposes). lucacerone <luca.cerone@gmail.com> - 2012-02-19 02:49 -0800
            Re: Writing efficient normal distribution function (for learning purposes). "Asger Joergensen" <Junk@Asger-P.dk> - 2012-02-19 11:53 +0000
            Re: Writing efficient normal distribution function (for learning purposes). Miles Bader <miles@gnu.org> - 2012-02-19 23:09 +0900
              Re: Writing efficient normal distribution function (for learning purposes). Joshua Maurice <joshuamaurice@gmail.com> - 2012-02-19 13:34 -0800
                Re: Writing efficient normal distribution function (for learning purposes). Marc <marc.glisse@gmail.com> - 2012-02-19 22:10 +0000
                Re: Writing efficient normal distribution function (for learning purposes). Miles Bader <miles@gnu.org> - 2012-02-20 09:14 +0900
                Re: Writing efficient normal distribution function (for learning purposes). Juha Nieminen <nospam@thanks.invalid> - 2012-02-20 10:24 +0000
                Re: Writing efficient normal distribution function (for learning purposes). Miles Bader <miles@gnu.org> - 2012-02-20 19:57 +0900
                Re: Writing efficient normal distribution function (for learning purposes). Dombo <dombo@disposable.invalid> - 2012-02-20 21:07 +0100
                Re: Writing efficient normal distribution function (for learning purposes). Juha Nieminen <nospam@thanks.invalid> - 2012-02-21 08:41 +0000
                Re: Writing efficient normal distribution function (for learning purposes). 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-21 01:10 -0800
                Re: Writing efficient normal distribution function (for learning purposes). Miles Bader <miles@gnu.org> - 2012-02-20 09:04 +0900
              Re: Writing efficient normal distribution function (for learning purposes). lucacerone <luca.cerone@gmail.com> - 2012-02-20 02:26 -0800
    Re: Writing efficient normal distribution function (for learning purposes). Juha Nieminen <nospam@thanks.invalid> - 2012-02-17 20:42 +0000
      Re: Writing efficient normal distribution function (for learning purposes). "Asger Joergensen" <Junk@Asger-P.dk> - 2012-02-17 22:20 +0000
  Re: Writing efficient normal distribution function (for learning purposes). Juha Nieminen <nospam@thanks.invalid> - 2012-02-17 20:52 +0000
  Re: Writing efficient normal distribution function (for learning purposes). Victor Bazarov <v.bazarov@comcast.invalid> - 2012-02-17 15:57 -0500
  Re: Writing efficient normal distribution function (for learning purposes). Joshua Maurice <joshuamaurice@gmail.com> - 2012-02-17 15:01 -0800
    Re: Writing efficient normal distribution function (for learning purposes). Victor Bazarov <v.bazarov@comcast.invalid> - 2012-02-18 08:44 -0500
      Re: Writing efficient normal distribution function (for learning purposes). Paavo Helde <myfirstname@osa.pri.ee> - 2012-02-18 09:20 -0600
  Re: Writing efficient normal distribution function (for learning purposes). Paavo Helde <myfirstname@osa.pri.ee> - 2012-02-18 09:36 -0600
    Re: Writing efficient normal distribution function (for learning purposes). glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-02-18 20:19 +0000
      Re: Writing efficient normal distribution function (for learning purposes). Miles Bader <miles@gnu.org> - 2012-02-19 10:32 +0900
  Re: Writing efficient normal distribution function (for learning purposes). lucacerone <luca.cerone@gmail.com> - 2012-02-20 02:36 -0800
  Re: Writing efficient normal distribution function (for learning purposes). gwowen <gwowen@gmail.com> - 2012-02-20 06:48 -0800
    Re: Writing efficient normal distribution function (for learning purposes). lucacerone <luca.cerone@gmail.com> - 2012-02-21 04:32 -0800

csiph-web