
(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 9 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 (+ (/ (/ y (- z a)) (/ 1.0 (- z t))) x))
(t_2 (/ (* (- z t) y) (- z a))))
(if (<= t_2 -4e+291) t_1 (if (<= t_2 2e+256) (+ x t_2) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / (z - a)) / (1.0 / (z - t))) + x;
double t_2 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -4e+291) {
tmp = t_1;
} else if (t_2 <= 2e+256) {
tmp = x + t_2;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((y / (z - a)) / (1.0d0 / (z - t))) + x
t_2 = ((z - t) * y) / (z - a)
if (t_2 <= (-4d+291)) then
tmp = t_1
else if (t_2 <= 2d+256) then
tmp = x + t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / (z - a)) / (1.0 / (z - t))) + x;
double t_2 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -4e+291) {
tmp = t_1;
} else if (t_2 <= 2e+256) {
tmp = x + t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / (z - a)) / (1.0 / (z - t))) + x t_2 = ((z - t) * y) / (z - a) tmp = 0 if t_2 <= -4e+291: tmp = t_1 elif t_2 <= 2e+256: tmp = x + t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / Float64(z - a)) / Float64(1.0 / Float64(z - t))) + x) t_2 = Float64(Float64(Float64(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_2 <= -4e+291) tmp = t_1; elseif (t_2 <= 2e+256) tmp = Float64(x + t_2); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / (z - a)) / (1.0 / (z - t))) + x; t_2 = ((z - t) * y) / (z - a); tmp = 0.0; if (t_2 <= -4e+291) tmp = t_1; elseif (t_2 <= 2e+256) tmp = x + t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+291], t$95$1, If[LessEqual[t$95$2, 2e+256], N[(x + t$95$2), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{y}{z - a}}{\frac{1}{z - t}} + x\\
t_2 := \frac{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+291}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;x + t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -3.9999999999999998e291 or 2.0000000000000001e256 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 41.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift--.f64N/A
flip--N/A
clear-numN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if -3.9999999999999998e291 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2.0000000000000001e256Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y (- z a)) (- z t))) (t_2 (/ (* (- z t) y) (- z a)))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 1e+236) (+ x t_2) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (z - a)) * (z - t);
double t_2 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+236) {
tmp = x + t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (z - a)) * (z - t);
double t_2 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 1e+236) {
tmp = x + t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / (z - a)) * (z - t) t_2 = ((z - t) * y) / (z - a) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 1e+236: tmp = x + t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(z - a)) * Float64(z - t)) t_2 = Float64(Float64(Float64(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+236) tmp = Float64(x + t_2); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / (z - a)) * (z - t); t_2 = ((z - t) * y) / (z - a); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 1e+236) tmp = x + t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+236], N[(x + t$95$2), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot \left(z - t\right)\\
t_2 := \frac{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+236}:\\
\;\;\;\;x + t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 1.00000000000000005e236 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 42.0%
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--.f6491.3
Applied rewrites91.3%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.00000000000000005e236Initial program 99.9%
Final simplification97.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y (- z a)) (- z t))) (t_2 (/ (* (- z t) y) (- z a)))) (if (<= t_2 -4e+33) t_1 (if (<= t_2 2e+145) (fma (/ z (- z a)) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (z - a)) * (z - t);
double t_2 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -4e+33) {
tmp = t_1;
} else if (t_2 <= 2e+145) {
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(z - a)) * Float64(z - t)) t_2 = Float64(Float64(Float64(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_2 <= -4e+33) tmp = t_1; elseif (t_2 <= 2e+145) 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[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+33], t$95$1, If[LessEqual[t$95$2, 2e+145], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot \left(z - t\right)\\
t_2 := \frac{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+145}:\\
\;\;\;\;\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)) < -3.9999999999999998e33 or 2e145 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 65.0%
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--.f6481.8
Applied rewrites81.8%
if -3.9999999999999998e33 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2e145Initial 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--.f6486.6
Applied rewrites86.6%
Final simplification84.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.5e-88)
(+ x y)
(if (<= z 3.9e-32)
(fma (/ y a) t x)
(if (<= z 7e+144) (fma (/ (- t) z) y x) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.5e-88) {
tmp = x + y;
} else if (z <= 3.9e-32) {
tmp = fma((y / a), t, x);
} else if (z <= 7e+144) {
tmp = fma((-t / z), y, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.5e-88) tmp = Float64(x + y); elseif (z <= 3.9e-32) tmp = fma(Float64(y / a), t, x); elseif (z <= 7e+144) tmp = fma(Float64(Float64(-t) / z), y, x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.5e-88], N[(x + y), $MachinePrecision], If[LessEqual[z, 3.9e-32], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 7e+144], N[(N[((-t) / z), $MachinePrecision] * y + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-88}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-32}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.49999999999999991e-88 or 6.9999999999999996e144 < z Initial program 74.7%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6476.3
Applied rewrites76.3%
if -4.49999999999999991e-88 < z < 3.9000000000000001e-32Initial program 94.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
if 3.9000000000000001e-32 < z < 6.9999999999999996e144Initial program 97.4%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6487.6
Applied rewrites87.6%
Taylor expanded in t around inf
Applied rewrites77.4%
Final simplification77.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.6e-92) (fma (/ z (- z a)) y x) (if (<= z 3e-79) (fma (/ y a) t x) (fma (/ (- z t) z) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e-92) {
tmp = fma((z / (z - a)), y, x);
} else if (z <= 3e-79) {
tmp = fma((y / a), t, x);
} else {
tmp = fma(((z - t) / z), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.6e-92) tmp = fma(Float64(z / Float64(z - a)), y, x); elseif (z <= 3e-79) tmp = fma(Float64(y / a), t, x); else tmp = fma(Float64(Float64(z - t) / z), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.6e-92], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 3e-79], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{-92}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-79}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\end{array}
\end{array}
if z < -3.60000000000000016e-92Initial program 82.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6482.4
Applied rewrites82.4%
if -3.60000000000000016e-92 < z < 3e-79Initial program 94.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
if 3e-79 < z Initial program 77.4%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6486.7
Applied rewrites86.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z (- z a)) y x))) (if (<= z -3.6e-92) t_1 (if (<= z 95000.0) (fma (/ 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 <= -3.6e-92) {
tmp = t_1;
} else if (z <= 95000.0) {
tmp = fma((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 <= -3.6e-92) tmp = t_1; elseif (z <= 95000.0) tmp = fma(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, -3.6e-92], t$95$1, If[LessEqual[z, 95000.0], N[(N[(y / a), $MachinePrecision] * t + 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.6 \cdot 10^{-92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 95000:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.60000000000000016e-92 or 95000 < z Initial program 79.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6483.4
Applied rewrites83.4%
if -3.60000000000000016e-92 < z < 95000Initial program 94.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.5e-88) (+ x y) (if (<= z 1.45e+19) (fma (/ y a) t x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.5e-88) {
tmp = x + y;
} else if (z <= 1.45e+19) {
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.5e-88) tmp = Float64(x + y); elseif (z <= 1.45e+19) 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.5e-88], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.45e+19], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-88}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.49999999999999991e-88 or 1.45e19 < z Initial program 78.3%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6474.7
Applied rewrites74.7%
if -4.49999999999999991e-88 < z < 1.45e19Initial program 94.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6478.2
Applied rewrites78.2%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (if (<= y 4.3e+206) (+ x y) (* (/ t a) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 4.3e+206) {
tmp = x + y;
} else {
tmp = (t / a) * 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 (y <= 4.3d+206) then
tmp = x + y
else
tmp = (t / a) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 4.3e+206) {
tmp = x + y;
} else {
tmp = (t / a) * y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 4.3e+206: tmp = x + y else: tmp = (t / a) * y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 4.3e+206) tmp = Float64(x + y); else tmp = Float64(Float64(t / a) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 4.3e+206) tmp = x + y; else tmp = (t / a) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 4.3e+206], N[(x + y), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{+206}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot y\\
\end{array}
\end{array}
if y < 4.29999999999999988e206Initial program 85.8%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6461.1
Applied rewrites61.1%
if 4.29999999999999988e206 < y Initial program 78.7%
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--.f6482.4
Applied rewrites82.4%
Taylor expanded in z around 0
Applied rewrites51.1%
Applied rewrites57.6%
Final simplification60.8%
(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 85.2%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6457.3
Applied rewrites57.3%
Final simplification57.3%
(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 2024254
(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))))