Prev | Next |
exp_eps(x, epsilon)
with
x
is equal to .5
and
epsilon
is equal to .2.
For this case,
the mathematical form for the operation sequence
corresponding to the exp_eps
is
@[@
f( x , \varepsilon ) = 1 + x + x^2 / 2
@]@
Note that, for these particular values of
x
and
epsilon
,
this is the same as the mathematical form for
exp_2
.
x
is equal to .5
and
epsilon
is equal to .2.
x
and
epsilon
as variables.
x
or
epsilon
as parameters.
Operations where the result is a parameter are not included
in the zero order sweep below.
Index |
| Code |
| Operation |
| Zero Order |
1 |
|
abs_x = x;
| @(@ v_1 = x @)@ | @(@ v_1^{(0)} = 0.5 @)@ | ||
2 |
|
temp = term * abs_x;
| @(@ v_2 = 1 * v_1 @)@ | @(@ v_2^{(0)} = 0.5 @)@ | ||
3 |
|
term = temp / Type(k);
| @(@ v_3 = v_2 / 1 @)@ | @(@ v_3^{(0)} = 0.5 @)@ | ||
4 |
|
sum = sum + term;
| @(@ v_4 = 1 + v_3 @)@ | @(@ v_4^{(0)} = 1.5 @)@ | ||
5 |
|
temp = term * abs_x;
| @(@ v_5 = v_3 * v_1 @)@ | @(@ v_5^{(0)} = 0.25 @)@ | ||
6 |
|
term = temp / Type(k);
| @(@ v_6 = v_5 / 2 @)@ | @(@ v_6^{(0)} = 0.125 @)@ | ||
7 |
|
sum = sum + term;
| @(@ v_7 = v_4 + v_6 @)@ | @(@ v_7^{(0)} = 1.625 @)@ |
x
were negative,
or if
epsilon
were a much smaller or much larger value,
the results of the following comparisons could be different:
if( Type(0) > x )
while(term > epsilon)
This in turn would result in a different operation sequence.
Thus the operation sequence above only corresponds to
exp_eps.hpp
for values of
x
and
epsilon
within a certain range.
Note that there is a neighborhood
of @(@
x = 0.5
@)@ for which the comparisons would have the
same result and hence the operation sequence would be the same.