
(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 (<= t -2e+68)
(+ x y)
(if (<= t -5.1e-27)
(- x (* z (/ y t)))
(if (<= t -4.2e-58)
(- x (* y (/ t a)))
(if (<= t 5e-33) (+ x (/ y (/ a z))) (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2e+68) {
tmp = x + y;
} else if (t <= -5.1e-27) {
tmp = x - (z * (y / t));
} else if (t <= -4.2e-58) {
tmp = x - (y * (t / a));
} else if (t <= 5e-33) {
tmp = x + (y / (a / z));
} else {
tmp = x + 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 <= (-2d+68)) then
tmp = x + y
else if (t <= (-5.1d-27)) then
tmp = x - (z * (y / t))
else if (t <= (-4.2d-58)) then
tmp = x - (y * (t / a))
else if (t <= 5d-33) then
tmp = x + (y / (a / z))
else
tmp = x + 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 <= -2e+68) {
tmp = x + y;
} else if (t <= -5.1e-27) {
tmp = x - (z * (y / t));
} else if (t <= -4.2e-58) {
tmp = x - (y * (t / a));
} else if (t <= 5e-33) {
tmp = x + (y / (a / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2e+68: tmp = x + y elif t <= -5.1e-27: tmp = x - (z * (y / t)) elif t <= -4.2e-58: tmp = x - (y * (t / a)) elif t <= 5e-33: tmp = x + (y / (a / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2e+68) tmp = Float64(x + y); elseif (t <= -5.1e-27) tmp = Float64(x - Float64(z * Float64(y / t))); elseif (t <= -4.2e-58) tmp = Float64(x - Float64(y * Float64(t / a))); elseif (t <= 5e-33) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2e+68) tmp = x + y; elseif (t <= -5.1e-27) tmp = x - (z * (y / t)); elseif (t <= -4.2e-58) tmp = x - (y * (t / a)); elseif (t <= 5e-33) tmp = x + (y / (a / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2e+68], N[(x + y), $MachinePrecision], If[LessEqual[t, -5.1e-27], N[(x - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4.2e-58], N[(x - N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5e-33], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+68}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq -5.1 \cdot 10^{-27}:\\
\;\;\;\;x - z \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{-58}:\\
\;\;\;\;x - y \cdot \frac{t}{a}\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-33}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.99999999999999991e68 or 5.00000000000000028e-33 < t Initial program 99.9%
Taylor expanded in t around inf 80.9%
if -1.99999999999999991e68 < t < -5.0999999999999999e-27Initial program 94.9%
associate-*r/90.0%
*-commutative90.0%
associate-/l*99.5%
Applied egg-rr99.5%
Taylor expanded in z around inf 69.8%
*-commutative69.8%
associate-*r/80.0%
Simplified80.0%
Taylor expanded in a around 0 74.8%
associate-*r/74.8%
neg-mul-174.8%
Simplified74.8%
distribute-frac-neg74.8%
distribute-rgt-neg-out74.8%
add-sqr-sqrt43.1%
sqrt-unprod49.5%
sqr-neg49.5%
sqrt-unprod15.6%
add-sqr-sqrt37.6%
sub-neg37.6%
add-sqr-sqrt15.6%
sqrt-unprod49.5%
sqr-neg49.5%
sqrt-unprod43.1%
add-sqr-sqrt74.8%
Applied egg-rr74.8%
if -5.0999999999999999e-27 < t < -4.19999999999999975e-58Initial program 100.0%
Taylor expanded in a around inf 81.2%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in z around 0 81.2%
associate-*r/81.2%
neg-mul-181.2%
Simplified81.2%
Taylor expanded in x around 0 81.2%
mul-1-neg81.2%
associate-*l/81.2%
distribute-rgt-neg-in81.2%
*-commutative81.2%
cancel-sign-sub-inv81.2%
Simplified81.2%
if -4.19999999999999975e-58 < t < 5.00000000000000028e-33Initial program 98.3%
Taylor expanded in t around 0 77.8%
associate-/l*78.8%
Simplified78.8%
Final simplification79.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.3e+69) (not (<= t 1.3e+107))) (+ x y) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.3e+69) || !(t <= 1.3e+107)) {
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 <= (-1.3d+69)) .or. (.not. (t <= 1.3d+107))) 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 <= -1.3e+69) || !(t <= 1.3e+107)) {
tmp = x + y;
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.3e+69) or not (t <= 1.3e+107): tmp = x + y else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.3e+69) || !(t <= 1.3e+107)) 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 <= -1.3e+69) || ~((t <= 1.3e+107))) 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, -1.3e+69], N[Not[LessEqual[t, 1.3e+107]], $MachinePrecision]], 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 -1.3 \cdot 10^{+69} \lor \neg \left(t \leq 1.3 \cdot 10^{+107}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -1.3000000000000001e69 or 1.3000000000000001e107 < t Initial program 99.9%
Taylor expanded in t around inf 84.8%
if -1.3000000000000001e69 < t < 1.3000000000000001e107Initial program 98.3%
Taylor expanded in z around inf 85.5%
Final simplification85.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.5e+37) (not (<= z 1.1e-143))) (+ x (* z (/ y (- a t)))) (- x (/ y (/ (- a t) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.5e+37) || !(z <= 1.1e-143)) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x - (y / ((a - t) / 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 ((z <= (-1.5d+37)) .or. (.not. (z <= 1.1d-143))) then
tmp = x + (z * (y / (a - t)))
else
tmp = x - (y / ((a - t) / t))
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.5e+37) || !(z <= 1.1e-143)) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x - (y / ((a - t) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.5e+37) or not (z <= 1.1e-143): tmp = x + (z * (y / (a - t))) else: tmp = x - (y / ((a - t) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.5e+37) || !(z <= 1.1e-143)) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); else tmp = Float64(x - Float64(y / Float64(Float64(a - t) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.5e+37) || ~((z <= 1.1e-143))) tmp = x + (z * (y / (a - t))); else tmp = x - (y / ((a - t) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.5e+37], N[Not[LessEqual[z, 1.1e-143]], $MachinePrecision]], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(a - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+37} \lor \neg \left(z \leq 1.1 \cdot 10^{-143}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a - t}{t}}\\
\end{array}
\end{array}
if z < -1.50000000000000011e37 or 1.09999999999999995e-143 < z Initial program 98.5%
associate-*r/87.5%
*-commutative87.5%
associate-/l*98.9%
Applied egg-rr98.9%
Taylor expanded in z around inf 84.2%
*-commutative84.2%
associate-*r/90.8%
Simplified90.8%
if -1.50000000000000011e37 < z < 1.09999999999999995e-143Initial program 99.0%
Taylor expanded in z around 0 77.3%
mul-1-neg77.3%
associate-/l*84.0%
distribute-neg-frac84.0%
Simplified84.0%
Taylor expanded in x around 0 77.3%
mul-1-neg77.3%
unsub-neg77.3%
*-commutative77.3%
associate-/l*88.7%
Simplified88.7%
Final simplification89.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.45e-55) (not (<= t 4.8e+86))) (- x (/ y (/ t (- z t)))) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.45e-55) || !(t <= 4.8e+86)) {
tmp = x - (y / (t / (z - t)));
} 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 <= (-1.45d-55)) .or. (.not. (t <= 4.8d+86))) then
tmp = x - (y / (t / (z - t)))
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 <= -1.45e-55) || !(t <= 4.8e+86)) {
tmp = x - (y / (t / (z - t)));
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.45e-55) or not (t <= 4.8e+86): tmp = x - (y / (t / (z - t))) else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.45e-55) || !(t <= 4.8e+86)) tmp = Float64(x - Float64(y / Float64(t / Float64(z - t)))); 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 <= -1.45e-55) || ~((t <= 4.8e+86))) tmp = x - (y / (t / (z - t))); else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.45e-55], N[Not[LessEqual[t, 4.8e+86]], $MachinePrecision]], N[(x - N[(y / N[(t / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{-55} \lor \neg \left(t \leq 4.8 \cdot 10^{+86}\right):\\
\;\;\;\;x - \frac{y}{\frac{t}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -1.45e-55 or 4.8000000000000001e86 < t Initial program 99.0%
Taylor expanded in a around 0 68.7%
mul-1-neg68.7%
associate-/l*88.3%
distribute-neg-frac88.3%
Simplified88.3%
if -1.45e-55 < t < 4.8000000000000001e86Initial program 98.6%
Taylor expanded in z around inf 89.0%
Final simplification88.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.2e-58) (not (<= t 7.5e-29))) (+ x y) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.2e-58) || !(t <= 7.5e-29)) {
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 <= (-4.2d-58)) .or. (.not. (t <= 7.5d-29))) 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 <= -4.2e-58) || !(t <= 7.5e-29)) {
tmp = x + y;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.2e-58) or not (t <= 7.5e-29): tmp = x + y else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.2e-58) || !(t <= 7.5e-29)) 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 <= -4.2e-58) || ~((t <= 7.5e-29))) tmp = x + y; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.2e-58], N[Not[LessEqual[t, 7.5e-29]], $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 -4.2 \cdot 10^{-58} \lor \neg \left(t \leq 7.5 \cdot 10^{-29}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -4.19999999999999975e-58 or 7.50000000000000006e-29 < t Initial program 99.2%
Taylor expanded in t around inf 76.9%
if -4.19999999999999975e-58 < t < 7.50000000000000006e-29Initial program 98.3%
Taylor expanded in t around 0 78.8%
Final simplification77.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.16e-54) (not (<= t 5e-29))) (+ x y) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.16e-54) || !(t <= 5e-29)) {
tmp = x + y;
} 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 <= (-1.16d-54)) .or. (.not. (t <= 5d-29))) then
tmp = x + y
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 <= -1.16e-54) || !(t <= 5e-29)) {
tmp = x + y;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.16e-54) or not (t <= 5e-29): tmp = x + y else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.16e-54) || !(t <= 5e-29)) tmp = Float64(x + y); 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 <= -1.16e-54) || ~((t <= 5e-29))) tmp = x + y; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.16e-54], N[Not[LessEqual[t, 5e-29]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.16 \cdot 10^{-54} \lor \neg \left(t \leq 5 \cdot 10^{-29}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -1.16e-54 or 4.99999999999999986e-29 < t Initial program 99.2%
Taylor expanded in t around inf 76.9%
if -1.16e-54 < t < 4.99999999999999986e-29Initial program 98.3%
Taylor expanded in t around 0 77.8%
associate-/l*78.8%
Simplified78.8%
Final simplification77.8%
(FPCore (x y z t a) :precision binary64 (if (<= a 1.02e+158) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 1.02e+158) {
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 (a <= 1.02d+158) 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 (a <= 1.02e+158) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 1.02e+158: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 1.02e+158) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 1.02e+158) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 1.02e+158], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.02 \cdot 10^{+158}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < 1.02e158Initial program 99.0%
Taylor expanded in t around inf 58.2%
if 1.02e158 < a Initial program 96.5%
Taylor expanded in a around inf 82.7%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in z around 0 79.6%
associate-*r/79.6%
neg-mul-179.6%
Simplified79.6%
Taylor expanded in x around inf 72.4%
Final simplification59.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 a around inf 59.2%
associate-/l*60.2%
Simplified60.2%
Taylor expanded in z around 0 43.3%
associate-*r/43.3%
neg-mul-143.3%
Simplified43.3%
Taylor expanded in x around inf 48.2%
Final simplification48.2%
(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 2024020
(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)))))