
(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 10 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 (+ 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 92.2%
associate-*l/97.3%
Simplified97.3%
*-commutative97.3%
clear-num97.0%
un-div-inv97.5%
Applied egg-rr97.5%
Final simplification97.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5.4e+134)
(* y (/ z a))
(if (<= z -2.3e-201)
x
(if (<= z 1.65e-273)
(* t (/ y (- a)))
(if (<= z 4.7e+67) x (* z (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.4e+134) {
tmp = y * (z / a);
} else if (z <= -2.3e-201) {
tmp = x;
} else if (z <= 1.65e-273) {
tmp = t * (y / -a);
} else if (z <= 4.7e+67) {
tmp = x;
} else {
tmp = z * (y / 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 <= (-5.4d+134)) then
tmp = y * (z / a)
else if (z <= (-2.3d-201)) then
tmp = x
else if (z <= 1.65d-273) then
tmp = t * (y / -a)
else if (z <= 4.7d+67) then
tmp = x
else
tmp = z * (y / 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 <= -5.4e+134) {
tmp = y * (z / a);
} else if (z <= -2.3e-201) {
tmp = x;
} else if (z <= 1.65e-273) {
tmp = t * (y / -a);
} else if (z <= 4.7e+67) {
tmp = x;
} else {
tmp = z * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.4e+134: tmp = y * (z / a) elif z <= -2.3e-201: tmp = x elif z <= 1.65e-273: tmp = t * (y / -a) elif z <= 4.7e+67: tmp = x else: tmp = z * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.4e+134) tmp = Float64(y * Float64(z / a)); elseif (z <= -2.3e-201) tmp = x; elseif (z <= 1.65e-273) tmp = Float64(t * Float64(y / Float64(-a))); elseif (z <= 4.7e+67) tmp = x; else tmp = Float64(z * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.4e+134) tmp = y * (z / a); elseif (z <= -2.3e-201) tmp = x; elseif (z <= 1.65e-273) tmp = t * (y / -a); elseif (z <= 4.7e+67) tmp = x; else tmp = z * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.4e+134], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.3e-201], x, If[LessEqual[z, 1.65e-273], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.7e+67], x, N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+134}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{-201}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-273}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+67}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -5.4e134Initial program 94.0%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in y around inf 62.0%
Taylor expanded in z around inf 62.1%
if -5.4e134 < z < -2.29999999999999986e-201 or 1.64999999999999995e-273 < z < 4.70000000000000017e67Initial program 92.4%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in x around inf 56.0%
if -2.29999999999999986e-201 < z < 1.64999999999999995e-273Initial program 91.3%
associate-*l/95.4%
Simplified95.4%
Taylor expanded in y around inf 62.1%
Taylor expanded in z around 0 62.1%
mul-1-neg62.1%
distribute-frac-neg62.1%
Simplified62.1%
*-commutative62.1%
frac-2neg62.1%
remove-double-neg62.1%
associate-*r/57.8%
Applied egg-rr57.8%
associate-/l*62.1%
associate-/r/59.9%
Simplified59.9%
if 4.70000000000000017e67 < z Initial program 91.2%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in y around inf 60.4%
sub-div64.9%
associate-/r/75.7%
Applied egg-rr75.7%
Taylor expanded in z around inf 60.6%
*-commutative60.6%
associate-*r/62.8%
Simplified62.8%
Final simplification58.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5.5e+134)
(* y (/ z a))
(if (<= z -5e-195)
x
(if (<= z 1.58e-273)
(* y (/ (- t) a))
(if (<= z 6.8e+67) x (* z (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e+134) {
tmp = y * (z / a);
} else if (z <= -5e-195) {
tmp = x;
} else if (z <= 1.58e-273) {
tmp = y * (-t / a);
} else if (z <= 6.8e+67) {
tmp = x;
} else {
tmp = z * (y / 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 <= (-5.5d+134)) then
tmp = y * (z / a)
else if (z <= (-5d-195)) then
tmp = x
else if (z <= 1.58d-273) then
tmp = y * (-t / a)
else if (z <= 6.8d+67) then
tmp = x
else
tmp = z * (y / 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 <= -5.5e+134) {
tmp = y * (z / a);
} else if (z <= -5e-195) {
tmp = x;
} else if (z <= 1.58e-273) {
tmp = y * (-t / a);
} else if (z <= 6.8e+67) {
tmp = x;
} else {
tmp = z * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.5e+134: tmp = y * (z / a) elif z <= -5e-195: tmp = x elif z <= 1.58e-273: tmp = y * (-t / a) elif z <= 6.8e+67: tmp = x else: tmp = z * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e+134) tmp = Float64(y * Float64(z / a)); elseif (z <= -5e-195) tmp = x; elseif (z <= 1.58e-273) tmp = Float64(y * Float64(Float64(-t) / a)); elseif (z <= 6.8e+67) tmp = x; else tmp = Float64(z * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.5e+134) tmp = y * (z / a); elseif (z <= -5e-195) tmp = x; elseif (z <= 1.58e-273) tmp = y * (-t / a); elseif (z <= 6.8e+67) tmp = x; else tmp = z * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e+134], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5e-195], x, If[LessEqual[z, 1.58e-273], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.8e+67], x, N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+134}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-195}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-273}:\\
\;\;\;\;y \cdot \frac{-t}{a}\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+67}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -5.4999999999999999e134Initial program 94.0%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in y around inf 62.0%
Taylor expanded in z around inf 62.1%
if -5.4999999999999999e134 < z < -5.00000000000000009e-195 or 1.57999999999999994e-273 < z < 6.8000000000000003e67Initial program 92.4%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in x around inf 56.0%
if -5.00000000000000009e-195 < z < 1.57999999999999994e-273Initial program 91.3%
associate-*l/95.4%
Simplified95.4%
Taylor expanded in y around inf 62.1%
Taylor expanded in z around 0 62.1%
mul-1-neg62.1%
distribute-frac-neg62.1%
Simplified62.1%
if 6.8000000000000003e67 < z Initial program 91.2%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in y around inf 60.4%
sub-div64.9%
associate-/r/75.7%
Applied egg-rr75.7%
Taylor expanded in z around inf 60.6%
*-commutative60.6%
associate-*r/62.8%
Simplified62.8%
Final simplification59.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -3.5e-42) (not (<= y 1.45e-74))) (* (- z t) (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3.5e-42) || !(y <= 1.45e-74)) {
tmp = (z - t) * (y / a);
} 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 ((y <= (-3.5d-42)) .or. (.not. (y <= 1.45d-74))) then
tmp = (z - t) * (y / a)
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 ((y <= -3.5e-42) || !(y <= 1.45e-74)) {
tmp = (z - t) * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3.5e-42) or not (y <= 1.45e-74): tmp = (z - t) * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3.5e-42) || !(y <= 1.45e-74)) tmp = Float64(Float64(z - t) * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -3.5e-42) || ~((y <= 1.45e-74))) tmp = (z - t) * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3.5e-42], N[Not[LessEqual[y, 1.45e-74]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-42} \lor \neg \left(y \leq 1.45 \cdot 10^{-74}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.5000000000000002e-42 or 1.45e-74 < y Initial program 86.9%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in y around 0 94.3%
Taylor expanded in a around 0 68.0%
Taylor expanded in z around 0 59.3%
associate-*l/60.1%
mul-1-neg60.1%
associate-/l*64.2%
fma-def65.6%
fma-neg64.2%
associate-/r/62.7%
distribute-lft-out--74.3%
Simplified74.3%
if -3.5000000000000002e-42 < y < 1.45e-74Initial program 98.6%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in x around inf 67.6%
Final simplification71.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -11.5) (not (<= t 1.4e+145))) (* (- z t) (/ y a)) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -11.5) || !(t <= 1.4e+145)) {
tmp = (z - t) * (y / a);
} else {
tmp = x + (z * (y / 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 <= (-11.5d0)) .or. (.not. (t <= 1.4d+145))) then
tmp = (z - t) * (y / a)
else
tmp = x + (z * (y / 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 <= -11.5) || !(t <= 1.4e+145)) {
tmp = (z - t) * (y / a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -11.5) or not (t <= 1.4e+145): tmp = (z - t) * (y / a) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -11.5) || !(t <= 1.4e+145)) tmp = Float64(Float64(z - t) * Float64(y / a)); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -11.5) || ~((t <= 1.4e+145))) tmp = (z - t) * (y / a); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -11.5], N[Not[LessEqual[t, 1.4e+145]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -11.5 \lor \neg \left(t \leq 1.4 \cdot 10^{+145}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -11.5 or 1.3999999999999999e145 < t Initial program 87.0%
associate-*l/98.9%
Simplified98.9%
Taylor expanded in y around 0 85.8%
Taylor expanded in a around 0 64.0%
Taylor expanded in z around 0 56.1%
associate-*l/57.2%
mul-1-neg57.2%
associate-/l*58.9%
fma-def60.9%
fma-neg58.9%
associate-/r/62.7%
distribute-lft-out--70.5%
Simplified70.5%
if -11.5 < t < 1.3999999999999999e145Initial program 95.7%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in t around 0 84.9%
associate-*l/88.0%
*-commutative88.0%
Simplified88.0%
Final simplification81.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.45) (not (<= t 6.1e+72))) (- x (* t (/ y a))) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.45) || !(t <= 6.1e+72)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (z * (y / 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 <= (-1.45d0)) .or. (.not. (t <= 6.1d+72))) then
tmp = x - (t * (y / a))
else
tmp = x + (z * (y / 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 <= -1.45) || !(t <= 6.1e+72)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.45) or not (t <= 6.1e+72): tmp = x - (t * (y / a)) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.45) || !(t <= 6.1e+72)) tmp = Float64(x - Float64(t * Float64(y / a))); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.45) || ~((t <= 6.1e+72))) tmp = x - (t * (y / a)); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.45], N[Not[LessEqual[t, 6.1e+72]], $MachinePrecision]], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \lor \neg \left(t \leq 6.1 \cdot 10^{+72}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -1.44999999999999996 or 6.09999999999999991e72 < t Initial program 86.9%
associate-*l/98.9%
Simplified98.9%
Taylor expanded in z around 0 78.3%
mul-1-neg78.3%
associate-*l/88.8%
distribute-rgt-neg-out88.8%
+-commutative88.8%
*-commutative88.8%
distribute-lft-neg-out88.8%
unsub-neg88.8%
Simplified88.8%
if -1.44999999999999996 < t < 6.09999999999999991e72Initial program 96.2%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in t around 0 84.8%
associate-*l/87.4%
*-commutative87.4%
Simplified87.4%
Final simplification88.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.8e+133) (not (<= z 1.05e+68))) (* z (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.8e+133) || !(z <= 1.05e+68)) {
tmp = z * (y / a);
} 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 ((z <= (-3.8d+133)) .or. (.not. (z <= 1.05d+68))) then
tmp = z * (y / a)
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 ((z <= -3.8e+133) || !(z <= 1.05e+68)) {
tmp = z * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.8e+133) or not (z <= 1.05e+68): tmp = z * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.8e+133) || !(z <= 1.05e+68)) tmp = Float64(z * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.8e+133) || ~((z <= 1.05e+68))) tmp = z * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.8e+133], N[Not[LessEqual[z, 1.05e+68]], $MachinePrecision]], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+133} \lor \neg \left(z \leq 1.05 \cdot 10^{+68}\right):\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.8000000000000002e133 or 1.05e68 < z Initial program 92.4%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in y around inf 61.1%
sub-div66.3%
associate-/r/73.6%
Applied egg-rr73.6%
Taylor expanded in z around inf 58.7%
*-commutative58.7%
associate-*r/61.9%
Simplified61.9%
if -3.8000000000000002e133 < z < 1.05e68Initial program 92.1%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 52.3%
Final simplification55.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.8e+133) (* y (/ z a)) (if (<= z 1.05e+67) x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.8e+133) {
tmp = y * (z / a);
} else if (z <= 1.05e+67) {
tmp = x;
} else {
tmp = z * (y / 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 <= (-3.8d+133)) then
tmp = y * (z / a)
else if (z <= 1.05d+67) then
tmp = x
else
tmp = z * (y / 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 <= -3.8e+133) {
tmp = y * (z / a);
} else if (z <= 1.05e+67) {
tmp = x;
} else {
tmp = z * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.8e+133: tmp = y * (z / a) elif z <= 1.05e+67: tmp = x else: tmp = z * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.8e+133) tmp = Float64(y * Float64(z / a)); elseif (z <= 1.05e+67) tmp = x; else tmp = Float64(z * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.8e+133) tmp = y * (z / a); elseif (z <= 1.05e+67) tmp = x; else tmp = z * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.8e+133], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e+67], x, N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+133}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+67}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -3.8000000000000002e133Initial program 94.0%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in y around inf 62.0%
Taylor expanded in z around inf 62.1%
if -3.8000000000000002e133 < z < 1.0500000000000001e67Initial program 92.1%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 52.3%
if 1.0500000000000001e67 < z Initial program 91.2%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in y around inf 60.4%
sub-div64.9%
associate-/r/75.7%
Applied egg-rr75.7%
Taylor expanded in z around inf 60.6%
*-commutative60.6%
associate-*r/62.8%
Simplified62.8%
Final simplification55.4%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / 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 + ((z - t) * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / a));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{a}
\end{array}
Initial program 92.2%
associate-*l/97.3%
Simplified97.3%
Final simplification97.3%
(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 92.2%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 44.0%
Final simplification44.0%
(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 2023279
(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)))