
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ 1.0 (/ (/ (- a z) y) (- z t)))))
(t_2 (* (- t z) y))
(t_3 (/ t_2 (- a z))))
(if (<= t_3 (- INFINITY))
t_1
(if (<= t_3 5e+286) (- x (/ t_2 (- z a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (1.0 / (((a - z) / y) / (z - t)));
double t_2 = (t - z) * y;
double t_3 = t_2 / (a - z);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_3 <= 5e+286) {
tmp = x - (t_2 / (z - a));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - (1.0 / (((a - z) / y) / (z - t)));
double t_2 = (t - z) * y;
double t_3 = t_2 / (a - z);
double tmp;
if (t_3 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_3 <= 5e+286) {
tmp = x - (t_2 / (z - a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (1.0 / (((a - z) / y) / (z - t))) t_2 = (t - z) * y t_3 = t_2 / (a - z) tmp = 0 if t_3 <= -math.inf: tmp = t_1 elif t_3 <= 5e+286: tmp = x - (t_2 / (z - a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(1.0 / Float64(Float64(Float64(a - z) / y) / Float64(z - t)))) t_2 = Float64(Float64(t - z) * y) t_3 = Float64(t_2 / Float64(a - z)) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_1; elseif (t_3 <= 5e+286) tmp = Float64(x - Float64(t_2 / Float64(z - a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (1.0 / (((a - z) / y) / (z - t))); t_2 = (t - z) * y; t_3 = t_2 / (a - z); tmp = 0.0; if (t_3 <= -Inf) tmp = t_1; elseif (t_3 <= 5e+286) tmp = x - (t_2 / (z - a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(1.0 / N[(N[(N[(a - z), $MachinePrecision] / y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$1, If[LessEqual[t$95$3, 5e+286], N[(x - N[(t$95$2 / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{1}{\frac{\frac{a - z}{y}}{z - t}}\\
t_2 := \left(t - z\right) \cdot y\\
t_3 := \frac{t\_2}{a - z}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;x - \frac{t\_2}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 5.0000000000000004e286 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 36.8%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 5.0000000000000004e286Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- t z) y)) (t_2 (/ t_1 (- a z))))
(if (<= t_2 (- INFINITY))
(fma (* (/ y x) x) (/ (- t z) (- a z)) x)
(if (<= t_2 5e+286) (- x (/ t_1 (- z a))) (* (/ y (- a z)) (- t z))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) * y;
double t_2 = t_1 / (a - z);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(((y / x) * x), ((t - z) / (a - z)), x);
} else if (t_2 <= 5e+286) {
tmp = x - (t_1 / (z - a));
} else {
tmp = (y / (a - z)) * (t - z);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) * y) t_2 = Float64(t_1 / Float64(a - z)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(Float64(y / x) * x), Float64(Float64(t - z) / Float64(a - z)), x); elseif (t_2 <= 5e+286) tmp = Float64(x - Float64(t_1 / Float64(z - a))); else tmp = Float64(Float64(y / Float64(a - z)) * Float64(t - z)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 5e+286], N[(x - N[(t$95$1 / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - z\right) \cdot y\\
t_2 := \frac{t\_1}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot x, \frac{t - z}{a - z}, x\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;x - \frac{t\_1}{z - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - z} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0Initial program 40.4%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
times-fracN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6491.3
Applied rewrites91.3%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 5.0000000000000004e286Initial program 99.8%
if 5.0000000000000004e286 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 34.4%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6490.8
Applied rewrites90.8%
Final simplification97.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y (- a z)) (- t z)))
(t_2 (* (- t z) y))
(t_3 (/ t_2 (- a z))))
(if (<= t_3 (- INFINITY))
t_1
(if (<= t_3 5e+286) (- x (/ t_2 (- z a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (a - z)) * (t - z);
double t_2 = (t - z) * y;
double t_3 = t_2 / (a - z);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_3 <= 5e+286) {
tmp = x - (t_2 / (z - a));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (a - z)) * (t - z);
double t_2 = (t - z) * y;
double t_3 = t_2 / (a - z);
double tmp;
if (t_3 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_3 <= 5e+286) {
tmp = x - (t_2 / (z - a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / (a - z)) * (t - z) t_2 = (t - z) * y t_3 = t_2 / (a - z) tmp = 0 if t_3 <= -math.inf: tmp = t_1 elif t_3 <= 5e+286: tmp = x - (t_2 / (z - a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(a - z)) * Float64(t - z)) t_2 = Float64(Float64(t - z) * y) t_3 = Float64(t_2 / Float64(a - z)) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_1; elseif (t_3 <= 5e+286) tmp = Float64(x - Float64(t_2 / Float64(z - a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / (a - z)) * (t - z); t_2 = (t - z) * y; t_3 = t_2 / (a - z); tmp = 0.0; if (t_3 <= -Inf) tmp = t_1; elseif (t_3 <= 5e+286) tmp = x - (t_2 / (z - a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$1, If[LessEqual[t$95$3, 5e+286], N[(x - N[(t$95$2 / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - z} \cdot \left(t - z\right)\\
t_2 := \left(t - z\right) \cdot y\\
t_3 := \frac{t\_2}{a - z}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;x - \frac{t\_2}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 5.0000000000000004e286 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 36.8%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6489.3
Applied rewrites89.3%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 5.0000000000000004e286Initial program 99.8%
Final simplification97.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -8.5e+61)
(+ x y)
(if (<= z -0.00062)
(* (/ y z) (- z t))
(if (<= z 2.2e-12) (+ (* (/ y a) t) x) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.5e+61) {
tmp = x + y;
} else if (z <= -0.00062) {
tmp = (y / z) * (z - t);
} else if (z <= 2.2e-12) {
tmp = ((y / a) * t) + x;
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-8.5d+61)) then
tmp = x + y
else if (z <= (-0.00062d0)) then
tmp = (y / z) * (z - t)
else if (z <= 2.2d-12) then
tmp = ((y / a) * t) + x
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.5e+61) {
tmp = x + y;
} else if (z <= -0.00062) {
tmp = (y / z) * (z - t);
} else if (z <= 2.2e-12) {
tmp = ((y / a) * t) + x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8.5e+61: tmp = x + y elif z <= -0.00062: tmp = (y / z) * (z - t) elif z <= 2.2e-12: tmp = ((y / a) * t) + x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.5e+61) tmp = Float64(x + y); elseif (z <= -0.00062) tmp = Float64(Float64(y / z) * Float64(z - t)); elseif (z <= 2.2e-12) tmp = Float64(Float64(Float64(y / a) * t) + x); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -8.5e+61) tmp = x + y; elseif (z <= -0.00062) tmp = (y / z) * (z - t); elseif (z <= 2.2e-12) tmp = ((y / a) * t) + x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.5e+61], N[(x + y), $MachinePrecision], If[LessEqual[z, -0.00062], N[(N[(y / z), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-12], N[(N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+61}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -0.00062:\\
\;\;\;\;\frac{y}{z} \cdot \left(z - t\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{y}{a} \cdot t + x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -8.50000000000000035e61 or 2.19999999999999992e-12 < z Initial program 78.5%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6481.4
Applied rewrites81.4%
if -8.50000000000000035e61 < z < -6.2e-4Initial program 83.2%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6487.4
Applied rewrites87.4%
Taylor expanded in a around 0
Applied rewrites76.1%
if -6.2e-4 < z < 2.19999999999999992e-12Initial program 93.8%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6475.4
Applied rewrites75.4%
Final simplification78.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -8.5e+61)
(+ x y)
(if (<= z -0.00062)
(* (/ y z) (- z t))
(if (<= z 2.2e-12) (fma (/ y a) t x) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.5e+61) {
tmp = x + y;
} else if (z <= -0.00062) {
tmp = (y / z) * (z - t);
} else if (z <= 2.2e-12) {
tmp = fma((y / a), t, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.5e+61) tmp = Float64(x + y); elseif (z <= -0.00062) tmp = Float64(Float64(y / z) * Float64(z - t)); elseif (z <= 2.2e-12) tmp = fma(Float64(y / a), t, x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.5e+61], N[(x + y), $MachinePrecision], If[LessEqual[z, -0.00062], N[(N[(y / z), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-12], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+61}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -0.00062:\\
\;\;\;\;\frac{y}{z} \cdot \left(z - t\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -8.50000000000000035e61 or 2.19999999999999992e-12 < z Initial program 78.5%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6481.4
Applied rewrites81.4%
if -8.50000000000000035e61 < z < -6.2e-4Initial program 83.2%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6487.4
Applied rewrites87.4%
Taylor expanded in a around 0
Applied rewrites76.1%
if -6.2e-4 < z < 2.19999999999999992e-12Initial program 93.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.4
Applied rewrites75.4%
Final simplification78.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- z t) z) y x))) (if (<= z -3e-119) t_1 (if (<= z 2.7e-138) (+ (* (/ (- t z) a) y) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - t) / z), y, x);
double tmp;
if (z <= -3e-119) {
tmp = t_1;
} else if (z <= 2.7e-138) {
tmp = (((t - z) / a) * y) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - t) / z), y, x) tmp = 0.0 if (z <= -3e-119) tmp = t_1; elseif (z <= 2.7e-138) tmp = Float64(Float64(Float64(Float64(t - z) / a) * y) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[z, -3e-119], t$95$1, If[LessEqual[z, 2.7e-138], N[(N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{if}\;z \leq -3 \cdot 10^{-119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-138}:\\
\;\;\;\;\frac{t - z}{a} \cdot y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.0000000000000002e-119 or 2.70000000000000029e-138 < z Initial program 83.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6484.1
Applied rewrites84.1%
if -3.0000000000000002e-119 < z < 2.70000000000000029e-138Initial program 92.3%
Taylor expanded in a around inf
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6489.9
Applied rewrites89.9%
Final simplification85.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- z t) z) y x))) (if (<= z -8.6e-122) t_1 (if (<= z 2.7e-138) (+ (* (/ y a) t) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - t) / z), y, x);
double tmp;
if (z <= -8.6e-122) {
tmp = t_1;
} else if (z <= 2.7e-138) {
tmp = ((y / a) * t) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - t) / z), y, x) tmp = 0.0 if (z <= -8.6e-122) tmp = t_1; elseif (z <= 2.7e-138) tmp = Float64(Float64(Float64(y / a) * t) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[z, -8.6e-122], t$95$1, If[LessEqual[z, 2.7e-138], N[(N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{if}\;z \leq -8.6 \cdot 10^{-122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{a} \cdot t + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.60000000000000037e-122 or 2.70000000000000029e-138 < z Initial program 83.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6484.1
Applied rewrites84.1%
if -8.60000000000000037e-122 < z < 2.70000000000000029e-138Initial program 92.3%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6494.3
Applied rewrites94.3%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.8
Applied rewrites86.8%
Final simplification84.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z (- z a)) y x))) (if (<= z -1.02e-118) t_1 (if (<= z 2.1e-120) (+ (* (/ y a) t) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / (z - a)), y, x);
double tmp;
if (z <= -1.02e-118) {
tmp = t_1;
} else if (z <= 2.1e-120) {
tmp = ((y / a) * t) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(z - a)), y, x) tmp = 0.0 if (z <= -1.02e-118) tmp = t_1; elseif (z <= 2.1e-120) tmp = Float64(Float64(Float64(y / a) * t) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[z, -1.02e-118], t$95$1, If[LessEqual[z, 2.1e-120], N[(N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{-118}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-120}:\\
\;\;\;\;\frac{y}{a} \cdot t + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.02e-118 or 2.1e-120 < z Initial program 83.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6477.3
Applied rewrites77.3%
if -1.02e-118 < z < 2.1e-120Initial program 91.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6494.6
Applied rewrites94.6%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6485.2
Applied rewrites85.2%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma z (/ y (- z a)) x))) (if (<= z -8.6e-122) t_1 (if (<= z 2.3e-118) (+ (* (/ y a) t) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(z, (y / (z - a)), x);
double tmp;
if (z <= -8.6e-122) {
tmp = t_1;
} else if (z <= 2.3e-118) {
tmp = ((y / a) * t) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(z, Float64(y / Float64(z - a)), x) tmp = 0.0 if (z <= -8.6e-122) tmp = t_1; elseif (z <= 2.3e-118) tmp = Float64(Float64(Float64(y / a) * t) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -8.6e-122], t$95$1, If[LessEqual[z, 2.3e-118], N[(N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y}{z - a}, x\right)\\
\mathbf{if}\;z \leq -8.6 \cdot 10^{-122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-118}:\\
\;\;\;\;\frac{y}{a} \cdot t + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.60000000000000037e-122 or 2.30000000000000021e-118 < z Initial program 83.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6477.6
Applied rewrites77.6%
Applied rewrites76.0%
if -8.60000000000000037e-122 < z < 2.30000000000000021e-118Initial program 91.8%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6494.1
Applied rewrites94.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.4
Applied rewrites84.4%
Final simplification78.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.6e-8) (+ x y) (if (<= z 2.2e-12) (fma (/ y a) t x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.6e-8) {
tmp = x + y;
} else if (z <= 2.2e-12) {
tmp = fma((y / a), t, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.6e-8) tmp = Float64(x + y); elseif (z <= 2.2e-12) tmp = fma(Float64(y / a), t, x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.6e-8], N[(x + y), $MachinePrecision], If[LessEqual[z, 2.2e-12], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{-8}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.6000000000000002e-8 or 2.19999999999999992e-12 < z Initial program 79.1%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6477.1
Applied rewrites77.1%
if -4.6000000000000002e-8 < z < 2.19999999999999992e-12Initial program 93.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.4
Applied rewrites75.4%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + y
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 86.3%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6462.5
Applied rewrites62.5%
Final simplification62.5%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2024277
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- z a) (- z t)))))
(+ x (/ (* y (- z t)) (- z a))))