
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
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)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\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)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
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)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (<= y 5e-43) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 5e-43) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / (a / (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 (y <= 5d-43) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (y / (a / (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 (y <= 5e-43) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 5e-43: tmp = x + ((y * (z - t)) / a) else: tmp = x + (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 5e-43) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 5e-43) tmp = x + ((y * (z - t)) / a); else tmp = x + (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 5e-43], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{-43}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if y < 5.00000000000000019e-43Initial program 97.1%
if 5.00000000000000019e-43 < y Initial program 90.8%
associate-/l*99.9%
Simplified99.9%
Final simplification98.0%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) (- z t) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), (z - t), x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), Float64(z - t), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)
\end{array}
Initial program 95.1%
+-commutative95.1%
associate-*l/97.6%
fma-def97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.25e+185) (+ x (/ (* y z) a)) (if (<= z 4.1e+183) (+ x (/ y (/ a (- z t)))) (+ x (* (/ y a) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.25e+185) {
tmp = x + ((y * z) / a);
} else if (z <= 4.1e+183) {
tmp = x + (y / (a / (z - t)));
} 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 (z <= (-1.25d+185)) then
tmp = x + ((y * z) / a)
else if (z <= 4.1d+183) then
tmp = x + (y / (a / (z - t)))
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 (z <= -1.25e+185) {
tmp = x + ((y * z) / a);
} else if (z <= 4.1e+183) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + ((y / a) * z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.25e+185: tmp = x + ((y * z) / a) elif z <= 4.1e+183: tmp = x + (y / (a / (z - t))) else: tmp = x + ((y / a) * z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.25e+185) tmp = Float64(x + Float64(Float64(y * z) / a)); elseif (z <= 4.1e+183) tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); else tmp = Float64(x + Float64(Float64(y / a) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.25e+185) tmp = x + ((y * z) / a); elseif (z <= 4.1e+183) tmp = x + (y / (a / (z - t))); else tmp = x + ((y / a) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.25e+185], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.1e+183], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+185}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+183}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\end{array}
\end{array}
if z < -1.24999999999999997e185Initial program 99.9%
associate-/l*70.1%
Simplified70.1%
Taylor expanded in z around inf 90.0%
if -1.24999999999999997e185 < z < 4.10000000000000015e183Initial program 95.4%
associate-/l*94.7%
Simplified94.7%
if 4.10000000000000015e183 < z Initial program 88.5%
associate-/l*73.9%
Simplified73.9%
Taylor expanded in t around 0 81.0%
+-commutative81.0%
associate-*l/92.3%
*-commutative92.3%
Simplified92.3%
Final simplification94.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6.2e+65) (not (<= t 2.1e+101))) (* (/ y a) (- t)) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6.2e+65) || !(t <= 2.1e+101)) {
tmp = (y / a) * -t;
} 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 <= (-6.2d+65)) .or. (.not. (t <= 2.1d+101))) then
tmp = (y / a) * -t
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 <= -6.2e+65) || !(t <= 2.1e+101)) {
tmp = (y / a) * -t;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -6.2e+65) or not (t <= 2.1e+101): tmp = (y / a) * -t else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6.2e+65) || !(t <= 2.1e+101)) tmp = Float64(Float64(y / a) * Float64(-t)); 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 <= -6.2e+65) || ~((t <= 2.1e+101))) tmp = (y / a) * -t; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6.2e+65], N[Not[LessEqual[t, 2.1e+101]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{+65} \lor \neg \left(t \leq 2.1 \cdot 10^{+101}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -6.19999999999999981e65 or 2.1e101 < t Initial program 92.4%
associate-/l*80.7%
Simplified80.7%
associate-/l*92.4%
clear-num92.4%
inv-pow92.4%
associate-/r*98.5%
Applied egg-rr98.5%
Taylor expanded in z around 0 78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-commutative78.3%
associate-*l/84.5%
*-commutative84.5%
Simplified84.5%
Taylor expanded in x around 0 60.7%
mul-1-neg60.7%
associate-*r/66.2%
distribute-rgt-neg-in66.2%
distribute-frac-neg66.2%
Simplified66.2%
if -6.19999999999999981e65 < t < 2.1e101Initial program 96.8%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in z around inf 84.7%
Final simplification77.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6.6e+104) (not (<= t 9.5e+101))) (* (/ y a) (- t)) (+ x (* (/ y a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6.6e+104) || !(t <= 9.5e+101)) {
tmp = (y / a) * -t;
} 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 <= (-6.6d+104)) .or. (.not. (t <= 9.5d+101))) then
tmp = (y / a) * -t
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 <= -6.6e+104) || !(t <= 9.5e+101)) {
tmp = (y / a) * -t;
} else {
tmp = x + ((y / a) * z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -6.6e+104) or not (t <= 9.5e+101): tmp = (y / a) * -t else: tmp = x + ((y / a) * z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6.6e+104) || !(t <= 9.5e+101)) tmp = Float64(Float64(y / a) * Float64(-t)); else tmp = Float64(x + Float64(Float64(y / a) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -6.6e+104) || ~((t <= 9.5e+101))) tmp = (y / a) * -t; else tmp = x + ((y / a) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6.6e+104], N[Not[LessEqual[t, 9.5e+101]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.6 \cdot 10^{+104} \lor \neg \left(t \leq 9.5 \cdot 10^{+101}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\end{array}
\end{array}
if t < -6.59999999999999969e104 or 9.49999999999999947e101 < t Initial program 91.7%
associate-/l*80.1%
Simplified80.1%
associate-/l*91.7%
clear-num91.7%
inv-pow91.7%
associate-/r*98.4%
Applied egg-rr98.4%
Taylor expanded in z around 0 77.3%
mul-1-neg77.3%
unsub-neg77.3%
*-commutative77.3%
associate-*l/84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in x around 0 61.1%
mul-1-neg61.1%
associate-*r/67.2%
distribute-rgt-neg-in67.2%
distribute-frac-neg67.2%
Simplified67.2%
if -6.59999999999999969e104 < t < 9.49999999999999947e101Initial program 97.0%
associate-/l*96.4%
Simplified96.4%
Taylor expanded in t around 0 81.9%
+-commutative81.9%
associate-*l/85.5%
*-commutative85.5%
Simplified85.5%
Final simplification78.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -3e+99) (+ x (/ (* y z) a)) (if (<= z 5.2e+39) (- x (* (/ y a) t)) (+ x (* (/ y a) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3e+99) {
tmp = x + ((y * z) / a);
} else if (z <= 5.2e+39) {
tmp = x - ((y / a) * t);
} 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 (z <= (-3d+99)) then
tmp = x + ((y * z) / a)
else if (z <= 5.2d+39) then
tmp = x - ((y / a) * t)
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 (z <= -3e+99) {
tmp = x + ((y * z) / a);
} else if (z <= 5.2e+39) {
tmp = x - ((y / a) * t);
} else {
tmp = x + ((y / a) * z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3e+99: tmp = x + ((y * z) / a) elif z <= 5.2e+39: tmp = x - ((y / a) * t) else: tmp = x + ((y / a) * z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3e+99) tmp = Float64(x + Float64(Float64(y * z) / a)); elseif (z <= 5.2e+39) tmp = Float64(x - Float64(Float64(y / a) * t)); else tmp = Float64(x + Float64(Float64(y / a) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3e+99) tmp = x + ((y * z) / a); elseif (z <= 5.2e+39) tmp = x - ((y / a) * t); else tmp = x + ((y / a) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3e+99], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e+39], N[(x - N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+99}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+39}:\\
\;\;\;\;x - \frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\end{array}
\end{array}
if z < -3.00000000000000014e99Initial program 99.8%
associate-/l*83.9%
Simplified83.9%
Taylor expanded in z around inf 84.0%
if -3.00000000000000014e99 < z < 5.2e39Initial program 95.2%
associate-/l*94.5%
Simplified94.5%
associate-/l*95.2%
clear-num95.2%
inv-pow95.2%
associate-/r*97.0%
Applied egg-rr97.0%
Taylor expanded in z around 0 89.0%
mul-1-neg89.0%
unsub-neg89.0%
*-commutative89.0%
associate-*l/90.8%
*-commutative90.8%
Simplified90.8%
if 5.2e39 < z Initial program 91.1%
associate-/l*83.6%
Simplified83.6%
Taylor expanded in t around 0 80.5%
+-commutative80.5%
associate-*l/87.5%
*-commutative87.5%
Simplified87.5%
Final simplification89.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.1e+62) (not (<= t 4.5e-55))) (* (/ y a) (- t)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.1e+62) || !(t <= 4.5e-55)) {
tmp = (y / a) * -t;
} 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 <= (-1.1d+62)) .or. (.not. (t <= 4.5d-55))) then
tmp = (y / a) * -t
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 <= -1.1e+62) || !(t <= 4.5e-55)) {
tmp = (y / a) * -t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.1e+62) or not (t <= 4.5e-55): tmp = (y / a) * -t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.1e+62) || !(t <= 4.5e-55)) tmp = Float64(Float64(y / a) * Float64(-t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.1e+62) || ~((t <= 4.5e-55))) tmp = (y / a) * -t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.1e+62], N[Not[LessEqual[t, 4.5e-55]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+62} \lor \neg \left(t \leq 4.5 \cdot 10^{-55}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.10000000000000007e62 or 4.4999999999999997e-55 < t Initial program 93.6%
associate-/l*84.8%
Simplified84.8%
associate-/l*93.6%
clear-num93.6%
inv-pow93.6%
associate-/r*98.8%
Applied egg-rr98.8%
Taylor expanded in z around 0 75.9%
mul-1-neg75.9%
unsub-neg75.9%
*-commutative75.9%
associate-*l/80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in x around 0 55.6%
mul-1-neg55.6%
associate-*r/59.7%
distribute-rgt-neg-in59.7%
distribute-frac-neg59.7%
Simplified59.7%
if -1.10000000000000007e62 < t < 4.4999999999999997e-55Initial program 96.8%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in x around inf 57.0%
Final simplification58.4%
(FPCore (x y z t a) :precision binary64 (+ x (/ (- z t) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
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 + ((z - t) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
def code(x, y, z, t, a): return x + ((z - t) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{\frac{a}{y}}
\end{array}
Initial program 95.1%
*-commutative95.1%
associate-/l*97.5%
Simplified97.5%
Final simplification97.5%
(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 95.1%
associate-/l*90.5%
Simplified90.5%
Taylor expanded in x around inf 39.1%
Final simplification39.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(+ x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(+ x (/ (* y (- z t)) a))
(+ x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / 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 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x + (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (y / 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 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x + (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) / a) else: tmp = x + (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x + Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x + (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) / a); else tmp = x + (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x + N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x + \frac{1}{\frac{t_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t_1}\\
\end{array}
\end{array}
herbie shell --seed 2023322
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (+ x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))
(+ x (/ (* y (- z t)) a)))