
(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 13 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 (fma (- z t) (* (/ 1.0 (- a t)) y) x))
double code(double x, double y, double z, double t, double a) {
return fma((z - t), ((1.0 / (a - t)) * y), x);
}
function code(x, y, z, t, a) return fma(Float64(z - t), Float64(Float64(1.0 / Float64(a - t)) * y), x) end
code[x_, y_, z_, t_, a_] := N[(N[(z - t), $MachinePrecision] * N[(N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z - t, \frac{1}{a - t} \cdot y, x\right)
\end{array}
Initial program 97.3%
+-commutative97.3%
*-commutative97.3%
div-inv97.3%
associate-*l*97.7%
fma-def97.7%
Applied egg-rr97.7%
Final simplification97.7%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.65e+94)
(+ y x)
(if (<= t -5.6e-39)
(- x (* z (/ y t)))
(if (or (<= t -4.6e-51) (not (<= t 2.4e+31)))
(+ y x)
(+ x (/ z (/ a y)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.65e+94) {
tmp = y + x;
} else if (t <= -5.6e-39) {
tmp = x - (z * (y / t));
} else if ((t <= -4.6e-51) || !(t <= 2.4e+31)) {
tmp = y + x;
} else {
tmp = x + (z / (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 (t <= (-1.65d+94)) then
tmp = y + x
else if (t <= (-5.6d-39)) then
tmp = x - (z * (y / t))
else if ((t <= (-4.6d-51)) .or. (.not. (t <= 2.4d+31))) then
tmp = y + x
else
tmp = x + (z / (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 (t <= -1.65e+94) {
tmp = y + x;
} else if (t <= -5.6e-39) {
tmp = x - (z * (y / t));
} else if ((t <= -4.6e-51) || !(t <= 2.4e+31)) {
tmp = y + x;
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.65e+94: tmp = y + x elif t <= -5.6e-39: tmp = x - (z * (y / t)) elif (t <= -4.6e-51) or not (t <= 2.4e+31): tmp = y + x else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.65e+94) tmp = Float64(y + x); elseif (t <= -5.6e-39) tmp = Float64(x - Float64(z * Float64(y / t))); elseif ((t <= -4.6e-51) || !(t <= 2.4e+31)) tmp = Float64(y + x); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.65e+94) tmp = y + x; elseif (t <= -5.6e-39) tmp = x - (z * (y / t)); elseif ((t <= -4.6e-51) || ~((t <= 2.4e+31))) tmp = y + x; else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.65e+94], N[(y + x), $MachinePrecision], If[LessEqual[t, -5.6e-39], N[(x - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -4.6e-51], N[Not[LessEqual[t, 2.4e+31]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+94}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq -5.6 \cdot 10^{-39}:\\
\;\;\;\;x - z \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq -4.6 \cdot 10^{-51} \lor \neg \left(t \leq 2.4 \cdot 10^{+31}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -1.65e94 or -5.6000000000000003e-39 < t < -4.60000000000000004e-51 or 2.39999999999999982e31 < t Initial program 99.9%
Taylor expanded in t around inf 85.3%
+-commutative85.3%
Simplified85.3%
if -1.65e94 < t < -5.6000000000000003e-39Initial program 100.0%
Taylor expanded in z around inf 75.3%
Taylor expanded in a around 0 70.0%
mul-1-neg70.0%
unsub-neg70.0%
associate-*l/70.0%
*-commutative70.0%
Simplified70.0%
if -4.60000000000000004e-51 < t < 2.39999999999999982e31Initial program 94.5%
Taylor expanded in z around inf 89.5%
clear-num89.5%
div-inv90.2%
div-inv90.1%
associate-/r*92.7%
Applied egg-rr92.7%
Taylor expanded in a around inf 80.7%
+-commutative80.7%
*-commutative80.7%
associate-/l*84.7%
Simplified84.7%
Final simplification82.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.2e+26)
(+ y x)
(if (<= t -6.8e-31)
(+ x (* y (/ z a)))
(if (<= t -1.52e-48)
(+ y x)
(if (<= t 2.9e+29) (+ x (/ z (/ a y))) (+ y x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.2e+26) {
tmp = y + x;
} else if (t <= -6.8e-31) {
tmp = x + (y * (z / a));
} else if (t <= -1.52e-48) {
tmp = y + x;
} else if (t <= 2.9e+29) {
tmp = x + (z / (a / y));
} else {
tmp = y + 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.2d+26)) then
tmp = y + x
else if (t <= (-6.8d-31)) then
tmp = x + (y * (z / a))
else if (t <= (-1.52d-48)) then
tmp = y + x
else if (t <= 2.9d+29) then
tmp = x + (z / (a / y))
else
tmp = y + 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.2e+26) {
tmp = y + x;
} else if (t <= -6.8e-31) {
tmp = x + (y * (z / a));
} else if (t <= -1.52e-48) {
tmp = y + x;
} else if (t <= 2.9e+29) {
tmp = x + (z / (a / y));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.2e+26: tmp = y + x elif t <= -6.8e-31: tmp = x + (y * (z / a)) elif t <= -1.52e-48: tmp = y + x elif t <= 2.9e+29: tmp = x + (z / (a / y)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.2e+26) tmp = Float64(y + x); elseif (t <= -6.8e-31) tmp = Float64(x + Float64(y * Float64(z / a))); elseif (t <= -1.52e-48) tmp = Float64(y + x); elseif (t <= 2.9e+29) tmp = Float64(x + Float64(z / Float64(a / y))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.2e+26) tmp = y + x; elseif (t <= -6.8e-31) tmp = x + (y * (z / a)); elseif (t <= -1.52e-48) tmp = y + x; elseif (t <= 2.9e+29) tmp = x + (z / (a / y)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.2e+26], N[(y + x), $MachinePrecision], If[LessEqual[t, -6.8e-31], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.52e-48], N[(y + x), $MachinePrecision], If[LessEqual[t, 2.9e+29], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+26}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq -6.8 \cdot 10^{-31}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{elif}\;t \leq -1.52 \cdot 10^{-48}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{+29}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.20000000000000002e26 or -6.8000000000000002e-31 < t < -1.5199999999999999e-48 or 2.8999999999999999e29 < t Initial program 99.9%
Taylor expanded in t around inf 79.2%
+-commutative79.2%
Simplified79.2%
if -1.20000000000000002e26 < t < -6.8000000000000002e-31Initial program 100.0%
Taylor expanded in t around 0 96.2%
if -1.5199999999999999e-48 < t < 2.8999999999999999e29Initial program 94.5%
Taylor expanded in z around inf 89.5%
clear-num89.5%
div-inv90.2%
div-inv90.1%
associate-/r*92.7%
Applied egg-rr92.7%
Taylor expanded in a around inf 80.7%
+-commutative80.7%
*-commutative80.7%
associate-/l*84.7%
Simplified84.7%
Final simplification82.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.5e-104) (not (<= t 9e+28))) (+ x (* y (/ t (- t a)))) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.5e-104) || !(t <= 9e+28)) {
tmp = x + (y * (t / (t - a)));
} else {
tmp = x + (z / (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 ((t <= (-4.5d-104)) .or. (.not. (t <= 9d+28))) then
tmp = x + (y * (t / (t - a)))
else
tmp = x + (z / (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 ((t <= -4.5e-104) || !(t <= 9e+28)) {
tmp = x + (y * (t / (t - a)));
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.5e-104) or not (t <= 9e+28): tmp = x + (y * (t / (t - a))) else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.5e-104) || !(t <= 9e+28)) tmp = Float64(x + Float64(y * Float64(t / Float64(t - a)))); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.5e-104) || ~((t <= 9e+28))) tmp = x + (y * (t / (t - a))); else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.5e-104], N[Not[LessEqual[t, 9e+28]], $MachinePrecision]], N[(x + N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{-104} \lor \neg \left(t \leq 9 \cdot 10^{+28}\right):\\
\;\;\;\;x + y \cdot \frac{t}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -4.4999999999999997e-104 or 8.9999999999999994e28 < t Initial program 99.9%
Taylor expanded in z around 0 85.3%
neg-mul-185.3%
distribute-neg-frac85.3%
Simplified85.3%
frac-2neg85.3%
div-inv85.2%
remove-double-neg85.2%
sub-neg85.2%
distribute-neg-in85.2%
remove-double-neg85.2%
Applied egg-rr85.2%
associate-*r/85.3%
*-rgt-identity85.3%
+-commutative85.3%
unsub-neg85.3%
Simplified85.3%
if -4.4999999999999997e-104 < t < 8.9999999999999994e28Initial program 94.1%
Taylor expanded in z around inf 91.2%
clear-num91.2%
div-inv91.9%
div-inv91.8%
associate-/r*95.4%
Applied egg-rr95.4%
Taylor expanded in a around inf 81.6%
+-commutative81.6%
*-commutative81.6%
associate-/l*86.6%
Simplified86.6%
Final simplification85.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e+126) (not (<= z 5800000.0))) (+ x (* y (/ z (- a t)))) (+ x (* y (/ t (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+126) || !(z <= 5800000.0)) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + (y * (t / (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.35d+126)) .or. (.not. (z <= 5800000.0d0))) then
tmp = x + (y * (z / (a - t)))
else
tmp = x + (y * (t / (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.35e+126) || !(z <= 5800000.0)) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + (y * (t / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.35e+126) or not (z <= 5800000.0): tmp = x + (y * (z / (a - t))) else: tmp = x + (y * (t / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e+126) || !(z <= 5800000.0)) tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); else tmp = Float64(x + Float64(y * Float64(t / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.35e+126) || ~((z <= 5800000.0))) tmp = x + (y * (z / (a - t))); else tmp = x + (y * (t / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.35e+126], N[Not[LessEqual[z, 5800000.0]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+126} \lor \neg \left(z \leq 5800000\right):\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{t - a}\\
\end{array}
\end{array}
if z < -1.35000000000000001e126 or 5.8e6 < z Initial program 93.3%
Taylor expanded in z around inf 86.6%
if -1.35000000000000001e126 < z < 5.8e6Initial program 99.4%
Taylor expanded in z around 0 91.0%
neg-mul-191.0%
distribute-neg-frac91.0%
Simplified91.0%
frac-2neg91.0%
div-inv90.9%
remove-double-neg90.9%
sub-neg90.9%
distribute-neg-in90.9%
remove-double-neg90.9%
Applied egg-rr90.9%
associate-*r/91.0%
*-rgt-identity91.0%
+-commutative91.0%
unsub-neg91.0%
Simplified91.0%
Final simplification89.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.6e+20) (not (<= z 185.0))) (+ x (* z (/ y (- a t)))) (+ x (* y (/ t (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.6e+20) || !(z <= 185.0)) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (y * (t / (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.6d+20)) .or. (.not. (z <= 185.0d0))) then
tmp = x + (z * (y / (a - t)))
else
tmp = x + (y * (t / (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.6e+20) || !(z <= 185.0)) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (y * (t / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.6e+20) or not (z <= 185.0): tmp = x + (z * (y / (a - t))) else: tmp = x + (y * (t / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.6e+20) || !(z <= 185.0)) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); else tmp = Float64(x + Float64(y * Float64(t / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.6e+20) || ~((z <= 185.0))) tmp = x + (z * (y / (a - t))); else tmp = x + (y * (t / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.6e+20], N[Not[LessEqual[z, 185.0]], $MachinePrecision]], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+20} \lor \neg \left(z \leq 185\right):\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{t - a}\\
\end{array}
\end{array}
if z < -2.6e20 or 185 < z Initial program 94.4%
Taylor expanded in z around inf 83.4%
associate-/l*87.8%
associate-/r/91.9%
Simplified91.9%
if -2.6e20 < z < 185Initial program 99.3%
Taylor expanded in z around 0 91.2%
neg-mul-191.2%
distribute-neg-frac91.2%
Simplified91.2%
frac-2neg91.2%
div-inv91.2%
remove-double-neg91.2%
sub-neg91.2%
distribute-neg-in91.2%
remove-double-neg91.2%
Applied egg-rr91.2%
associate-*r/91.2%
*-rgt-identity91.2%
+-commutative91.2%
unsub-neg91.2%
Simplified91.2%
Final simplification91.5%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1e-83)
(+ y x)
(if (<= t 3.2e-190)
x
(if (<= t 4e-122) (* y (/ z a)) (if (<= t 2.5e+22) x (+ y x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1e-83) {
tmp = y + x;
} else if (t <= 3.2e-190) {
tmp = x;
} else if (t <= 4e-122) {
tmp = y * (z / a);
} else if (t <= 2.5e+22) {
tmp = x;
} else {
tmp = y + 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 <= (-1d-83)) then
tmp = y + x
else if (t <= 3.2d-190) then
tmp = x
else if (t <= 4d-122) then
tmp = y * (z / a)
else if (t <= 2.5d+22) then
tmp = x
else
tmp = y + 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 <= -1e-83) {
tmp = y + x;
} else if (t <= 3.2e-190) {
tmp = x;
} else if (t <= 4e-122) {
tmp = y * (z / a);
} else if (t <= 2.5e+22) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1e-83: tmp = y + x elif t <= 3.2e-190: tmp = x elif t <= 4e-122: tmp = y * (z / a) elif t <= 2.5e+22: tmp = x else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1e-83) tmp = Float64(y + x); elseif (t <= 3.2e-190) tmp = x; elseif (t <= 4e-122) tmp = Float64(y * Float64(z / a)); elseif (t <= 2.5e+22) tmp = x; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1e-83) tmp = y + x; elseif (t <= 3.2e-190) tmp = x; elseif (t <= 4e-122) tmp = y * (z / a); elseif (t <= 2.5e+22) tmp = x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1e-83], N[(y + x), $MachinePrecision], If[LessEqual[t, 3.2e-190], x, If[LessEqual[t, 4e-122], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.5e+22], x, N[(y + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{-83}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-190}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-122}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+22}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1e-83 or 2.4999999999999998e22 < t Initial program 99.9%
Taylor expanded in t around inf 76.1%
+-commutative76.1%
Simplified76.1%
if -1e-83 < t < 3.2000000000000001e-190 or 4.00000000000000024e-122 < t < 2.4999999999999998e22Initial program 94.6%
Taylor expanded in x around inf 63.9%
if 3.2000000000000001e-190 < t < 4.00000000000000024e-122Initial program 89.2%
+-commutative89.2%
*-commutative89.2%
div-inv89.1%
associate-*l*89.7%
fma-def89.7%
Applied egg-rr89.7%
Taylor expanded in z around inf 68.7%
associate-/l*78.5%
Simplified78.5%
Taylor expanded in a around inf 67.4%
Taylor expanded in y around 0 47.4%
associate-*r/67.6%
Simplified67.6%
Final simplification70.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8e+130) (not (<= z 6.2e+123))) (* z (/ y (- a t))) (+ y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8e+130) || !(z <= 6.2e+123)) {
tmp = z * (y / (a - t));
} else {
tmp = y + 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 <= (-8d+130)) .or. (.not. (z <= 6.2d+123))) then
tmp = z * (y / (a - t))
else
tmp = y + 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 <= -8e+130) || !(z <= 6.2e+123)) {
tmp = z * (y / (a - t));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8e+130) or not (z <= 6.2e+123): tmp = z * (y / (a - t)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8e+130) || !(z <= 6.2e+123)) tmp = Float64(z * Float64(y / Float64(a - t))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -8e+130) || ~((z <= 6.2e+123))) tmp = z * (y / (a - t)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8e+130], N[Not[LessEqual[z, 6.2e+123]], $MachinePrecision]], N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+130} \lor \neg \left(z \leq 6.2 \cdot 10^{+123}\right):\\
\;\;\;\;z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -8.0000000000000005e130 or 6.20000000000000013e123 < z Initial program 92.6%
+-commutative92.6%
*-commutative92.6%
div-inv92.5%
associate-*l*98.7%
fma-def98.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 52.9%
associate-/l*56.7%
Simplified56.7%
associate-/r/62.7%
Applied egg-rr62.7%
if -8.0000000000000005e130 < z < 6.20000000000000013e123Initial program 98.9%
Taylor expanded in t around inf 72.0%
+-commutative72.0%
Simplified72.0%
Final simplification69.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.5e+26) (not (<= t 2e+31))) (+ y x) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.5e+26) || !(t <= 2e+31)) {
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 <= (-8.5d+26)) .or. (.not. (t <= 2d+31))) 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 <= -8.5e+26) || !(t <= 2e+31)) {
tmp = y + x;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8.5e+26) or not (t <= 2e+31): tmp = y + x else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.5e+26) || !(t <= 2e+31)) 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 <= -8.5e+26) || ~((t <= 2e+31))) tmp = y + x; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.5e+26], N[Not[LessEqual[t, 2e+31]], $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 -8.5 \cdot 10^{+26} \lor \neg \left(t \leq 2 \cdot 10^{+31}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -8.5e26 or 1.9999999999999999e31 < t Initial program 99.9%
Taylor expanded in t around inf 79.5%
+-commutative79.5%
Simplified79.5%
if -8.5e26 < t < 1.9999999999999999e31Initial program 95.2%
Taylor expanded in t around 0 81.4%
Final simplification80.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.2e+23) (not (<= t 1.2e+31))) (+ y x) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.2e+23) || !(t <= 1.2e+31)) {
tmp = y + x;
} else {
tmp = x + (y / (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 ((t <= (-8.2d+23)) .or. (.not. (t <= 1.2d+31))) then
tmp = y + x
else
tmp = x + (y / (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 ((t <= -8.2e+23) || !(t <= 1.2e+31)) {
tmp = y + x;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8.2e+23) or not (t <= 1.2e+31): tmp = y + x else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.2e+23) || !(t <= 1.2e+31)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -8.2e+23) || ~((t <= 1.2e+31))) tmp = y + x; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.2e+23], N[Not[LessEqual[t, 1.2e+31]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+23} \lor \neg \left(t \leq 1.2 \cdot 10^{+31}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -8.19999999999999992e23 or 1.19999999999999991e31 < t Initial program 99.9%
Taylor expanded in t around inf 79.5%
+-commutative79.5%
Simplified79.5%
if -8.19999999999999992e23 < t < 1.19999999999999991e31Initial program 95.2%
Taylor expanded in t around 0 80.3%
+-commutative80.3%
associate-/l*81.9%
Simplified81.9%
Final simplification80.8%
(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.3%
Final simplification97.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -8.5e-84) (+ y x) (if (<= t 5.8e+22) x (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8.5e-84) {
tmp = y + x;
} else if (t <= 5.8e+22) {
tmp = x;
} else {
tmp = y + 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 <= (-8.5d-84)) then
tmp = y + x
else if (t <= 5.8d+22) then
tmp = x
else
tmp = y + 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 <= -8.5e-84) {
tmp = y + x;
} else if (t <= 5.8e+22) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -8.5e-84: tmp = y + x elif t <= 5.8e+22: tmp = x else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8.5e-84) tmp = Float64(y + x); elseif (t <= 5.8e+22) tmp = x; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -8.5e-84) tmp = y + x; elseif (t <= 5.8e+22) tmp = x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8.5e-84], N[(y + x), $MachinePrecision], If[LessEqual[t, 5.8e+22], x, N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{-84}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{+22}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -8.4999999999999994e-84 or 5.8e22 < t Initial program 99.9%
Taylor expanded in t around inf 76.1%
+-commutative76.1%
Simplified76.1%
if -8.4999999999999994e-84 < t < 5.8e22Initial program 94.2%
Taylor expanded in x around inf 60.0%
Final simplification68.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 97.3%
Taylor expanded in x around inf 57.8%
Final simplification57.8%
(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 2023279
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(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)))))