Changeset View
Changeset View
Standalone View
Standalone View
articles/building-products/article.xml
Context not available. | |||||
<para>FreeBSD traces its roots back nearly twenty years to the | <para>FreeBSD traces its roots back nearly twenty years to the | ||||
work of the Computer Science Research Group at the | work of the Computer Science Research Group at the | ||||
University of California Berkeley.<footnote> | University of California Berkeley.<footnote> | ||||
<simpara>FreeBSD's <link xlink:href="http://cvsweb.freebsd.org/">source | <simpara>FreeBSD's <link xlink:href="http://svnweb.freebsd.org/">source | ||||
repository</link> contains a history of the project | repository</link> contains a history of the project | ||||
since its inception, and there are <link xlink:href="http://www.mckusick.com/csrg/">CDROMs | since its inception, and there are <link xlink:href="http://www.mckusick.com/csrg/">CDROMs | ||||
available</link> that contain earlier code from the | available</link> that contain earlier code from the | ||||
Context not available. | |||||
<figure xml:id="fig-change-log"> | <figure xml:id="fig-change-log"> | ||||
<title>A sample change log entry</title> | <title>A sample change log entry</title> | ||||
<programlisting> | <programlisting> | ||||
bde 2005-10-29 16:34:50 UTC | r151864 | bde | 2005-10-29 09:34:50 -0700 (Sat, 29 Oct 2005) | 13 lines | ||||
Changed paths: | |||||
M /head/lib/msun/src/e_rem_pio2f.c | |||||
FreeBSD src repository | Use double precision to simplify and optimize arg reduction for small | ||||
and medium size args too: instead of conditionally subtracting a float | |||||
17+24, 17+17+24 or 17+17+17+24 bit approximation to pi/2, always | |||||
subtract a double 33+53 bit one. The float version is now closer to | |||||
the double version than to old versions of itself -- it uses the same | |||||
33+53 bit approximation as the simplest cases in the double version, | |||||
and where the float version had to switch to the slow general case at | |||||
|x| == 2^7*pi/2, it now switches at |x| == 2^19*pi/2 the same as the | |||||
double version. | |||||
Modified files: | This speeds up arg reduction by a factor of 2 for |x| between 3*pi/4 and | ||||
lib/msun/src e_rem_pio2f.c | 2^7*pi/4, and by a factor of 7 for |x| between 2^7*pi/4 and 2^19*pi/4. | ||||
Log: | |||||
Use double precision to simplify and optimize arg reduction for small | |||||
and medium size args too: instead of conditionally subtracting a float | |||||
17+24, 17+17+24 or 17+17+17+24 bit approximation to pi/2, always | |||||
subtract a double 33+53 bit one. The float version is now closer to | |||||
the double version than to old versions of itself — it uses the same | |||||
33+53 bit approximation as the simplest cases in the double version, | |||||
and where the float version had to switch to the slow general case at | |||||
|x| == 2^7*pi/2, it now switches at |x| == 2^19*pi/2 the same as the | |||||
double version. | |||||
This speeds up arg reduction by a factor of 2 for |x| between 3*pi/4 and | |||||
2^7*pi/4, and by a factor of 7 for |x| between 2^7*pi/4 and 2^19*pi/4. | |||||
Revision Changes Path | |||||
1.14 +22 -97 src/lib/msun/src/e_rem_pio2f.c | |||||
</programlisting> | </programlisting> | ||||
</figure> | </figure> | ||||
Context not available. | |||||
FreeBSD. For example:</para> | FreeBSD. For example:</para> | ||||
<formalpara> | <formalpara> | ||||
<title>Track FreeBSD source code</title> | <title>Track FreeBSD source code</title> | ||||
<para>The project makes it easy to mirror its CVS | <para>The project makes it easy to mirror its SVN | ||||
repository using <link xlink:href="&url.articles.cvsup-advanced;"><!-- | repository using <link xlink:href="&url.articles.committers-guide;/subversion-primer.html#svn-advanced-use-setting-up-svnsync"><!-- | ||||
--><application>CVSup</application></link>. Having | --><application>svnsync</application></link>. Having | ||||
the complete history of the source is useful when | the complete history of the source is useful when | ||||
debugging complex problems and offers valuable insight | debugging complex problems and offers valuable insight | ||||
into the intentions of the original developers. Use a | into the intentions of the original developers. Use a | ||||
Context not available. | |||||
easily merge changes between the upstream FreeBSD code | easily merge changes between the upstream FreeBSD code | ||||
base and your own in-house code.</para> | base and your own in-house code.</para> | ||||
</formalpara> | </formalpara> | ||||
<para><xref linkend="fig-cvs-annotate"/> shows a portion of | <para><xref linkend="fig-svn-blame"/> shows a portion of | ||||
an annotated listing of the file referenced by the | an annotated listing of the file referenced by the | ||||
change log in <xref linkend="fig-change-log"/>. The | change log in <xref linkend="fig-change-log"/>. The | ||||
ancestry of each line of the source is clearly visible. | ancestry of each line of the source is clearly visible. | ||||
Annotated listings showing the history of every file | Annotated listings showing the history of every file | ||||
that is part of FreeBSD are <link xlink:href="http://cvsweb.freebsd.org/">available on the | that is part of FreeBSD are <link xlink:href="http://svnweb.freebsd.org/">available on the | ||||
web</link>.</para> | web</link>.</para> | ||||
<figure xml:id="fig-cvs-annotate"> | <figure xml:id="fig-svn-blame"> | ||||
<title>An annotated source listing generated using <command>cvs annotate</command></title> | <title>An annotated source listing generated using <command>svn blame</command></title> | ||||
<programlisting> | <programlisting> | ||||
<![CDATA[ | <![CDATA[ | ||||
#LINE #REV #WHO #DATE #TEXT | #REV #WHO #DATE #TEXT | ||||
62 1.1 (jkh 19-Aug-94): int32_t __ieee754_rem_pio2f(float x, float *y) | 176410 bde 2008-02-19 07:42:46 -0800 (Tue, 19 Feb 2008) #include <sys/cdefs.h> | ||||
63 1.1 (jkh 19-Aug-94): { | 176410 bde 2008-02-19 07:42:46 -0800 (Tue, 19 Feb 2008) __FBSDID("$FreeBSD$"); | ||||
64 1.14 (bde 29-Oct-05): double z,w,t,r,fn; | 2116 jkh 1994-08-19 02:40:01 -0700 (Fri, 19 Aug 1994) | ||||
65 1.13 (bde 29-Oct-05): double tx[3]; | 2116 jkh 1994-08-19 02:40:01 -0700 (Fri, 19 Aug 1994) /* __ieee754_rem_pio2f(x,y) | ||||
66 1.14 (bde 29-Oct-05): int32_t e0,i,nx,n,ix,hx; | 8870 rgrimes 1995-05-29 22:51:47 -0700 (Mon, 29 May 1995) * | ||||
67 1.1 (jkh 19-Aug-94): | 176552 bde 2008-02-25 05:33:20 -0800 (Mon, 25 Feb 2008) * return the remainder of x rem pi/2 in *y | ||||
68 1.1 (jkh 19-Aug-94): GET_FLOAT_WORD(hx,x); | 176552 bde 2008-02-25 05:33:20 -0800 (Mon, 25 Feb 2008) * use double precision for everything except passing x | ||||
69 1.1 (jkh 19-Aug-94): ix = hx&0x7fffffff; | 152535 bde 2005-11-16 18:20:04 -0800 (Wed, 16 Nov 2005) * use __kernel_rem_pio2() for large x | ||||
70 1.1 (jkh 19-Aug-94): if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ | 2116 jkh 1994-08-19 02:40:01 -0700 (Fri, 19 Aug 1994) */ | ||||
71 1.1 (jkh 19-Aug-94): {y[0] = x; y[1] = 0; return 0;} | 2116 jkh 1994-08-19 02:40:01 -0700 (Fri, 19 Aug 1994) | ||||
72 1.14 (bde 29-Oct-05): /* 33+53 bit pi is good enough for special and medium size cases */ | 176465 bde 2008-02-22 07:55:14 -0800 (Fri, 22 Feb 2008) #include <float.h> | ||||
73 1.2 (bde 07-Apr-95): if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ | 176465 bde 2008-02-22 07:55:14 -0800 (Fri, 22 Feb 2008) | ||||
74 1.14 (bde 29-Oct-05): if(hx>0) { | 2116 jkh 1994-08-19 02:40:01 -0700 (Fri, 19 Aug 1994) #include "math.h" | ||||
75 1.15 (bde 06-Nov-05): z = x - pio2; | |||||
76 1.15 (bde 06-Nov-05): n = 1; | |||||
77 1.15 (bde 06-Nov-05): } else { | |||||
78 1.15 (bde 06-Nov-05): z = x + pio2; | |||||
79 1.15 (bde 06-Nov-05): n = 3; | |||||
80 1.9 (bde 08-Oct-05): } | |||||
81 1.15 (bde 06-Nov-05): y[0] = z; | |||||
82 1.15 (bde 06-Nov-05): y[1] = z - y[0]; | |||||
83 1.15 (bde 06-Nov-05): return n; | |||||
84 1.15 (bde 06-Nov-05): } | |||||
85 1.15 (bde 06-Nov-05): if(ix<0x407b53d1) { /* |x| < 5*pi/4, special case with n=+-2 */ | |||||
]]> | ]]> | ||||
</programlisting> | </programlisting> | ||||
</figure> | </figure> | ||||
Context not available. |