
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{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) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* y (- (+ (/ t (- a t)) 1.0) (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
return x + (y * (((t / (a - t)) + 1.0) - (z / (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 * (((t / (a - t)) + 1.0d0) - (z / (a - t))))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * (((t / (a - t)) + 1.0) - (z / (a - t))));
}
def code(x, y, z, t, a): return x + (y * (((t / (a - t)) + 1.0) - (z / (a - t))))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(Float64(t / Float64(a - t)) + 1.0) - Float64(z / Float64(a - t))))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * (((t / (a - t)) + 1.0) - (z / (a - t)))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \left(\left(\frac{t}{a - t} + 1\right) - \frac{z}{a - t}\right)
\end{array}
Initial program 77.9%
associate-*l/83.2%
Simplified83.2%
Taylor expanded in y around 0 96.8%
Final simplification96.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.8e+138)
(+ x (/ z (/ t y)))
(if (<= t 5.5e+75)
(+ (+ x y) (* y (/ (- t z) (- a t))))
(+ x (/ y (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.8e+138) {
tmp = x + (z / (t / y));
} else if (t <= 5.5e+75) {
tmp = (x + y) + (y * ((t - z) / (a - t)));
} else {
tmp = x + (y / (t / z));
}
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 <= (-2.8d+138)) then
tmp = x + (z / (t / y))
else if (t <= 5.5d+75) then
tmp = (x + y) + (y * ((t - z) / (a - t)))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.8e+138) {
tmp = x + (z / (t / y));
} else if (t <= 5.5e+75) {
tmp = (x + y) + (y * ((t - z) / (a - t)));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.8e+138: tmp = x + (z / (t / y)) elif t <= 5.5e+75: tmp = (x + y) + (y * ((t - z) / (a - t))) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.8e+138) tmp = Float64(x + Float64(z / Float64(t / y))); elseif (t <= 5.5e+75) tmp = Float64(Float64(x + y) + Float64(y * Float64(Float64(t - z) / Float64(a - t)))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.8e+138) tmp = x + (z / (t / y)); elseif (t <= 5.5e+75) tmp = (x + y) + (y * ((t - z) / (a - t))); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.8e+138], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e+75], N[(N[(x + y), $MachinePrecision] + N[(y * N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+138}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+75}:\\
\;\;\;\;\left(x + y\right) + y \cdot \frac{t - z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if t < -2.8000000000000001e138Initial program 52.7%
associate-*l/64.5%
Simplified64.5%
Taylor expanded in y around 0 95.7%
Taylor expanded in a around 0 76.3%
+-commutative76.3%
associate-/l*91.8%
Simplified91.8%
associate-/r/91.7%
Applied egg-rr91.7%
*-commutative91.7%
clear-num91.7%
un-div-inv91.8%
Applied egg-rr91.8%
if -2.8000000000000001e138 < t < 5.5000000000000001e75Initial program 90.1%
associate-*l/92.9%
Simplified92.9%
if 5.5000000000000001e75 < t Initial program 58.9%
associate-*l/66.1%
Simplified66.1%
Taylor expanded in y around 0 97.7%
Taylor expanded in a around 0 85.9%
+-commutative85.9%
associate-/l*95.3%
Simplified95.3%
Final simplification93.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.9e+138)
(+ x (/ z (/ t y)))
(if (<= t 9.2e+55)
(+ (+ x y) (/ (- t z) (/ (- a t) y)))
(+ x (/ y (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.9e+138) {
tmp = x + (z / (t / y));
} else if (t <= 9.2e+55) {
tmp = (x + y) + ((t - z) / ((a - t) / y));
} else {
tmp = x + (y / (t / z));
}
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.9d+138)) then
tmp = x + (z / (t / y))
else if (t <= 9.2d+55) then
tmp = (x + y) + ((t - z) / ((a - t) / y))
else
tmp = x + (y / (t / z))
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.9e+138) {
tmp = x + (z / (t / y));
} else if (t <= 9.2e+55) {
tmp = (x + y) + ((t - z) / ((a - t) / y));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.9e+138: tmp = x + (z / (t / y)) elif t <= 9.2e+55: tmp = (x + y) + ((t - z) / ((a - t) / y)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.9e+138) tmp = Float64(x + Float64(z / Float64(t / y))); elseif (t <= 9.2e+55) tmp = Float64(Float64(x + y) + Float64(Float64(t - z) / Float64(Float64(a - t) / y))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.9e+138) tmp = x + (z / (t / y)); elseif (t <= 9.2e+55) tmp = (x + y) + ((t - z) / ((a - t) / y)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.9e+138], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.2e+55], N[(N[(x + y), $MachinePrecision] + N[(N[(t - z), $MachinePrecision] / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+138}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{+55}:\\
\;\;\;\;\left(x + y\right) + \frac{t - z}{\frac{a - t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if t < -1.90000000000000006e138Initial program 52.7%
associate-*l/64.5%
Simplified64.5%
Taylor expanded in y around 0 95.7%
Taylor expanded in a around 0 76.3%
+-commutative76.3%
associate-/l*91.8%
Simplified91.8%
associate-/r/91.7%
Applied egg-rr91.7%
*-commutative91.7%
clear-num91.7%
un-div-inv91.8%
Applied egg-rr91.8%
if -1.90000000000000006e138 < t < 9.1999999999999995e55Initial program 90.0%
associate-*l/92.8%
Simplified92.8%
associate-/r/94.0%
Applied egg-rr94.0%
if 9.1999999999999995e55 < t Initial program 60.8%
associate-*l/67.7%
Simplified67.7%
Taylor expanded in y around 0 97.8%
Taylor expanded in a around 0 86.6%
+-commutative86.6%
associate-/l*95.5%
Simplified95.5%
Final simplification93.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -1e+122) (+ x (/ z (/ t y))) (if (<= t 1.15e+56) (- (+ x y) (/ y (/ (- a t) z))) (+ x (/ y (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1e+122) {
tmp = x + (z / (t / y));
} else if (t <= 1.15e+56) {
tmp = (x + y) - (y / ((a - t) / z));
} else {
tmp = x + (y / (t / z));
}
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 <= (-1d+122)) then
tmp = x + (z / (t / y))
else if (t <= 1.15d+56) then
tmp = (x + y) - (y / ((a - t) / z))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1e+122) {
tmp = x + (z / (t / y));
} else if (t <= 1.15e+56) {
tmp = (x + y) - (y / ((a - t) / z));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1e+122: tmp = x + (z / (t / y)) elif t <= 1.15e+56: tmp = (x + y) - (y / ((a - t) / z)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1e+122) tmp = Float64(x + Float64(z / Float64(t / y))); elseif (t <= 1.15e+56) tmp = Float64(Float64(x + y) - Float64(y / Float64(Float64(a - t) / z))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1e+122) tmp = x + (z / (t / y)); elseif (t <= 1.15e+56) tmp = (x + y) - (y / ((a - t) / z)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1e+122], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.15e+56], N[(N[(x + y), $MachinePrecision] - N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+122}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+56}:\\
\;\;\;\;\left(x + y\right) - \frac{y}{\frac{a - t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if t < -1.00000000000000001e122Initial program 55.4%
associate-*l/66.0%
Simplified66.0%
Taylor expanded in y around 0 96.1%
Taylor expanded in a around 0 76.7%
+-commutative76.7%
associate-/l*90.7%
Simplified90.7%
associate-/r/90.7%
Applied egg-rr90.7%
*-commutative90.7%
clear-num90.6%
un-div-inv90.7%
Applied egg-rr90.7%
if -1.00000000000000001e122 < t < 1.15000000000000007e56Initial program 90.3%
associate-*l/93.2%
Simplified93.2%
Taylor expanded in z around inf 90.3%
associate-/l*92.6%
Simplified92.6%
if 1.15000000000000007e56 < t Initial program 60.8%
associate-*l/67.7%
Simplified67.7%
Taylor expanded in y around 0 97.8%
Taylor expanded in a around 0 86.6%
+-commutative86.6%
associate-/l*95.5%
Simplified95.5%
Final simplification92.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.8e+31) (not (<= a 1.05e-50))) (- (+ x y) (/ y (/ a z))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.8e+31) || !(a <= 1.05e-50)) {
tmp = (x + y) - (y / (a / z));
} else {
tmp = x + (z * (y / 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 ((a <= (-2.8d+31)) .or. (.not. (a <= 1.05d-50))) then
tmp = (x + y) - (y / (a / z))
else
tmp = x + (z * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.8e+31) || !(a <= 1.05e-50)) {
tmp = (x + y) - (y / (a / z));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.8e+31) or not (a <= 1.05e-50): tmp = (x + y) - (y / (a / z)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.8e+31) || !(a <= 1.05e-50)) tmp = Float64(Float64(x + y) - Float64(y / Float64(a / z))); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.8e+31) || ~((a <= 1.05e-50))) tmp = (x + y) - (y / (a / z)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.8e+31], N[Not[LessEqual[a, 1.05e-50]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.8 \cdot 10^{+31} \lor \neg \left(a \leq 1.05 \cdot 10^{-50}\right):\\
\;\;\;\;\left(x + y\right) - \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if a < -2.80000000000000017e31 or 1.05e-50 < a Initial program 84.0%
associate-*l/93.4%
Simplified93.4%
Taylor expanded in t around 0 82.1%
+-commutative82.1%
associate-/l*87.9%
Simplified87.9%
if -2.80000000000000017e31 < a < 1.05e-50Initial program 71.5%
associate-*l/72.3%
Simplified72.3%
Taylor expanded in y around 0 95.8%
Taylor expanded in a around 0 84.3%
+-commutative84.3%
associate-/l*87.4%
Simplified87.4%
associate-/r/89.6%
Applied egg-rr89.6%
Final simplification88.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -7e+20) (not (<= a 7.9e+71))) (+ x y) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7e+20) || !(a <= 7.9e+71)) {
tmp = x + y;
} else {
tmp = x + ((y * z) / 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 ((a <= (-7d+20)) .or. (.not. (a <= 7.9d+71))) then
tmp = x + y
else
tmp = x + ((y * z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7e+20) || !(a <= 7.9e+71)) {
tmp = x + y;
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -7e+20) or not (a <= 7.9e+71): tmp = x + y else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -7e+20) || !(a <= 7.9e+71)) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -7e+20) || ~((a <= 7.9e+71))) tmp = x + y; else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -7e+20], N[Not[LessEqual[a, 7.9e+71]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{+20} \lor \neg \left(a \leq 7.9 \cdot 10^{+71}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if a < -7e20 or 7.90000000000000028e71 < a Initial program 83.0%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in a around inf 85.7%
+-commutative85.7%
Simplified85.7%
if -7e20 < a < 7.90000000000000028e71Initial program 74.6%
associate-*l/74.6%
Simplified74.6%
Taylor expanded in y around 0 95.4%
Taylor expanded in a around 0 81.8%
Final simplification83.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.1e+29) (not (<= a 4.6e+70))) (+ x y) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.1e+29) || !(a <= 4.6e+70)) {
tmp = x + y;
} else {
tmp = x + (z * (y / 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 ((a <= (-2.1d+29)) .or. (.not. (a <= 4.6d+70))) then
tmp = x + y
else
tmp = x + (z * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.1e+29) || !(a <= 4.6e+70)) {
tmp = x + y;
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.1e+29) or not (a <= 4.6e+70): tmp = x + y else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.1e+29) || !(a <= 4.6e+70)) tmp = Float64(x + y); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.1e+29) || ~((a <= 4.6e+70))) tmp = x + y; else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.1e+29], N[Not[LessEqual[a, 4.6e+70]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.1 \cdot 10^{+29} \lor \neg \left(a \leq 4.6 \cdot 10^{+70}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if a < -2.1000000000000002e29 or 4.59999999999999987e70 < a Initial program 83.7%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in a around inf 86.3%
+-commutative86.3%
Simplified86.3%
if -2.1000000000000002e29 < a < 4.59999999999999987e70Initial program 74.3%
associate-*l/74.3%
Simplified74.3%
Taylor expanded in y around 0 95.4%
Taylor expanded in a around 0 81.4%
+-commutative81.4%
associate-/l*84.4%
Simplified84.4%
associate-/r/85.7%
Applied egg-rr85.7%
Final simplification85.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.9e+96) x (if (<= t 8.8e+55) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.9e+96) {
tmp = x;
} else if (t <= 8.8e+55) {
tmp = x + y;
} 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 <= (-3.9d+96)) then
tmp = x
else if (t <= 8.8d+55) then
tmp = x + y
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 <= -3.9e+96) {
tmp = x;
} else if (t <= 8.8e+55) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.9e+96: tmp = x elif t <= 8.8e+55: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.9e+96) tmp = x; elseif (t <= 8.8e+55) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.9e+96) tmp = x; elseif (t <= 8.8e+55) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.9e+96], x, If[LessEqual[t, 8.8e+55], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.9 \cdot 10^{+96}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 8.8 \cdot 10^{+55}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.9e96 or 8.80000000000000042e55 < t Initial program 58.1%
associate-*l/66.8%
Simplified66.8%
Taylor expanded in x around inf 75.3%
if -3.9e96 < t < 8.80000000000000042e55Initial program 90.7%
associate-*l/93.7%
Simplified93.7%
Taylor expanded in a around inf 72.6%
+-commutative72.6%
Simplified72.6%
Final simplification73.6%
(FPCore (x y z t a) :precision binary64 (if (<= y 6.2e+191) x y))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 6.2e+191) {
tmp = x;
} else {
tmp = 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 <= 6.2d+191) then
tmp = x
else
tmp = 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 <= 6.2e+191) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 6.2e+191: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 6.2e+191) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 6.2e+191) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 6.2e+191], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.2 \cdot 10^{+191}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 6.19999999999999997e191Initial program 80.1%
associate-*l/84.9%
Simplified84.9%
Taylor expanded in x around inf 62.9%
if 6.19999999999999997e191 < y Initial program 45.1%
associate-*l/57.3%
Simplified57.3%
Taylor expanded in t around 0 45.9%
+-commutative45.9%
associate-/l*51.7%
Simplified51.7%
Taylor expanded in x around 0 45.9%
Taylor expanded in z around 0 35.3%
Final simplification61.2%
(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 77.9%
associate-*l/83.2%
Simplified83.2%
Taylor expanded in x around inf 59.5%
Final simplification59.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (< t_2 -1.3664970889390727e-7)
t_1
(if (< t_2 1.4754293444577233e-239)
(/ (- (* y (- a z)) (* x t)) (- a t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (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) :: t_2
real(8) :: tmp
t_1 = (y + x) - (((z - t) * (1.0d0 / (a - t))) * y)
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 < (-1.3664970889390727d-7)) then
tmp = t_1
else if (t_2 < 1.4754293444577233d-239) then
tmp = ((y * (a - z)) - (x * t)) / (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 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y) t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 < -1.3664970889390727e-7: tmp = t_1 elif t_2 < 1.4754293444577233e-239: tmp = ((y * (a - z)) - (x * t)) / (a - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y)) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y); t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = ((y * (a - z)) - (x * t)) / (a - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2024010
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))