
(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 12 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 (fma (/ (- t z) (- a z)) y x))
double code(double x, double y, double z, double t, double a) {
return fma(((t - z) / (a - z)), y, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(t - z) / Float64(a - z)), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{t - z}{a - z}, y, x\right)
\end{array}
Initial program 88.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6498.8
Applied rewrites98.8%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y (- a z)) (- t z))) (t_2 (/ (* (- t z) y) (- a z)))) (if (<= t_2 -1e+24) t_1 (if (<= t_2 2e+74) (fma (/ z (- z a)) y x) 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) / (a - z);
double tmp;
if (t_2 <= -1e+24) {
tmp = t_1;
} else if (t_2 <= 2e+74) {
tmp = fma((z / (z - a)), y, x);
} 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(Float64(t - z) * y) / Float64(a - z)) tmp = 0.0 if (t_2 <= -1e+24) tmp = t_1; elseif (t_2 <= 2e+74) tmp = fma(Float64(z / Float64(z - a)), y, x); else tmp = t_1; end return 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[(N[(t - z), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+24], t$95$1, If[LessEqual[t$95$2, 2e+74], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - z} \cdot \left(t - z\right)\\
t_2 := \frac{\left(t - z\right) \cdot y}{a - z}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -9.9999999999999998e23 or 1.9999999999999999e74 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 72.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6483.6
Applied rewrites83.6%
if -9.9999999999999998e23 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.9999999999999999e74Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6495.8
Applied rewrites95.8%
Final simplification90.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e-12)
(+ x y)
(if (<= z -1.85e-77)
(fma (/ (- t) z) y x)
(if (<= z 7e+41) (fma (- t z) (/ y a) x) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e-12) {
tmp = x + y;
} else if (z <= -1.85e-77) {
tmp = fma((-t / z), y, x);
} else if (z <= 7e+41) {
tmp = fma((t - z), (y / a), x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e-12) tmp = Float64(x + y); elseif (z <= -1.85e-77) tmp = fma(Float64(Float64(-t) / z), y, x); elseif (z <= 7e+41) tmp = fma(Float64(t - z), Float64(y / a), x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e-12], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.85e-77], N[(N[((-t) / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 7e+41], N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-12}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{z}, y, x\right)\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(t - z, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.9999999999999997e-12 or 6.9999999999999998e41 < z Initial program 77.5%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6483.0
Applied rewrites83.0%
if -4.9999999999999997e-12 < z < -1.84999999999999998e-77Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
Taylor expanded in z around 0
Applied rewrites76.1%
if -1.84999999999999998e-77 < z < 6.9999999999999998e41Initial program 96.7%
Taylor expanded in a around inf
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
unsub-negN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
lower--.f6484.6
Applied rewrites84.6%
Applied rewrites85.3%
Final simplification83.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e-12)
(+ x y)
(if (<= z -1.85e-77)
(fma (/ (- t) z) y x)
(if (<= z 5.2e-15) (fma (/ y a) t x) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e-12) {
tmp = x + y;
} else if (z <= -1.85e-77) {
tmp = fma((-t / z), y, x);
} else if (z <= 5.2e-15) {
tmp = fma((y / a), t, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e-12) tmp = Float64(x + y); elseif (z <= -1.85e-77) tmp = fma(Float64(Float64(-t) / z), y, x); elseif (z <= 5.2e-15) 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, -5e-12], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.85e-77], N[(N[((-t) / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 5.2e-15], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-12}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{z}, y, x\right)\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.9999999999999997e-12 or 5.20000000000000009e-15 < z Initial program 78.8%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6481.7
Applied rewrites81.7%
if -4.9999999999999997e-12 < z < -1.84999999999999998e-77Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
Taylor expanded in z around 0
Applied rewrites76.1%
if -1.84999999999999998e-77 < z < 5.20000000000000009e-15Initial program 96.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.0
Applied rewrites84.0%
Final simplification82.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4e-12)
(+ x y)
(if (<= z -4e-50)
(* (/ (- z t) z) y)
(if (<= z 5.2e-15) (fma (/ y a) t x) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4e-12) {
tmp = x + y;
} else if (z <= -4e-50) {
tmp = ((z - t) / z) * y;
} else if (z <= 5.2e-15) {
tmp = fma((y / a), t, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4e-12) tmp = Float64(x + y); elseif (z <= -4e-50) tmp = Float64(Float64(Float64(z - t) / z) * y); elseif (z <= 5.2e-15) 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, -4e-12], N[(x + y), $MachinePrecision], If[LessEqual[z, -4e-50], N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 5.2e-15], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-12}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-50}:\\
\;\;\;\;\frac{z - t}{z} \cdot y\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.99999999999999992e-12 or 5.20000000000000009e-15 < z Initial program 78.8%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6481.7
Applied rewrites81.7%
if -3.99999999999999992e-12 < z < -4.00000000000000003e-50Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6483.9
Applied rewrites83.9%
Taylor expanded in a around 0
Applied rewrites75.9%
if -4.00000000000000003e-50 < z < 5.20000000000000009e-15Initial program 96.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.8
Applied rewrites82.8%
Final simplification81.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- z t) z) y x))) (if (<= z -3.1e-53) t_1 (if (<= z 1.4e+41) (fma (- t z) (/ y a) 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 <= -3.1e-53) {
tmp = t_1;
} else if (z <= 1.4e+41) {
tmp = fma((t - z), (y / a), 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 <= -3.1e-53) tmp = t_1; elseif (z <= 1.4e+41) tmp = fma(Float64(t - z), Float64(y / a), 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, -3.1e-53], t$95$1, If[LessEqual[z, 1.4e+41], N[(N[(t - z), $MachinePrecision] * N[(y / a), $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.1 \cdot 10^{-53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(t - z, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.10000000000000015e-53 or 1.4e41 < z Initial program 79.6%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6488.1
Applied rewrites88.1%
if -3.10000000000000015e-53 < z < 1.4e41Initial program 96.9%
Taylor expanded in a around inf
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
unsub-negN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
lower--.f6484.0
Applied rewrites84.0%
Applied rewrites84.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z (- z a)) y x))) (if (<= z -3.3e-51) t_1 (if (<= z 7e-21) (fma (- t z) (/ y a) 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 <= -3.3e-51) {
tmp = t_1;
} else if (z <= 7e-21) {
tmp = fma((t - z), (y / a), 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 <= -3.3e-51) tmp = t_1; elseif (z <= 7e-21) tmp = fma(Float64(t - z), Float64(y / a), 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, -3.3e-51], t$95$1, If[LessEqual[z, 7e-21], N[(N[(t - z), $MachinePrecision] * N[(y / a), $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 -3.3 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(t - z, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.29999999999999973e-51 or 7.0000000000000007e-21 < z Initial program 80.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6486.1
Applied rewrites86.1%
if -3.29999999999999973e-51 < z < 7.0000000000000007e-21Initial program 96.7%
Taylor expanded in a around inf
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
unsub-negN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
lower--.f6484.7
Applied rewrites84.7%
Applied rewrites85.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.7e-50) (+ x y) (if (<= z 5.2e-15) (fma (/ y a) t x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.7e-50) {
tmp = x + y;
} else if (z <= 5.2e-15) {
tmp = fma((y / a), t, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.7e-50) tmp = Float64(x + y); elseif (z <= 5.2e-15) 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, -1.7e-50], N[(x + y), $MachinePrecision], If[LessEqual[z, 5.2e-15], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-50}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.70000000000000007e-50 or 5.20000000000000009e-15 < z Initial program 80.6%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6477.6
Applied rewrites77.6%
if -1.70000000000000007e-50 < z < 5.20000000000000009e-15Initial program 96.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.8
Applied rewrites82.8%
Final simplification80.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.1e-183) (+ x y) (if (<= z 3.3e-305) (/ (* y t) a) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e-183) {
tmp = x + y;
} else if (z <= 3.3e-305) {
tmp = (y * t) / a;
} 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 <= (-2.1d-183)) then
tmp = x + y
else if (z <= 3.3d-305) then
tmp = (y * t) / a
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 <= -2.1e-183) {
tmp = x + y;
} else if (z <= 3.3e-305) {
tmp = (y * t) / a;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.1e-183: tmp = x + y elif z <= 3.3e-305: tmp = (y * t) / a else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e-183) tmp = Float64(x + y); elseif (z <= 3.3e-305) tmp = Float64(Float64(y * t) / a); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.1e-183) tmp = x + y; elseif (z <= 3.3e-305) tmp = (y * t) / a; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e-183], N[(x + y), $MachinePrecision], If[LessEqual[z, 3.3e-305], N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-183}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-305}:\\
\;\;\;\;\frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.1000000000000002e-183 or 3.29999999999999982e-305 < z Initial program 86.4%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6466.9
Applied rewrites66.9%
if -2.1000000000000002e-183 < z < 3.29999999999999982e-305Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.2
Applied rewrites97.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6494.0
Applied rewrites94.0%
Taylor expanded in x around 0
Applied rewrites62.3%
Final simplification66.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.1e-183) (+ x y) (if (<= z 3.3e-305) (* (/ y a) t) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e-183) {
tmp = x + y;
} else if (z <= 3.3e-305) {
tmp = (y / a) * t;
} 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 <= (-2.1d-183)) then
tmp = x + y
else if (z <= 3.3d-305) then
tmp = (y / a) * t
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 <= -2.1e-183) {
tmp = x + y;
} else if (z <= 3.3e-305) {
tmp = (y / a) * t;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.1e-183: tmp = x + y elif z <= 3.3e-305: tmp = (y / a) * t else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e-183) tmp = Float64(x + y); elseif (z <= 3.3e-305) tmp = Float64(Float64(y / a) * t); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.1e-183) tmp = x + y; elseif (z <= 3.3e-305) tmp = (y / a) * t; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e-183], N[(x + y), $MachinePrecision], If[LessEqual[z, 3.3e-305], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-183}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-305}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.1000000000000002e-183 or 3.29999999999999982e-305 < z Initial program 86.4%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6466.9
Applied rewrites66.9%
if -2.1000000000000002e-183 < z < 3.29999999999999982e-305Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.2
Applied rewrites97.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6494.0
Applied rewrites94.0%
Taylor expanded in x around 0
Applied rewrites62.3%
Taylor expanded in x around 0
Applied rewrites62.2%
Final simplification66.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.1e-183) (+ x y) (if (<= z 3.3e-305) (* (/ t a) y) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e-183) {
tmp = x + y;
} else if (z <= 3.3e-305) {
tmp = (t / a) * y;
} 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 <= (-2.1d-183)) then
tmp = x + y
else if (z <= 3.3d-305) then
tmp = (t / a) * y
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 <= -2.1e-183) {
tmp = x + y;
} else if (z <= 3.3e-305) {
tmp = (t / a) * y;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.1e-183: tmp = x + y elif z <= 3.3e-305: tmp = (t / a) * y else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e-183) tmp = Float64(x + y); elseif (z <= 3.3e-305) tmp = Float64(Float64(t / a) * y); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.1e-183) tmp = x + y; elseif (z <= 3.3e-305) tmp = (t / a) * y; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e-183], N[(x + y), $MachinePrecision], If[LessEqual[z, 3.3e-305], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-183}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-305}:\\
\;\;\;\;\frac{t}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.1000000000000002e-183 or 3.29999999999999982e-305 < z Initial program 86.4%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6466.9
Applied rewrites66.9%
if -2.1000000000000002e-183 < z < 3.29999999999999982e-305Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.2
Applied rewrites97.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6494.0
Applied rewrites94.0%
Taylor expanded in x around 0
Applied rewrites62.3%
Applied rewrites59.5%
Final simplification65.9%
(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 88.2%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6460.6
Applied rewrites60.6%
Final simplification60.6%
(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 2024298
(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))))