
(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 9 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 (+ 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 98.7%
Final simplification98.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7.5e+187) (and (not (<= t -5.2e+112)) (<= t -6.2e+29))) (+ x y) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7.5e+187) || (!(t <= -5.2e+112) && (t <= -6.2e+29))) {
tmp = x + y;
} 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 <= (-7.5d+187)) .or. (.not. (t <= (-5.2d+112))) .and. (t <= (-6.2d+29))) then
tmp = x + y
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 <= -7.5e+187) || (!(t <= -5.2e+112) && (t <= -6.2e+29))) {
tmp = x + y;
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -7.5e+187) or (not (t <= -5.2e+112) and (t <= -6.2e+29)): tmp = x + y else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7.5e+187) || (!(t <= -5.2e+112) && (t <= -6.2e+29))) tmp = Float64(x + y); 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 <= -7.5e+187) || (~((t <= -5.2e+112)) && (t <= -6.2e+29))) tmp = x + y; else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -7.5e+187], And[N[Not[LessEqual[t, -5.2e+112]], $MachinePrecision], LessEqual[t, -6.2e+29]]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+187} \lor \neg \left(t \leq -5.2 \cdot 10^{+112}\right) \land t \leq -6.2 \cdot 10^{+29}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -7.5000000000000002e187 or -5.2000000000000001e112 < t < -6.1999999999999998e29Initial program 99.9%
Taylor expanded in t around inf 86.9%
if -7.5000000000000002e187 < t < -5.2000000000000001e112 or -6.1999999999999998e29 < t Initial program 98.4%
Taylor expanded in z around inf 88.2%
Final simplification88.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.7e+190) (and (not (<= t -7.6e+112)) (<= t -6.2e+29))) (+ x y) (+ x (/ y (/ (- a t) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.7e+190) || (!(t <= -7.6e+112) && (t <= -6.2e+29))) {
tmp = x + y;
} else {
tmp = x + (y / ((a - 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 <= (-5.7d+190)) .or. (.not. (t <= (-7.6d+112))) .and. (t <= (-6.2d+29))) then
tmp = x + y
else
tmp = x + (y / ((a - 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 <= -5.7e+190) || (!(t <= -7.6e+112) && (t <= -6.2e+29))) {
tmp = x + y;
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -5.7e+190) or (not (t <= -7.6e+112) and (t <= -6.2e+29)): tmp = x + y else: tmp = x + (y / ((a - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.7e+190) || (!(t <= -7.6e+112) && (t <= -6.2e+29))) tmp = Float64(x + y); else tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -5.7e+190) || (~((t <= -7.6e+112)) && (t <= -6.2e+29))) tmp = x + y; else tmp = x + (y / ((a - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.7e+190], And[N[Not[LessEqual[t, -7.6e+112]], $MachinePrecision], LessEqual[t, -6.2e+29]]], N[(x + y), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.7 \cdot 10^{+190} \lor \neg \left(t \leq -7.6 \cdot 10^{+112}\right) \land t \leq -6.2 \cdot 10^{+29}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if t < -5.69999999999999986e190 or -7.60000000000000015e112 < t < -6.1999999999999998e29Initial program 99.9%
Taylor expanded in t around inf 86.9%
if -5.69999999999999986e190 < t < -7.60000000000000015e112 or -6.1999999999999998e29 < t Initial program 98.4%
Taylor expanded in z around inf 83.0%
associate-/l*88.6%
Simplified88.6%
Final simplification88.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.8e+23) (+ x (* z (/ y (- a t)))) (if (<= z 9.8e+45) (- x (* y (/ t (- a t)))) (+ x (/ y (/ (- a t) z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.8e+23) {
tmp = x + (z * (y / (a - t)));
} else if (z <= 9.8e+45) {
tmp = x - (y * (t / (a - t)));
} else {
tmp = x + (y / ((a - 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 (z <= (-3.8d+23)) then
tmp = x + (z * (y / (a - t)))
else if (z <= 9.8d+45) then
tmp = x - (y * (t / (a - t)))
else
tmp = x + (y / ((a - 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 (z <= -3.8e+23) {
tmp = x + (z * (y / (a - t)));
} else if (z <= 9.8e+45) {
tmp = x - (y * (t / (a - t)));
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.8e+23: tmp = x + (z * (y / (a - t))) elif z <= 9.8e+45: tmp = x - (y * (t / (a - t))) else: tmp = x + (y / ((a - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.8e+23) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); elseif (z <= 9.8e+45) tmp = Float64(x - Float64(y * Float64(t / Float64(a - t)))); else tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.8e+23) tmp = x + (z * (y / (a - t))); elseif (z <= 9.8e+45) tmp = x - (y * (t / (a - t))); else tmp = x + (y / ((a - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.8e+23], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.8e+45], N[(x - N[(y * N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+23}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{+45}:\\
\;\;\;\;x - y \cdot \frac{t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if z < -3.79999999999999975e23Initial program 95.3%
Taylor expanded in z around inf 89.4%
add-cube-cbrt88.7%
pow388.6%
Applied egg-rr88.6%
Taylor expanded in y around 0 75.9%
associate-/l*90.8%
associate-/r/93.8%
Simplified93.8%
if -3.79999999999999975e23 < z < 9.8000000000000004e45Initial program 99.8%
Taylor expanded in z around 0 93.6%
neg-mul-193.6%
distribute-neg-frac93.6%
Simplified93.6%
if 9.8000000000000004e45 < z Initial program 99.8%
Taylor expanded in z around inf 77.9%
associate-/l*86.4%
Simplified86.4%
Final simplification92.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6e+29) (not (<= t 2.5e+21))) (+ x y) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6e+29) || !(t <= 2.5e+21)) {
tmp = x + y;
} 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 <= (-6d+29)) .or. (.not. (t <= 2.5d+21))) then
tmp = x + y
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 <= -6e+29) || !(t <= 2.5e+21)) {
tmp = x + y;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -6e+29) or not (t <= 2.5e+21): tmp = x + y else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6e+29) || !(t <= 2.5e+21)) tmp = Float64(x + y); 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 <= -6e+29) || ~((t <= 2.5e+21))) tmp = x + y; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6e+29], N[Not[LessEqual[t, 2.5e+21]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{+29} \lor \neg \left(t \leq 2.5 \cdot 10^{+21}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -5.9999999999999998e29 or 2.5e21 < t Initial program 99.9%
Taylor expanded in t around inf 74.9%
if -5.9999999999999998e29 < t < 2.5e21Initial program 97.6%
Taylor expanded in t around 0 84.9%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.7e+29) (+ x y) (if (<= t 1.95e+20) (+ x (* y (/ z a))) (- x (/ y (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.7e+29) {
tmp = x + y;
} else if (t <= 1.95e+20) {
tmp = x + (y * (z / a));
} 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.7d+29)) then
tmp = x + y
else if (t <= 1.95d+20) then
tmp = x + (y * (z / a))
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.7e+29) {
tmp = x + y;
} else if (t <= 1.95e+20) {
tmp = x + (y * (z / a));
} else {
tmp = x - (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.7e+29: tmp = x + y elif t <= 1.95e+20: tmp = x + (y * (z / a)) else: tmp = x - (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.7e+29) tmp = Float64(x + y); elseif (t <= 1.95e+20) tmp = Float64(x + Float64(y * Float64(z / a))); 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.7e+29) tmp = x + y; elseif (t <= 1.95e+20) tmp = x + (y * (z / a)); else tmp = x - (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.7e+29], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.95e+20], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{+29}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+20}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if t < -2.7e29Initial program 99.9%
Taylor expanded in t around inf 80.1%
if -2.7e29 < t < 1.95e20Initial program 97.6%
Taylor expanded in t around 0 84.6%
if 1.95e20 < t Initial program 99.8%
Taylor expanded in z around inf 75.8%
Taylor expanded in a around 0 62.4%
mul-1-neg62.4%
unsub-neg62.4%
associate-/l*72.1%
Simplified72.1%
Final simplification80.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -9.5e+26) (+ x y) (if (<= t 1.35e+20) (+ x (* y (/ z a))) (- x (* y (/ z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.5e+26) {
tmp = x + y;
} else if (t <= 1.35e+20) {
tmp = x + (y * (z / a));
} 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 (t <= (-9.5d+26)) then
tmp = x + y
else if (t <= 1.35d+20) then
tmp = x + (y * (z / a))
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 (t <= -9.5e+26) {
tmp = x + y;
} else if (t <= 1.35e+20) {
tmp = x + (y * (z / a));
} else {
tmp = x - (y * (z / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -9.5e+26: tmp = x + y elif t <= 1.35e+20: tmp = x + (y * (z / a)) else: tmp = x - (y * (z / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.5e+26) tmp = Float64(x + y); elseif (t <= 1.35e+20) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(x - Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -9.5e+26) tmp = x + y; elseif (t <= 1.35e+20) tmp = x + (y * (z / a)); else tmp = x - (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.5e+26], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.35e+20], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+26}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{+20}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if t < -9.50000000000000054e26Initial program 99.9%
Taylor expanded in t around inf 80.1%
if -9.50000000000000054e26 < t < 1.35e20Initial program 97.6%
Taylor expanded in t around 0 84.6%
if 1.35e20 < t Initial program 99.8%
Taylor expanded in z around inf 75.8%
Taylor expanded in a around 0 72.1%
associate-*r/72.1%
neg-mul-172.1%
Simplified72.1%
Final simplification80.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7.5e+21) (not (<= t 1.25e+20))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7.5e+21) || !(t <= 1.25e+20)) {
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 <= (-7.5d+21)) .or. (.not. (t <= 1.25d+20))) 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 <= -7.5e+21) || !(t <= 1.25e+20)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -7.5e+21) or not (t <= 1.25e+20): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7.5e+21) || !(t <= 1.25e+20)) 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 <= -7.5e+21) || ~((t <= 1.25e+20))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -7.5e+21], N[Not[LessEqual[t, 1.25e+20]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+21} \lor \neg \left(t \leq 1.25 \cdot 10^{+20}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -7.5e21 or 1.25e20 < t Initial program 99.9%
Taylor expanded in t around inf 74.5%
if -7.5e21 < t < 1.25e20Initial program 97.6%
Taylor expanded in z around inf 94.0%
Taylor expanded in x around inf 59.3%
Final simplification66.7%
(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 98.7%
Taylor expanded in z around inf 81.5%
Taylor expanded in x around inf 55.5%
Final simplification55.5%
(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 2023319
(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)))))