亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? quad_float.txt

?? NTL is a high-performance, portable C++ library providing data structures and algorithms for manipul
?? TXT
字號:


/**************************************************************************\

MODULE: quad_float

SUMMARY:

The class quad_float is used to represent quadruple precision numbers.
Thus, with standard IEEE floating point, you should get the equivalent
of about 106 bits of precision (but actually just a bit less).

The interface allows you to treat quad_floats more or less as if they were
"ordinary" floating point types.

See below for more implementation details.


\**************************************************************************/

#include <NTL/ZZ.h>


class quad_float {
public:

quad_float(); // = 0

quad_float(const quad_float& a);  // copy constructor

quad_float& operator=(const quad_float& a);  // assignment operator
quad_float& operator=(double a);

~quad_float();


static void SetOutputPrecision(long p);
// This sets the number of decimal digits to be output.  Default is
// 10.


static long OutputPrecision();
// returns current output precision.


};


/**************************************************************************\

                             Arithmetic Operations

\**************************************************************************/




quad_float operator +(const quad_float& x, const quad_float& y);
quad_float operator -(const quad_float& x, const quad_float& y);
quad_float operator *(const quad_float& x, const quad_float& y);
quad_float operator /(const quad_float& x, const quad_float& y);


// PROMOTIONS: operators +, -, *, / promote double to quad_float
// on (x, y).

quad_float operator -(const quad_float& x);

quad_float& operator += (quad_float& x, const quad_float& y);
quad_float& operator += (quad_float& x, double y);

quad_float& operator -= (quad_float& x, const quad_float& y);
quad_float& operator -= (quad_float& x, double y);

quad_float& operator *= (quad_float& x, const quad_float& y);
quad_float& operator *= (quad_float& x, double y);

quad_float& operator /= (quad_float& x, const quad_float& y);
quad_float& operator /= (quad_float& x, double y);

quad_float& operator++(quad_float& a); // prefix
void operator++(quad_float& a, int); // postfix

quad_float& operator--(quad_float& a); // prefix
void operator--(quad_float& a, int); // postfix



/**************************************************************************\

                                  Comparison

\**************************************************************************/


long operator> (const quad_float& x, const quad_float& y);
long operator>=(const quad_float& x, const quad_float& y);
long operator< (const quad_float& x, const quad_float& y);
long operator<=(const quad_float& x, const quad_float& y);
long operator==(const quad_float& x, const quad_float& y);
long operator!=(const quad_float& x, const quad_float& y);

long sign(const quad_float& x);  // sign of x, -1, 0, +1
long compare(const quad_float& x, const quad_float& y); // sign of x - y

// PROMOTIONS: operators >, ..., != and function compare
// promote double to quad_float on (x, y).


/**************************************************************************\

                               Input/Output
Input Syntax:

<number>: [ "-" ] <unsigned-number>
<unsigned-number>: <dotted-number> [ <e-part> ] | <e-part>
<dotted-number>: <digits> | <digits> "." <digits> | "." <digits> | <digits> "."
<digits>: <digit> <digits> | <digit>
<digit>: "0" | ... | "9"
<e-part>: ( "E" | "e" ) [ "+" | "-" ] <digits>

Examples of valid input:

17 1.5 0.5 .5  5.  -.5 e10 e-10 e+10 1.5e10 .5e10 .5E10

Note that the number of decimal digits of precision that are used
for output can be set to any number p >= 1 by calling
the routine quad_float::SetOutputPrecision(p).  
The default value of p is 10.
The current value of p is returned by a call to quad_float::OutputPrecision().



\**************************************************************************/


istream& operator >> (istream& s, quad_float& x);
ostream& operator << (ostream& s, const quad_float& x);


/**************************************************************************\

                                  Miscellaneous

\**************************************************************************/



quad_float sqrt(const quad_float& x);
quad_float floor(const quad_float& x);
quad_float ceil(const quad_float& x);
quad_float trunc(const quad_float& x);
quad_float fabs(const quad_float& x);
quad_float exp(const quad_float& x);
quad_float log(const quad_float& x);


void power(quad_float& x, const quad_float& a, long e); // x = a^e
quad_float power(const quad_float& a, long e); 

void power2(quad_float& x, long e); // x = 2^e
quad_float power2_quad_float(long e); 

quad_float ldexp(const quad_float& x, long e);  // return x*2^e

long IsFinite(quad_float *x); // checks if x is "finite"   
                              // pointer is used for compatability with
                              // IsFinite(double*)


void random(quad_float& x);
quad_float random_quad_float();
// generate a random quad_float x with 0 <= x <= 1





/***********************************************************************\

IMPLEMENTATION DETAILS

A quad_float x is represented as a pair of doubles, x.hi and x.lo,
such that the number represented by x is x.hi + x.lo, where

   |x.lo| <= 0.5*ulp(x.hi),  (*)

and ulp(y) means "unit in the last place of y".  

For the software to work correctly, IEEE Standard Arithmetic is sufficient.  
That includes just about every modern computer; the only exception I'm
aware of is Intel x86 platforms running Linux (but you can still
use this platform--see below).

Also sufficient is any platform that implements arithmetic with correct 
rounding, i.e., given double floating point numbers a and b, a op b 
is computed exactly and then rounded to the nearest double.  
The tie-breaking rule is not important.

This is a rather wierd representation;  although it gives one
essentially twice the precision of an ordinary double, it is
not really the equivalent of quadratic precision (despite the name).
For example, the number 1 + 2^{-200} can be represented exactly as
a quad_float.  Also, there is no real notion of "machine precision".

Note that overflow/underflow for quad_floats does not follow any particularly
useful rules, even if the underlying floating point arithmetic is IEEE
compliant.  Generally, when an overflow/underflow occurs, the resulting value
is unpredicatble, although typically when overflow occurs in computing a value
x, the result is non-finite (i.e., IsFinite(&x) == 0).  Note, however, that
some care is taken to ensure that the ZZ to quad_float conversion routine
produces a non-finite value upon overflow.

THE INTEL x86 PROBLEM

Although just about every modern processor implements the IEEE
floating point standard, there still can be problems
on processors that support IEEE extended double precision.
The only processor I know of that supports this is the x86/Pentium.

While extended double precision may sound like a nice thing,
it is not.  Normal double precision has 53 bits of precision.
Extended has 64.  On x86s, the FP registers have 53 or 64 bits
of precision---this can be set at run-time by modifying
the cpu "control word" (something that can be done
only in assembly code).
However, doubles stored in memory always have only 53 bits.
Compilers may move values between memory and registers
whenever they want, which can effectively change the value
of a floating point number even though at the C/C++ level,
nothing has happened that should have changed the value.
Is that sick, or what?
Actually, the new C99 standard seems to outlaw such "spontaneous"
value changes; however, this behavior is not necessarily
universally implemented.

This is a real headache, and if one is not just a bit careful,
the quad_float code will break.  This breaking is not at all subtle,
and the program QuadTest will catch the problem if it exists.

You should not need to worry about any of this, because NTL automatically
detects and works around these problems as best it can, as described below.
It shouldn't make a mistake, but if it does, you will
catch it in the QuadTest program.
If things don't work quite right, you might try
setting NTL_FIX_X86 or NTL_NO_FIX_X86 flags in ntl_config.h,
but this should not be necessary.

Here are the details about how NTL fixes the problem.

The first and best way is to have the default setting of the control word
be 53 bits.  However, you are at the mercy of your platform
(compiler, OS, run-time libraries).  Windows does this,
and so the problem simply does not arise here, and NTL neither
detects nor fixes the problem.  Linux, however, does not do this,
which really sucks.  Can we talk these Linux people into changing this?

The second way to fix the problem is by having NTL 
fiddle with control word itself.  If you compile NTL using a GNU compiler
on an x86, this should happen automatically.
On the one hand, this is not a general, portable solution,
since it will only work if you use a GNU compiler, or at least one that
supports GNU 'asm' syntax.  
On the other hand, almost everybody who compiles C++ on x86/Linux
platforms uses GNU compilers (although there are some commercial
compilers out there that I don't know too much about).

The third way to fix the problem is to 'force' all intermediate
floating point results into memory.  This is not an 'ideal' fix,
since it is not fully equivalent to 53-bit precision (because of 
double rounding), but it works (although to be honest, I've never seen
a full proof of correctness in this case).
NTL's quad_float code does this by storing intermediate results
in local variables declared to be 'volatile'.
This is the solution to the problem that NTL uses if it detects
the problem and can't fix it using the GNU 'asm' hack mentioned above.
This solution should work on any platform that faithfully
implements 'volatile' according to the ANSI C standard.



BACKGROUND INFO

The code NTL uses algorithms designed by Knuth, Kahan, Dekker, and
Linnainmaa.  The original transcription to C++ was done by Douglas
Priest.  Enhancements and bug fixes were done by Keith Briggs
(http://epidem13.plantsci.cam.ac.uk/~kbriggs).  The NTL version is a
stripped down version of Briggs' code, with a couple of bug fixes and
portability improvements.  Briggs has continued to develop his
library;  see his web page above for the latest version and more information.

Here is a brief annotated bibliography (compiled by Priest) of papers 
dealing with DP and similar techniques, arranged chronologically.

Kahan, W., Further Remarks on Reducing Truncation Errors,
  {\it Comm.\ ACM\/} {\bf 8} (1965), 40.

M{\o}ller, O., Quasi Double Precision in Floating-Point Addition,
  {\it BIT\/} {\bf 5} (1965), 37--50.

  The two papers that first presented the idea of recovering the
  roundoff of a sum.

Dekker, T., A Floating-Point Technique for Extending the Available
  Precision, {\it Numer.\ Math.} {\bf 18} (1971), 224--242.

  The classic reference for DP algorithms for sum, product, quotient,
  and square root.

Pichat, M., Correction d'une Somme en Arithmetique \`a Virgule
  Flottante, {\it Numer.\ Math.} {\bf 19} (1972), 400--406.

  An iterative algorithm for computing a protracted sum to working
  precision by repeatedly applying the sum-and-roundoff method.

Linnainmaa, S., Analysis of Some Known Methods of Improving the Accuracy
  of Floating-Point Sums, {\it BIT\/} {\bf 14} (1974), 167--202.

  Comparison of Kahan and M{\o}ller algorithms with variations given
  by Knuth.

Bohlender, G., Floating-Point Computation of Functions with Maximum
  Accuracy, {\it IEEE Trans.\ Comput.} {\bf C-26} (1977), 621--632.

  Extended the analysis of Pichat's algorithm to compute a multi-word
  representation of the exact sum of n working precision numbers.
  This is the algorithm Kahan has called "distillation".

Linnainmaa, S., Software for Doubled-Precision Floating-Point Computations,
  {\it ACM Trans.\ Math.\ Soft.} {\bf 7} (1981), 272--283.

  Generalized the hypotheses of Dekker and showed how to take advantage
  of extended precision where available.

Leuprecht, H., and W.~Oberaigner, Parallel Algorithms for the Rounding-Exact
  Summation of Floating-Point Numbers, {\it Computing} {\bf 28} (1982), 89--104.

  Variations of distillation appropriate for parallel and vector
  architectures.

Kahan, W., Paradoxes in Concepts of Accuracy, lecture notes from Joint
  Seminar on Issues and Directions in Scientific Computation, Berkeley, 1989.

  Gives the more accurate DP sum I've shown above, discusses some
  examples.

Priest, D., Algorithms for Arbitrary Precision Floating Point Arithmetic,
  in P.~Kornerup and D.~Matula, Eds., {\it Proc.\ 10th Symposium on Com-
  puter Arithmetic}, IEEE Computer Society Press, Los Alamitos, Calif., 1991.

  Extends from DP to arbitrary precision; gives portable algorithms and
  general proofs.

Sorensen, D., and P.~Tang, On the Orthogonality of Eigenvectors Computed
  by Divide-and-Conquer Techniques, {\it SIAM J.\ Num.\ Anal.} {\bf 28}
  (1991), 1752--1775.

  Uses some DP arithmetic to retain orthogonality of eigenvectors
  computed by a parallel divide-and-conquer scheme.

Priest, D., On Properties of Floating Point Arithmetics: Numerical Stability
  and the Cost of Accurate Computations, Ph.D. dissertation, University
  of California at Berkeley, 1992.

  More examples, organizes proofs in terms of common properties of fp
  addition/subtraction, gives other summation algorithms.

\***********************************************************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲美女屁股眼交| 国产精品综合在线视频| 国产真实乱子伦精品视频| 色综合一个色综合亚洲| 精品处破学生在线二十三| 亚洲午夜久久久久中文字幕久| 国产精品资源在线观看| 日韩一区二区三区电影在线观看| 亚洲免费在线视频一区 二区| 欧美一区二区精美| 亚洲男人的天堂在线aⅴ视频| 韩国午夜理伦三级不卡影院| 69久久夜色精品国产69蝌蚪网| 亚洲色图欧美激情| 国产成人在线视频网站| 日韩精品一区二区三区中文不卡 | 亚洲精品中文字幕乱码三区 | 亚洲一卡二卡三卡四卡无卡久久| 国产成人鲁色资源国产91色综| 日韩免费看的电影| 丝瓜av网站精品一区二区| 色一情一伦一子一伦一区| 国产精品欧美一区喷水| 国产呦精品一区二区三区网站| 日韩亚洲国产中文字幕欧美| 亚洲成av人在线观看| 欧美性色黄大片| 亚洲人成在线播放网站岛国| jlzzjlzz亚洲日本少妇| 中文字幕亚洲不卡| av午夜精品一区二区三区| 国产精品久久毛片a| 成人黄色小视频| 国产精品欧美久久久久无广告| 国产成人精品影视| 国产调教视频一区| 99久久精品费精品国产一区二区| 国产亚洲欧美中文| 不卡电影免费在线播放一区| 国产精品久久久一本精品| 99久久国产综合色|国产精品| 最新国产の精品合集bt伙计| 91在线免费播放| 亚洲mv在线观看| 日韩欧美国产1| 国产成人精品一区二区三区四区 | 欧美激情中文不卡| 白白色 亚洲乱淫| 一区二区三区在线高清| 欧美日韩一级片在线观看| 日本亚洲欧美天堂免费| 久久久久久久精| 91网站在线观看视频| 午夜精品一区二区三区三上悠亚| 日韩午夜精品视频| 大白屁股一区二区视频| 一区二区三区中文字幕| 日韩亚洲电影在线| 成人av在线看| 亚洲国产人成综合网站| 欧美mv日韩mv| 色综合久久中文综合久久97| 日日摸夜夜添夜夜添亚洲女人| 久久精品在线观看| 欧美午夜宅男影院| 国产成人a级片| 亚洲一区中文日韩| 国产亚洲精久久久久久| 欧美丝袜自拍制服另类| 久久97超碰国产精品超碰| 亚洲欧洲日产国产综合网| 欧美乱熟臀69xxxxxx| 国产高清亚洲一区| 午夜av电影一区| 国产精品成人在线观看| 91麻豆精品国产91久久久| 不卡视频免费播放| 麻豆中文一区二区| 亚洲与欧洲av电影| 国产日韩欧美a| 欧美一区二区日韩| 91电影在线观看| 丁香天五香天堂综合| 日韩中文欧美在线| 一区二区三区欧美| 中文字幕乱码一区二区免费| 日韩午夜中文字幕| 久久奇米777| 欧美日韩高清一区二区三区| 成人美女视频在线观看18| 久久电影网站中文字幕| 亚洲va天堂va国产va久| 亚洲人亚洲人成电影网站色| 国产亚洲欧美激情| 欧美成人一区二区三区片免费| 欧美三级韩国三级日本三斤| 91日韩在线专区| av网站一区二区三区| 国产一区二区在线视频| 精品在线观看免费| 日韩精品乱码免费| 午夜精品在线看| 亚洲国产精品久久久久秋霞影院| 亚洲欧美日韩一区二区三区在线观看 | 福利一区二区在线观看| 韩国一区二区在线观看| 寂寞少妇一区二区三区| 蜜桃视频一区二区| 美女性感视频久久| 久久国产尿小便嘘嘘尿| 美女网站色91| 激情综合一区二区三区| 韩国欧美国产1区| 国产精品99久| av电影天堂一区二区在线观看| 风间由美性色一区二区三区| 成人美女在线视频| 91在线视频播放| 欧美亚洲综合一区| 制服丝袜成人动漫| 日韩精品专区在线| 久久精品网站免费观看| 欧美高清在线一区二区| 亚洲欧洲无码一区二区三区| 亚洲三级在线看| 亚洲成人三级小说| 日本视频在线一区| 激情综合色综合久久| 国产成人亚洲精品青草天美| 91在线porny国产在线看| 在线观看日韩高清av| 91精品国产高清一区二区三区| 日韩美女一区二区三区| 国产精品区一区二区三区| 亚洲欧美国产高清| 亚洲成人免费在线观看| 久草热8精品视频在线观看| 国产精品亚洲成人| 91黄色免费观看| 日韩欧美综合在线| 中文字幕乱码亚洲精品一区| 亚洲综合视频网| 美国欧美日韩国产在线播放| 成人av片在线观看| 精品视频一区三区九区| 精品捆绑美女sm三区| 日韩码欧中文字| 麻豆国产精品一区二区三区| 成人污污视频在线观看| 欧美乱熟臀69xxxxxx| 中文字幕不卡的av| 性欧美疯狂xxxxbbbb| 成人深夜在线观看| 7777精品久久久大香线蕉| 国产精品国产三级国产专播品爱网 | 亚洲国产精品传媒在线观看| 亚洲一二三四久久| 国产精品69久久久久水密桃| 欧美网站大全在线观看| 久久久久久久综合色一本| 亚洲一区免费观看| 波多野洁衣一区| 日韩欧美一级特黄在线播放| 亚洲色欲色欲www| 国产精品一区不卡| 91精品国产免费| 一区二区三区在线观看视频 | 色视频欧美一区二区三区| 日韩一级免费观看| 亚洲国产人成综合网站| 99久久国产免费看| 国产拍欧美日韩视频二区| 免费成人在线观看视频| 欧美自拍偷拍一区| 亚洲美腿欧美偷拍| 国产91富婆露脸刺激对白| 日韩精品一区二区三区蜜臀| 午夜在线成人av| 欧美无砖砖区免费| 亚洲免费观看视频| av网站一区二区三区| 国产欧美精品一区aⅴ影院| 麻豆成人在线观看| 欧美一区二区在线不卡| 亚洲1区2区3区4区| 欧美午夜精品一区| 亚洲中国最大av网站| 色婷婷国产精品久久包臀| 中文字幕在线不卡视频| 大桥未久av一区二区三区中文| 久久久精品国产免大香伊 | 成人免费毛片片v| 久久久久久久综合| 国产伦精品一区二区三区在线观看 | 久久99精品网久久| 欧美zozozo| 国产一区二区不卡| 国产精品视频免费看| av中文字幕一区| 亚洲精品中文在线|