
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (* (- z t) (/ y (- a t))) x))
double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / (a - t))) + x;
}
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 = ((z - t) * (y / (a - t))) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / (a - t))) + x;
}
def code(x, y, z, t, a): return ((z - t) * (y / (a - t))) + x
function code(x, y, z, t, a) return Float64(Float64(Float64(z - t) * Float64(y / Float64(a - t))) + x) end
function tmp = code(x, y, z, t, a) tmp = ((z - t) * (y / (a - t))) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(z - t\right) \cdot \frac{y}{a - t} + x
\end{array}
Initial program 97.6%
*-commutative97.6%
div-inv97.5%
associate-*l*98.2%
Applied egg-rr98.2%
+-commutative98.2%
associate-*l/98.3%
*-un-lft-identity98.3%
Applied egg-rr98.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* z (/ y a)))) (t_2 (- x (* y (/ z t)))))
(if (<= t -6.5e+186)
(+ y x)
(if (<= t -1.75e+42)
t_2
(if (<= t -9e-15)
t_1
(if (<= t -4.7e-68)
t_2
(if (or (<= t -7.5e-83) (not (<= t 1350.0))) (+ y x) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z * (y / a));
double t_2 = x - (y * (z / t));
double tmp;
if (t <= -6.5e+186) {
tmp = y + x;
} else if (t <= -1.75e+42) {
tmp = t_2;
} else if (t <= -9e-15) {
tmp = t_1;
} else if (t <= -4.7e-68) {
tmp = t_2;
} else if ((t <= -7.5e-83) || !(t <= 1350.0)) {
tmp = y + x;
} 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 = x + (z * (y / a))
t_2 = x - (y * (z / t))
if (t <= (-6.5d+186)) then
tmp = y + x
else if (t <= (-1.75d+42)) then
tmp = t_2
else if (t <= (-9d-15)) then
tmp = t_1
else if (t <= (-4.7d-68)) then
tmp = t_2
else if ((t <= (-7.5d-83)) .or. (.not. (t <= 1350.0d0))) then
tmp = y + x
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 = x + (z * (y / a));
double t_2 = x - (y * (z / t));
double tmp;
if (t <= -6.5e+186) {
tmp = y + x;
} else if (t <= -1.75e+42) {
tmp = t_2;
} else if (t <= -9e-15) {
tmp = t_1;
} else if (t <= -4.7e-68) {
tmp = t_2;
} else if ((t <= -7.5e-83) || !(t <= 1350.0)) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (z * (y / a)) t_2 = x - (y * (z / t)) tmp = 0 if t <= -6.5e+186: tmp = y + x elif t <= -1.75e+42: tmp = t_2 elif t <= -9e-15: tmp = t_1 elif t <= -4.7e-68: tmp = t_2 elif (t <= -7.5e-83) or not (t <= 1350.0): tmp = y + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(z * Float64(y / a))) t_2 = Float64(x - Float64(y * Float64(z / t))) tmp = 0.0 if (t <= -6.5e+186) tmp = Float64(y + x); elseif (t <= -1.75e+42) tmp = t_2; elseif (t <= -9e-15) tmp = t_1; elseif (t <= -4.7e-68) tmp = t_2; elseif ((t <= -7.5e-83) || !(t <= 1350.0)) tmp = Float64(y + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (z * (y / a)); t_2 = x - (y * (z / t)); tmp = 0.0; if (t <= -6.5e+186) tmp = y + x; elseif (t <= -1.75e+42) tmp = t_2; elseif (t <= -9e-15) tmp = t_1; elseif (t <= -4.7e-68) tmp = t_2; elseif ((t <= -7.5e-83) || ~((t <= 1350.0))) tmp = y + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.5e+186], N[(y + x), $MachinePrecision], If[LessEqual[t, -1.75e+42], t$95$2, If[LessEqual[t, -9e-15], t$95$1, If[LessEqual[t, -4.7e-68], t$95$2, If[Or[LessEqual[t, -7.5e-83], N[Not[LessEqual[t, 1350.0]], $MachinePrecision]], N[(y + x), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \frac{y}{a}\\
t_2 := x - y \cdot \frac{z}{t}\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{+186}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq -1.75 \cdot 10^{+42}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -9 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -4.7 \cdot 10^{-68}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -7.5 \cdot 10^{-83} \lor \neg \left(t \leq 1350\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.4999999999999997e186 or -4.69999999999999988e-68 < t < -7.4999999999999997e-83 or 1350 < t Initial program 100.0%
Taylor expanded in t around inf 79.4%
+-commutative79.4%
Simplified79.4%
if -6.4999999999999997e186 < t < -1.75000000000000012e42 or -8.9999999999999995e-15 < t < -4.69999999999999988e-68Initial program 99.9%
*-commutative99.9%
div-inv99.8%
associate-*l*94.3%
Applied egg-rr94.3%
+-commutative94.3%
associate-*l/94.4%
*-un-lft-identity94.4%
Applied egg-rr94.4%
Taylor expanded in z around inf 81.0%
associate-/l*83.9%
Simplified83.9%
Taylor expanded in a around 0 79.9%
mul-1-neg79.9%
distribute-frac-neg279.9%
Simplified79.9%
if -1.75000000000000012e42 < t < -8.9999999999999995e-15 or -7.4999999999999997e-83 < t < 1350Initial program 95.6%
Taylor expanded in t around 0 79.4%
*-commutative79.4%
associate-/l*83.5%
Simplified83.5%
Final simplification81.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* z (/ y a)))) (t_2 (- x (/ (* z y) t))))
(if (<= t -7.1e+149)
(+ y x)
(if (<= t -2.05e+42)
t_2
(if (<= t -1.12e-14)
t_1
(if (<= t -5e-68)
t_2
(if (or (<= t -7.5e-83) (not (<= t 45.0))) (+ y x) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z * (y / a));
double t_2 = x - ((z * y) / t);
double tmp;
if (t <= -7.1e+149) {
tmp = y + x;
} else if (t <= -2.05e+42) {
tmp = t_2;
} else if (t <= -1.12e-14) {
tmp = t_1;
} else if (t <= -5e-68) {
tmp = t_2;
} else if ((t <= -7.5e-83) || !(t <= 45.0)) {
tmp = y + x;
} 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 = x + (z * (y / a))
t_2 = x - ((z * y) / t)
if (t <= (-7.1d+149)) then
tmp = y + x
else if (t <= (-2.05d+42)) then
tmp = t_2
else if (t <= (-1.12d-14)) then
tmp = t_1
else if (t <= (-5d-68)) then
tmp = t_2
else if ((t <= (-7.5d-83)) .or. (.not. (t <= 45.0d0))) then
tmp = y + x
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 = x + (z * (y / a));
double t_2 = x - ((z * y) / t);
double tmp;
if (t <= -7.1e+149) {
tmp = y + x;
} else if (t <= -2.05e+42) {
tmp = t_2;
} else if (t <= -1.12e-14) {
tmp = t_1;
} else if (t <= -5e-68) {
tmp = t_2;
} else if ((t <= -7.5e-83) || !(t <= 45.0)) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (z * (y / a)) t_2 = x - ((z * y) / t) tmp = 0 if t <= -7.1e+149: tmp = y + x elif t <= -2.05e+42: tmp = t_2 elif t <= -1.12e-14: tmp = t_1 elif t <= -5e-68: tmp = t_2 elif (t <= -7.5e-83) or not (t <= 45.0): tmp = y + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(z * Float64(y / a))) t_2 = Float64(x - Float64(Float64(z * y) / t)) tmp = 0.0 if (t <= -7.1e+149) tmp = Float64(y + x); elseif (t <= -2.05e+42) tmp = t_2; elseif (t <= -1.12e-14) tmp = t_1; elseif (t <= -5e-68) tmp = t_2; elseif ((t <= -7.5e-83) || !(t <= 45.0)) tmp = Float64(y + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (z * (y / a)); t_2 = x - ((z * y) / t); tmp = 0.0; if (t <= -7.1e+149) tmp = y + x; elseif (t <= -2.05e+42) tmp = t_2; elseif (t <= -1.12e-14) tmp = t_1; elseif (t <= -5e-68) tmp = t_2; elseif ((t <= -7.5e-83) || ~((t <= 45.0))) tmp = y + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.1e+149], N[(y + x), $MachinePrecision], If[LessEqual[t, -2.05e+42], t$95$2, If[LessEqual[t, -1.12e-14], t$95$1, If[LessEqual[t, -5e-68], t$95$2, If[Or[LessEqual[t, -7.5e-83], N[Not[LessEqual[t, 45.0]], $MachinePrecision]], N[(y + x), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \frac{y}{a}\\
t_2 := x - \frac{z \cdot y}{t}\\
\mathbf{if}\;t \leq -7.1 \cdot 10^{+149}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq -2.05 \cdot 10^{+42}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -1.12 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5 \cdot 10^{-68}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -7.5 \cdot 10^{-83} \lor \neg \left(t \leq 45\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.1000000000000001e149 or -4.99999999999999971e-68 < t < -7.4999999999999997e-83 or 45 < t Initial program 100.0%
Taylor expanded in t around inf 79.0%
+-commutative79.0%
Simplified79.0%
if -7.1000000000000001e149 < t < -2.05e42 or -1.12000000000000006e-14 < t < -4.99999999999999971e-68Initial program 99.9%
*-commutative99.9%
div-inv99.7%
associate-*l*92.6%
Applied egg-rr92.6%
Taylor expanded in a around 0 91.0%
mul-1-neg91.0%
unsub-neg91.0%
associate-/l*91.0%
div-sub91.0%
*-inverses91.0%
Simplified91.0%
Taylor expanded in z around inf 81.0%
if -2.05e42 < t < -1.12000000000000006e-14 or -7.4999999999999997e-83 < t < 45Initial program 95.6%
Taylor expanded in t around 0 79.4%
*-commutative79.4%
associate-/l*83.5%
Simplified83.5%
Final simplification81.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.7e-48) (not (<= z 230000.0))) (+ x (* y (/ z (- a t)))) (+ x (* t (/ y (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.7e-48) || !(z <= 230000.0)) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + (t * (y / (t - a)));
}
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.7d-48)) .or. (.not. (z <= 230000.0d0))) then
tmp = x + (y * (z / (a - t)))
else
tmp = x + (t * (y / (t - a)))
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.7e-48) || !(z <= 230000.0)) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + (t * (y / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.7e-48) or not (z <= 230000.0): tmp = x + (y * (z / (a - t))) else: tmp = x + (t * (y / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.7e-48) || !(z <= 230000.0)) tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); else tmp = Float64(x + Float64(t * Float64(y / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.7e-48) || ~((z <= 230000.0))) tmp = x + (y * (z / (a - t))); else tmp = x + (t * (y / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.7e-48], N[Not[LessEqual[z, 230000.0]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-48} \lor \neg \left(z \leq 230000\right):\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{t - a}\\
\end{array}
\end{array}
if z < -2.70000000000000011e-48 or 2.3e5 < z Initial program 96.1%
Taylor expanded in z around inf 79.6%
associate-/l*83.9%
Simplified83.9%
if -2.70000000000000011e-48 < z < 2.3e5Initial program 99.9%
Taylor expanded in z around 0 75.3%
mul-1-neg75.3%
unsub-neg75.3%
*-commutative75.3%
associate-/l*90.6%
Simplified90.6%
*-commutative90.6%
div-inv90.5%
associate-*l*91.4%
associate-*l/91.5%
*-un-lft-identity91.5%
Applied egg-rr91.5%
Final simplification87.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.5e+186) (not (<= t 4.2e+129))) (+ y x) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.5e+186) || !(t <= 4.2e+129)) {
tmp = y + x;
} else {
tmp = x + (y * (z / (a - t)));
}
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 ((t <= (-8.5d+186)) .or. (.not. (t <= 4.2d+129))) then
tmp = y + x
else
tmp = x + (y * (z / (a - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.5e+186) || !(t <= 4.2e+129)) {
tmp = y + x;
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8.5e+186) or not (t <= 4.2e+129): tmp = y + x else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.5e+186) || !(t <= 4.2e+129)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -8.5e+186) || ~((t <= 4.2e+129))) tmp = y + x; else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.5e+186], N[Not[LessEqual[t, 4.2e+129]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{+186} \lor \neg \left(t \leq 4.2 \cdot 10^{+129}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -8.4999999999999999e186 or 4.19999999999999993e129 < t Initial program 100.0%
Taylor expanded in t around inf 83.6%
+-commutative83.6%
Simplified83.6%
if -8.4999999999999999e186 < t < 4.19999999999999993e129Initial program 96.8%
Taylor expanded in z around inf 86.2%
associate-/l*87.5%
Simplified87.5%
Final simplification86.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -0.022) (not (<= t 1.45))) (+ y x) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.022) || !(t <= 1.45)) {
tmp = y + x;
} else {
tmp = x + (z * (y / a));
}
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 ((t <= (-0.022d0)) .or. (.not. (t <= 1.45d0))) then
tmp = y + x
else
tmp = x + (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.022) || !(t <= 1.45)) {
tmp = y + x;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -0.022) or not (t <= 1.45): tmp = y + x else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -0.022) || !(t <= 1.45)) tmp = Float64(y + x); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -0.022) || ~((t <= 1.45))) tmp = y + x; else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -0.022], N[Not[LessEqual[t, 1.45]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.022 \lor \neg \left(t \leq 1.45\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -0.021999999999999999 or 1.44999999999999996 < t Initial program 100.0%
Taylor expanded in t around inf 73.7%
+-commutative73.7%
Simplified73.7%
if -0.021999999999999999 < t < 1.44999999999999996Initial program 95.8%
Taylor expanded in t around 0 77.5%
*-commutative77.5%
associate-/l*81.4%
Simplified81.4%
Final simplification78.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -0.046) (not (<= t 1.4))) (+ y x) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.046) || !(t <= 1.4)) {
tmp = y + x;
} else {
tmp = x + (y * (z / a));
}
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 ((t <= (-0.046d0)) .or. (.not. (t <= 1.4d0))) then
tmp = y + x
else
tmp = x + (y * (z / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -0.046) || !(t <= 1.4)) {
tmp = y + x;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -0.046) or not (t <= 1.4): tmp = y + x else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -0.046) || !(t <= 1.4)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -0.046) || ~((t <= 1.4))) tmp = y + x; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -0.046], N[Not[LessEqual[t, 1.4]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.046 \lor \neg \left(t \leq 1.4\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -0.045999999999999999 or 1.3999999999999999 < t Initial program 100.0%
Taylor expanded in t around inf 73.7%
+-commutative73.7%
Simplified73.7%
if -0.045999999999999999 < t < 1.3999999999999999Initial program 95.8%
Taylor expanded in t around 0 79.4%
Final simplification76.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.3e-89) (not (<= t 2.6e+110))) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.3e-89) || !(t <= 2.6e+110)) {
tmp = y + x;
} else {
tmp = x;
}
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 ((t <= (-1.3d-89)) .or. (.not. (t <= 2.6d+110))) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.3e-89) || !(t <= 2.6e+110)) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.3e-89) or not (t <= 2.6e+110): tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.3e-89) || !(t <= 2.6e+110)) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.3e-89) || ~((t <= 2.6e+110))) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.3e-89], N[Not[LessEqual[t, 2.6e+110]], $MachinePrecision]], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{-89} \lor \neg \left(t \leq 2.6 \cdot 10^{+110}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.2999999999999999e-89 or 2.6e110 < t Initial program 99.9%
Taylor expanded in t around inf 73.5%
+-commutative73.5%
Simplified73.5%
if -1.2999999999999999e-89 < t < 2.6e110Initial program 95.6%
Taylor expanded in x around inf 52.1%
Final simplification62.1%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Initial program 97.6%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.6%
Taylor expanded in x around inf 49.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
(if (< y -8.508084860551241e-17)
t_1
(if (< y 2.894426862792089e-49)
(+ x (* (* y (- z t)) (/ 1.0 (- a t))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} 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) :: tmp
t_1 = x + (y * ((z - t) / (a - t)))
if (y < (-8.508084860551241d-17)) then
tmp = t_1
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) * (1.0d0 / (a - t)))
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 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / (a - t))) tmp = 0 if y < -8.508084860551241e-17: tmp = t_1 elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) * (1.0 / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) * Float64(1.0 / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / (a - t))); tmp = 0.0; if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) * (1.0 / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -8.508084860551241e-17], t$95$1, If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024096
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:alt
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))