
(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 (if (<= a -4.1e+40) (- x (/ y (/ a (- z t)))) (if (<= a 1.75e-38) (+ x (/ (* y (- t z)) a)) (+ x (* y (/ (- t z) a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.1e+40) {
tmp = x - (y / (a / (z - t)));
} else if (a <= 1.75e-38) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = x + (y * ((t - 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 (a <= (-4.1d+40)) then
tmp = x - (y / (a / (z - t)))
else if (a <= 1.75d-38) then
tmp = x + ((y * (t - z)) / a)
else
tmp = x + (y * ((t - 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 (a <= -4.1e+40) {
tmp = x - (y / (a / (z - t)));
} else if (a <= 1.75e-38) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = x + (y * ((t - z) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.1e+40: tmp = x - (y / (a / (z - t))) elif a <= 1.75e-38: tmp = x + ((y * (t - z)) / a) else: tmp = x + (y * ((t - z) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.1e+40) tmp = Float64(x - Float64(y / Float64(a / Float64(z - t)))); elseif (a <= 1.75e-38) tmp = Float64(x + Float64(Float64(y * Float64(t - z)) / a)); else tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.1e+40) tmp = x - (y / (a / (z - t))); elseif (a <= 1.75e-38) tmp = x + ((y * (t - z)) / a); else tmp = x + (y * ((t - z) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.1e+40], N[(x - N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.75e-38], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.1 \cdot 10^{+40}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\
\mathbf{elif}\;a \leq 1.75 \cdot 10^{-38}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\end{array}
\end{array}
if a < -4.1000000000000002e40Initial program 87.5%
associate-/l*99.9%
Simplified99.9%
if -4.1000000000000002e40 < a < 1.7500000000000001e-38Initial program 99.9%
if 1.7500000000000001e-38 < a Initial program 90.1%
associate-*r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.3e+42) (not (<= z 1.15e-102))) (+ x (* (/ y a) (- t z))) (+ x (* y (/ (- t z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.3e+42) || !(z <= 1.15e-102)) {
tmp = x + ((y / a) * (t - z));
} else {
tmp = x + (y * ((t - 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 ((z <= (-5.3d+42)) .or. (.not. (z <= 1.15d-102))) then
tmp = x + ((y / a) * (t - z))
else
tmp = x + (y * ((t - 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 ((z <= -5.3e+42) || !(z <= 1.15e-102)) {
tmp = x + ((y / a) * (t - z));
} else {
tmp = x + (y * ((t - z) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.3e+42) or not (z <= 1.15e-102): tmp = x + ((y / a) * (t - z)) else: tmp = x + (y * ((t - z) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.3e+42) || !(z <= 1.15e-102)) tmp = Float64(x + Float64(Float64(y / a) * Float64(t - z))); else tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5.3e+42) || ~((z <= 1.15e-102))) tmp = x + ((y / a) * (t - z)); else tmp = x + (y * ((t - z) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.3e+42], N[Not[LessEqual[z, 1.15e-102]], $MachinePrecision]], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{+42} \lor \neg \left(z \leq 1.15 \cdot 10^{-102}\right):\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\end{array}
\end{array}
if z < -5.30000000000000028e42 or 1.14999999999999993e-102 < z Initial program 92.3%
associate-*l/98.4%
Simplified98.4%
if -5.30000000000000028e42 < z < 1.14999999999999993e-102Initial program 97.3%
associate-*r/99.9%
Simplified99.9%
Final simplification99.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.5e+135) (not (<= t 1e-59))) (+ x (* y (/ t a))) (- x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.5e+135) || !(t <= 1e-59)) {
tmp = x + (y * (t / a));
} else {
tmp = x - (z / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-4.5d+135)) .or. (.not. (t <= 1d-59))) then
tmp = x + (y * (t / a))
else
tmp = x - (z / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.5e+135) || !(t <= 1e-59)) {
tmp = x + (y * (t / a));
} else {
tmp = x - (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.5e+135) or not (t <= 1e-59): tmp = x + (y * (t / a)) else: tmp = x - (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.5e+135) || !(t <= 1e-59)) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x - Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.5e+135) || ~((t <= 1e-59))) tmp = x + (y * (t / a)); else tmp = x - (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.5e+135], N[Not[LessEqual[t, 1e-59]], $MachinePrecision]], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{+135} \lor \neg \left(t \leq 10^{-59}\right):\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -4.50000000000000007e135 or 1e-59 < t Initial program 95.8%
associate-*r/90.6%
Simplified90.6%
Taylor expanded in z around 0 82.9%
neg-mul-182.9%
distribute-neg-frac82.9%
Simplified82.9%
if -4.50000000000000007e135 < t < 1e-59Initial program 93.7%
associate-/l*93.2%
Simplified93.2%
add-cube-cbrt92.8%
div-inv92.8%
times-frac95.9%
pow295.9%
Applied egg-rr95.9%
Taylor expanded in z around inf 84.6%
*-commutative84.6%
associate-/l*89.9%
Simplified89.9%
Final simplification87.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.1e+135) (not (<= t 1.6e-42))) (+ x (* t (/ y a))) (- x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.1e+135) || !(t <= 1.6e-42)) {
tmp = x + (t * (y / a));
} else {
tmp = x - (z / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-2.1d+135)) .or. (.not. (t <= 1.6d-42))) then
tmp = x + (t * (y / a))
else
tmp = x - (z / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.1e+135) || !(t <= 1.6e-42)) {
tmp = x + (t * (y / a));
} else {
tmp = x - (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.1e+135) or not (t <= 1.6e-42): tmp = x + (t * (y / a)) else: tmp = x - (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.1e+135) || !(t <= 1.6e-42)) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(x - Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.1e+135) || ~((t <= 1.6e-42))) tmp = x + (t * (y / a)); else tmp = x - (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.1e+135], N[Not[LessEqual[t, 1.6e-42]], $MachinePrecision]], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+135} \lor \neg \left(t \leq 1.6 \cdot 10^{-42}\right):\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -2.1000000000000001e135 or 1.60000000000000012e-42 < t Initial program 95.7%
associate-*r/90.4%
Simplified90.4%
Taylor expanded in z around 0 84.7%
mul-1-neg84.7%
associate-*l/87.0%
distribute-rgt-neg-out87.0%
Simplified87.0%
if -2.1000000000000001e135 < t < 1.60000000000000012e-42Initial program 93.7%
associate-/l*93.3%
Simplified93.3%
add-cube-cbrt92.9%
div-inv92.9%
times-frac95.9%
pow295.9%
Applied egg-rr95.9%
Taylor expanded in z around inf 84.3%
*-commutative84.3%
associate-/l*89.5%
Simplified89.5%
Final simplification88.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.8e+135) (+ x (/ (* y t) a)) (if (<= t 2.3e-42) (- x (/ z (/ a y))) (+ x (* t (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.8e+135) {
tmp = x + ((y * t) / a);
} else if (t <= 2.3e-42) {
tmp = x - (z / (a / y));
} else {
tmp = x + (t * (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 <= (-2.8d+135)) then
tmp = x + ((y * t) / a)
else if (t <= 2.3d-42) then
tmp = x - (z / (a / y))
else
tmp = x + (t * (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 <= -2.8e+135) {
tmp = x + ((y * t) / a);
} else if (t <= 2.3e-42) {
tmp = x - (z / (a / y));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.8e+135: tmp = x + ((y * t) / a) elif t <= 2.3e-42: tmp = x - (z / (a / y)) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.8e+135) tmp = Float64(x + Float64(Float64(y * t) / a)); elseif (t <= 2.3e-42) tmp = Float64(x - Float64(z / Float64(a / y))); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.8e+135) tmp = x + ((y * t) / a); elseif (t <= 2.3e-42) tmp = x - (z / (a / y)); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.8e+135], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.3e-42], N[(x - N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+135}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-42}:\\
\;\;\;\;x - \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -2.80000000000000002e135Initial program 96.6%
Taylor expanded in z around 0 89.9%
mul-1-neg89.9%
distribute-rgt-neg-out89.9%
Simplified89.9%
if -2.80000000000000002e135 < t < 2.30000000000000004e-42Initial program 93.7%
associate-/l*93.3%
Simplified93.3%
add-cube-cbrt92.9%
div-inv92.9%
times-frac95.9%
pow295.9%
Applied egg-rr95.9%
Taylor expanded in z around inf 84.3%
*-commutative84.3%
associate-/l*89.5%
Simplified89.5%
if 2.30000000000000004e-42 < t Initial program 95.3%
associate-*r/92.1%
Simplified92.1%
Taylor expanded in z around 0 82.1%
mul-1-neg82.1%
associate-*l/85.6%
distribute-rgt-neg-out85.6%
Simplified85.6%
Final simplification88.7%
(FPCore (x y z t a) :precision binary64 (if (<= z 3e+127) (+ x (* y (/ (- t z) a))) (- x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 3e+127) {
tmp = x + (y * ((t - z) / 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 (z <= 3d+127) then
tmp = x + (y * ((t - z) / 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 (z <= 3e+127) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x - (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= 3e+127: tmp = x + (y * ((t - z) / a)) else: tmp = x - (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= 3e+127) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / 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 (z <= 3e+127) tmp = x + (y * ((t - z) / a)); else tmp = x - (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 3e+127], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3 \cdot 10^{+127}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < 3.0000000000000002e127Initial program 95.9%
associate-*r/94.7%
Simplified94.7%
if 3.0000000000000002e127 < z Initial program 87.3%
associate-*r/80.6%
Simplified80.6%
Taylor expanded in z around inf 80.3%
associate-*l/90.8%
*-commutative90.8%
Simplified90.8%
Final simplification94.0%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ z a))))
double code(double x, double y, double z, double t, double a) {
return x + (y * (z / 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 / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * (z / a));
}
def code(x, y, z, t, a): return x + (y * (z / a))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(z / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * (z / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z}{a}
\end{array}
Initial program 94.4%
associate-*r/92.2%
Simplified92.2%
Taylor expanded in z around inf 70.0%
*-commutative70.0%
frac-2neg70.0%
associate-*l/70.7%
add-sqr-sqrt33.7%
sqrt-unprod49.4%
sqr-neg49.4%
sqrt-unprod22.0%
add-sqr-sqrt44.3%
Applied egg-rr44.3%
div-inv44.3%
distribute-lft-neg-out44.3%
cancel-sign-sub44.3%
associate-*r*45.0%
add-sqr-sqrt25.0%
sqrt-unprod50.2%
sqr-neg50.2%
sqrt-unprod34.3%
add-sqr-sqrt74.6%
associate-*l*70.6%
*-commutative70.6%
associate-*l*70.0%
add-sqr-sqrt33.7%
sqrt-unprod50.0%
sqr-neg50.0%
sqrt-unprod24.6%
add-sqr-sqrt44.6%
div-inv44.6%
Applied egg-rr44.6%
Final simplification44.6%
(FPCore (x y z t a) :precision binary64 (- x (* y (/ z a))))
double code(double x, double y, double z, double t, double a) {
return x - (y * (z / 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 / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (y * (z / a));
}
def code(x, y, z, t, a): return x - (y * (z / a))
function code(x, y, z, t, a) return Float64(x - Float64(y * Float64(z / a))) end
function tmp = code(x, y, z, t, a) tmp = x - (y * (z / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - y \cdot \frac{z}{a}
\end{array}
Initial program 94.4%
associate-*r/92.2%
Simplified92.2%
Taylor expanded in z around inf 70.0%
Final simplification70.0%
(FPCore (x y z t a) :precision binary64 (- x (* z (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x - (z * (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 * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (z * (y / a));
}
def code(x, y, z, t, a): return x - (z * (y / a))
function code(x, y, z, t, a) return Float64(x - Float64(z * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x - (z * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - z \cdot \frac{y}{a}
\end{array}
Initial program 94.4%
associate-*r/92.2%
Simplified92.2%
Taylor expanded in z around inf 70.7%
associate-*l/74.6%
*-commutative74.6%
Simplified74.6%
Final simplification74.6%
(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 94.4%
associate-*r/92.2%
Simplified92.2%
Taylor expanded in z around inf 70.0%
*-commutative70.0%
frac-2neg70.0%
associate-*l/70.7%
add-sqr-sqrt33.7%
sqrt-unprod49.4%
sqr-neg49.4%
sqrt-unprod22.0%
add-sqr-sqrt44.3%
Applied egg-rr44.3%
Taylor expanded in x around inf 42.4%
Final simplification42.4%
(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 2023230
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
: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)))