
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
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 - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
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 - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- y z) (- a z)) t x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (a - z)), t, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(a - z)), t, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)
\end{array}
Initial program 86.0%
+-commutative86.0%
associate-*l/98.7%
fma-def98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.7e-23) (not (<= z 2.4e-54))) (+ x (- t (* t (/ y z)))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.7e-23) || !(z <= 2.4e-54)) {
tmp = x + (t - (t * (y / z)));
} else {
tmp = x + (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 <= (-1.7d-23)) .or. (.not. (z <= 2.4d-54))) then
tmp = x + (t - (t * (y / z)))
else
tmp = x + (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 <= -1.7e-23) || !(z <= 2.4e-54)) {
tmp = x + (t - (t * (y / z)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.7e-23) or not (z <= 2.4e-54): tmp = x + (t - (t * (y / z))) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.7e-23) || !(z <= 2.4e-54)) tmp = Float64(x + Float64(t - Float64(t * Float64(y / z)))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.7e-23) || ~((z <= 2.4e-54))) tmp = x + (t - (t * (y / z))); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.7e-23], N[Not[LessEqual[z, 2.4e-54]], $MachinePrecision]], N[(x + N[(t - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-23} \lor \neg \left(z \leq 2.4 \cdot 10^{-54}\right):\\
\;\;\;\;x + \left(t - t \cdot \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.7e-23 or 2.40000000000000013e-54 < z Initial program 82.0%
associate-*l/99.9%
Simplified99.9%
associate-/r/93.0%
Applied egg-rr93.0%
Taylor expanded in a around 0 78.4%
neg-mul-178.4%
distribute-neg-frac78.4%
Simplified78.4%
Taylor expanded in y around 0 77.4%
mul-1-neg77.4%
unsub-neg77.4%
*-commutative77.4%
associate-*l/83.1%
*-commutative83.1%
Simplified83.1%
if -1.7e-23 < z < 2.40000000000000013e-54Initial program 90.2%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in z around 0 74.8%
+-commutative74.8%
associate-/l*82.2%
Simplified82.2%
associate-/r/84.1%
Applied egg-rr84.1%
Final simplification83.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.35e-23) (not (<= z 7.5e+86))) (+ x (- t (* t (/ y z)))) (+ x (/ t (/ (- a z) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.35e-23) || !(z <= 7.5e+86)) {
tmp = x + (t - (t * (y / z)));
} else {
tmp = x + (t / ((a - z) / 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.35d-23)) .or. (.not. (z <= 7.5d+86))) then
tmp = x + (t - (t * (y / z)))
else
tmp = x + (t / ((a - z) / 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.35e-23) || !(z <= 7.5e+86)) {
tmp = x + (t - (t * (y / z)));
} else {
tmp = x + (t / ((a - z) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.35e-23) or not (z <= 7.5e+86): tmp = x + (t - (t * (y / z))) else: tmp = x + (t / ((a - z) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.35e-23) || !(z <= 7.5e+86)) tmp = Float64(x + Float64(t - Float64(t * Float64(y / z)))); else tmp = Float64(x + Float64(t / Float64(Float64(a - z) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.35e-23) || ~((z <= 7.5e+86))) tmp = x + (t - (t * (y / z))); else tmp = x + (t / ((a - z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.35e-23], N[Not[LessEqual[z, 7.5e+86]], $MachinePrecision]], N[(x + N[(t - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t / N[(N[(a - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{-23} \lor \neg \left(z \leq 7.5 \cdot 10^{+86}\right):\\
\;\;\;\;x + \left(t - t \cdot \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\frac{a - z}{y}}\\
\end{array}
\end{array}
if z < -2.35e-23 or 7.4999999999999997e86 < z Initial program 78.9%
associate-*l/99.9%
Simplified99.9%
associate-/r/91.5%
Applied egg-rr91.5%
Taylor expanded in a around 0 78.6%
neg-mul-178.6%
distribute-neg-frac78.6%
Simplified78.6%
Taylor expanded in y around 0 77.3%
mul-1-neg77.3%
unsub-neg77.3%
*-commutative77.3%
associate-*l/84.3%
*-commutative84.3%
Simplified84.3%
if -2.35e-23 < z < 7.4999999999999997e86Initial program 91.1%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in y around inf 80.5%
associate-/l*87.3%
Simplified87.3%
Final simplification86.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -2.1e-31) (not (<= y 1350.0))) (+ x (/ t (/ (- a z) y))) (- x (* t (/ z (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.1e-31) || !(y <= 1350.0)) {
tmp = x + (t / ((a - z) / y));
} else {
tmp = x - (t * (z / (a - 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 ((y <= (-2.1d-31)) .or. (.not. (y <= 1350.0d0))) then
tmp = x + (t / ((a - z) / y))
else
tmp = x - (t * (z / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.1e-31) || !(y <= 1350.0)) {
tmp = x + (t / ((a - z) / y));
} else {
tmp = x - (t * (z / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -2.1e-31) or not (y <= 1350.0): tmp = x + (t / ((a - z) / y)) else: tmp = x - (t * (z / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -2.1e-31) || !(y <= 1350.0)) tmp = Float64(x + Float64(t / Float64(Float64(a - z) / y))); else tmp = Float64(x - Float64(t * Float64(z / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -2.1e-31) || ~((y <= 1350.0))) tmp = x + (t / ((a - z) / y)); else tmp = x - (t * (z / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -2.1e-31], N[Not[LessEqual[y, 1350.0]], $MachinePrecision]], N[(x + N[(t / N[(N[(a - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{-31} \lor \neg \left(y \leq 1350\right):\\
\;\;\;\;x + \frac{t}{\frac{a - z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{z}{a - z}\\
\end{array}
\end{array}
if y < -2.09999999999999991e-31 or 1350 < y Initial program 80.4%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around inf 74.7%
associate-/l*88.1%
Simplified88.1%
if -2.09999999999999991e-31 < y < 1350Initial program 92.2%
associate-*l/99.1%
Simplified99.1%
Taylor expanded in y around 0 86.5%
mul-1-neg86.5%
unsub-neg86.5%
*-commutative86.5%
associate-*l/94.2%
Simplified94.2%
Final simplification91.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.25e-33) (not (<= y 88.0))) (+ x (/ t (/ (- a z) y))) (- x (/ t (+ (/ a z) -1.0)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.25e-33) || !(y <= 88.0)) {
tmp = x + (t / ((a - z) / y));
} else {
tmp = x - (t / ((a / z) + -1.0));
}
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 <= (-1.25d-33)) .or. (.not. (y <= 88.0d0))) then
tmp = x + (t / ((a - z) / y))
else
tmp = x - (t / ((a / z) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.25e-33) || !(y <= 88.0)) {
tmp = x + (t / ((a - z) / y));
} else {
tmp = x - (t / ((a / z) + -1.0));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.25e-33) or not (y <= 88.0): tmp = x + (t / ((a - z) / y)) else: tmp = x - (t / ((a / z) + -1.0)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.25e-33) || !(y <= 88.0)) tmp = Float64(x + Float64(t / Float64(Float64(a - z) / y))); else tmp = Float64(x - Float64(t / Float64(Float64(a / z) + -1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.25e-33) || ~((y <= 88.0))) tmp = x + (t / ((a - z) / y)); else tmp = x - (t / ((a / z) + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.25e-33], N[Not[LessEqual[y, 88.0]], $MachinePrecision]], N[(x + N[(t / N[(N[(a - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t / N[(N[(a / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{-33} \lor \neg \left(y \leq 88\right):\\
\;\;\;\;x + \frac{t}{\frac{a - z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{t}{\frac{a}{z} + -1}\\
\end{array}
\end{array}
if y < -1.25000000000000007e-33 or 88 < y Initial program 80.4%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around inf 74.7%
associate-/l*88.1%
Simplified88.1%
if -1.25000000000000007e-33 < y < 88Initial program 92.2%
associate-*l/99.1%
Simplified99.1%
Taylor expanded in y around 0 86.5%
mul-1-neg86.5%
unsub-neg86.5%
*-commutative86.5%
associate-*l/94.2%
Simplified94.2%
*-commutative94.2%
clear-num94.2%
div-inv94.2%
div-sub94.2%
*-inverses94.2%
sub-neg94.2%
metadata-eval94.2%
Applied egg-rr94.2%
Final simplification91.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -9.5e-23) (+ t x) (if (<= z 1.45e+59) (+ x (* t (/ y a))) (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e-23) {
tmp = t + x;
} else if (z <= 1.45e+59) {
tmp = x + (t * (y / a));
} else {
tmp = t + 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 (z <= (-9.5d-23)) then
tmp = t + x
else if (z <= 1.45d+59) then
tmp = x + (t * (y / a))
else
tmp = t + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e-23) {
tmp = t + x;
} else if (z <= 1.45e+59) {
tmp = x + (t * (y / a));
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9.5e-23: tmp = t + x elif z <= 1.45e+59: tmp = x + (t * (y / a)) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e-23) tmp = Float64(t + x); elseif (z <= 1.45e+59) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -9.5e-23) tmp = t + x; elseif (z <= 1.45e+59) tmp = x + (t * (y / a)); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e-23], N[(t + x), $MachinePrecision], If[LessEqual[z, 1.45e+59], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-23}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+59}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -9.50000000000000058e-23 or 1.44999999999999995e59 < z Initial program 79.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 73.3%
if -9.50000000000000058e-23 < z < 1.44999999999999995e59Initial program 91.0%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in z around 0 79.4%
Final simplification76.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.6e-21) (+ t x) (if (<= z 1.75e-53) (+ x (/ y (/ a t))) (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e-21) {
tmp = t + x;
} else if (z <= 1.75e-53) {
tmp = x + (y / (a / t));
} else {
tmp = t + 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 (z <= (-3.6d-21)) then
tmp = t + x
else if (z <= 1.75d-53) then
tmp = x + (y / (a / t))
else
tmp = t + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e-21) {
tmp = t + x;
} else if (z <= 1.75e-53) {
tmp = x + (y / (a / t));
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.6e-21: tmp = t + x elif z <= 1.75e-53: tmp = x + (y / (a / t)) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.6e-21) tmp = Float64(t + x); elseif (z <= 1.75e-53) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.6e-21) tmp = t + x; elseif (z <= 1.75e-53) tmp = x + (y / (a / t)); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.6e-21], N[(t + x), $MachinePrecision], If[LessEqual[z, 1.75e-53], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{-21}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-53}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -3.59999999999999989e-21 or 1.74999999999999997e-53 < z Initial program 82.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 71.6%
if -3.59999999999999989e-21 < z < 1.74999999999999997e-53Initial program 90.2%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in y around inf 81.5%
associate-/l*88.9%
Simplified88.9%
Taylor expanded in a around inf 74.8%
*-commutative74.8%
associate-/l*83.8%
Simplified83.8%
Final simplification77.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.8e-23) (+ t x) (if (<= z 2.45e-54) (+ x (* y (/ t a))) (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.8e-23) {
tmp = t + x;
} else if (z <= 2.45e-54) {
tmp = x + (y * (t / a));
} else {
tmp = t + 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 (z <= (-6.8d-23)) then
tmp = t + x
else if (z <= 2.45d-54) then
tmp = x + (y * (t / a))
else
tmp = t + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.8e-23) {
tmp = t + x;
} else if (z <= 2.45e-54) {
tmp = x + (y * (t / a));
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.8e-23: tmp = t + x elif z <= 2.45e-54: tmp = x + (y * (t / a)) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.8e-23) tmp = Float64(t + x); elseif (z <= 2.45e-54) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6.8e-23) tmp = t + x; elseif (z <= 2.45e-54) tmp = x + (y * (t / a)); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.8e-23], N[(t + x), $MachinePrecision], If[LessEqual[z, 2.45e-54], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-23}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{-54}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -6.8000000000000001e-23 or 2.4500000000000001e-54 < z Initial program 82.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 71.6%
if -6.8000000000000001e-23 < z < 2.4500000000000001e-54Initial program 90.2%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in z around 0 74.8%
+-commutative74.8%
associate-/l*82.2%
Simplified82.2%
associate-/r/84.1%
Applied egg-rr84.1%
Final simplification77.8%
(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(Float64(Float64(y - z) / Float64(a - 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[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - z}{a - z} \cdot t
\end{array}
Initial program 86.0%
associate-*l/98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.35e-24) (+ t x) (if (<= z 5.5e-54) x (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e-24) {
tmp = t + x;
} else if (z <= 5.5e-54) {
tmp = x;
} else {
tmp = t + 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 (z <= (-1.35d-24)) then
tmp = t + x
else if (z <= 5.5d-54) then
tmp = x
else
tmp = t + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e-24) {
tmp = t + x;
} else if (z <= 5.5e-54) {
tmp = x;
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.35e-24: tmp = t + x elif z <= 5.5e-54: tmp = x else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.35e-24) tmp = Float64(t + x); elseif (z <= 5.5e-54) tmp = x; else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.35e-24) tmp = t + x; elseif (z <= 5.5e-54) tmp = x; else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.35e-24], N[(t + x), $MachinePrecision], If[LessEqual[z, 5.5e-54], x, N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-24}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-54}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -1.35000000000000003e-24 or 5.50000000000000046e-54 < z Initial program 82.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 71.6%
if -1.35000000000000003e-24 < z < 5.50000000000000046e-54Initial program 90.2%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in x around inf 53.7%
Final simplification62.8%
(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 86.0%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in x around inf 49.0%
Final simplification49.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y z) (- a z)) t))))
(if (< t -1.0682974490174067e-39)
t_1
(if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} 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) / (a - z)) * t)
if (t < (-1.0682974490174067d-39)) then
tmp = t_1
else if (t < 3.9110949887586375d-141) then
tmp = x + (((y - z) * t) / (a - z))
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) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - z) / (a - z)) * t) tmp = 0 if t < -1.0682974490174067e-39: tmp = t_1 elif t < 3.9110949887586375e-141: tmp = x + (((y - z) * t) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) tmp = 0.0 if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - z) / (a - z)) * t); tmp = 0.0; if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = x + (((y - z) * t) / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.0682974490174067e-39], t$95$1, If[Less[t, 3.9110949887586375e-141], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023290
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))
(+ x (/ (* (- y z) t) (- a z))))