(afaik freebsd and openbsd use double precision by default)
<p>
So x = a+b may give different results depending on
(afaik freebsd and openbsd use double precision by default)
<p>
So x = a+b may give different results depending on
(only happens in round to nearest rounding mode,
but that's the most common one)
<p>
(only happens in round to nearest rounding mode,
but that's the most common one)
<p>
C99 annex F prohibits double rounding,
but that's non-normative.
C99 annex F prohibits double rounding,
but that's non-normative.
precision: the compiler may store intermediate
results and round them to double while keep
other parts in higher precision.
precision: the compiler may store intermediate
results and round them to double while keep
other parts in higher precision.
are kept in different precision.
(This is not an x87 specific problem, it matters whenever there
is a higher precision fp type than the currently used one.
are kept in different precision.
(This is not an x87 specific problem, it matters whenever there
is a higher precision fp type than the currently used one.
when a result is stored in a variable or a
type cast is used, then it is guaranteed that
the precision is appropriate to that type.
when a result is stored in a variable or a
type cast is used, then it is guaranteed that
the precision is appropriate to that type.
C99 actually allows most of these optimizations
but they can be turned off with STDC pragmas (see
<a href="http://repo.or.cz/w/c-standard.git/blob_plain/HEAD:/n1256.html#6.10.6">6.10.6</a>).
C99 actually allows most of these optimizations
but they can be turned off with STDC pragmas (see
<a href="http://repo.or.cz/w/c-standard.git/blob_plain/HEAD:/n1256.html#6.10.6">6.10.6</a>).
<p>
FENV_ACCESS ON tells the compiler that the code wants
to access the floating point environment (eg. set different rounding mode)
<p>
FENV_ACCESS ON tells the compiler that the code wants
to access the floating point environment (eg. set different rounding mode)
-With gcc x*I turns into (x+0*I)*(0+I) = 0*x + x*I,
-so if x=inf then the result is nan+inf*I instead of inf*I
+gcc turns
+<pre>
+x*I
+</pre>
+into
+<pre>
+(x+0*I)*(0+I) = 0*x + x*I
+</pre>
+So if x=inf then the result is nan+inf*I instead of inf*I
<p>
So a+b*I cannot be used to create complex numbers,
instead some double[2] manipulation should be used to
<p>
So a+b*I cannot be used to create complex numbers,
instead some double[2] manipulation should be used to