
(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 (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
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 / a) * (t - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
def code(x, y, z, t, a): return x + ((y / a) * (t - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y / a) * Float64(t - z))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y / a) * (t - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(t - z\right)
\end{array}
Initial program 93.3%
Taylor expanded in z around 0 85.1%
+-commutative85.1%
mul-1-neg85.1%
*-commutative85.1%
associate-*r/85.0%
associate-/l*87.1%
distribute-lft-neg-in87.1%
distribute-rgt-in98.0%
sub-neg98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ t a))) (t_2 (* y (/ (- z) a))))
(if (<= y -6.6e+157)
(/ (* y (- z)) a)
(if (<= y -2.7e+53)
(* (/ y a) t)
(if (<= y -5e-42)
t_2
(if (<= y 1.45e-44)
x
(if (<= y 6.8e+65)
t_1
(if (<= y 1.65e+130)
t_2
(if (<= y 6.4e+273) t_1 (* (/ y a) (- z)))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (t / a);
double t_2 = y * (-z / a);
double tmp;
if (y <= -6.6e+157) {
tmp = (y * -z) / a;
} else if (y <= -2.7e+53) {
tmp = (y / a) * t;
} else if (y <= -5e-42) {
tmp = t_2;
} else if (y <= 1.45e-44) {
tmp = x;
} else if (y <= 6.8e+65) {
tmp = t_1;
} else if (y <= 1.65e+130) {
tmp = t_2;
} else if (y <= 6.4e+273) {
tmp = t_1;
} else {
tmp = (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = y * (t / a)
t_2 = y * (-z / a)
if (y <= (-6.6d+157)) then
tmp = (y * -z) / a
else if (y <= (-2.7d+53)) then
tmp = (y / a) * t
else if (y <= (-5d-42)) then
tmp = t_2
else if (y <= 1.45d-44) then
tmp = x
else if (y <= 6.8d+65) then
tmp = t_1
else if (y <= 1.65d+130) then
tmp = t_2
else if (y <= 6.4d+273) then
tmp = t_1
else
tmp = (y / a) * -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (t / a);
double t_2 = y * (-z / a);
double tmp;
if (y <= -6.6e+157) {
tmp = (y * -z) / a;
} else if (y <= -2.7e+53) {
tmp = (y / a) * t;
} else if (y <= -5e-42) {
tmp = t_2;
} else if (y <= 1.45e-44) {
tmp = x;
} else if (y <= 6.8e+65) {
tmp = t_1;
} else if (y <= 1.65e+130) {
tmp = t_2;
} else if (y <= 6.4e+273) {
tmp = t_1;
} else {
tmp = (y / a) * -z;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (t / a) t_2 = y * (-z / a) tmp = 0 if y <= -6.6e+157: tmp = (y * -z) / a elif y <= -2.7e+53: tmp = (y / a) * t elif y <= -5e-42: tmp = t_2 elif y <= 1.45e-44: tmp = x elif y <= 6.8e+65: tmp = t_1 elif y <= 1.65e+130: tmp = t_2 elif y <= 6.4e+273: tmp = t_1 else: tmp = (y / a) * -z return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(t / a)) t_2 = Float64(y * Float64(Float64(-z) / a)) tmp = 0.0 if (y <= -6.6e+157) tmp = Float64(Float64(y * Float64(-z)) / a); elseif (y <= -2.7e+53) tmp = Float64(Float64(y / a) * t); elseif (y <= -5e-42) tmp = t_2; elseif (y <= 1.45e-44) tmp = x; elseif (y <= 6.8e+65) tmp = t_1; elseif (y <= 1.65e+130) tmp = t_2; elseif (y <= 6.4e+273) tmp = t_1; else tmp = Float64(Float64(y / a) * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (t / a); t_2 = y * (-z / a); tmp = 0.0; if (y <= -6.6e+157) tmp = (y * -z) / a; elseif (y <= -2.7e+53) tmp = (y / a) * t; elseif (y <= -5e-42) tmp = t_2; elseif (y <= 1.45e-44) tmp = x; elseif (y <= 6.8e+65) tmp = t_1; elseif (y <= 1.65e+130) tmp = t_2; elseif (y <= 6.4e+273) tmp = t_1; else tmp = (y / a) * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[((-z) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.6e+157], N[(N[(y * (-z)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, -2.7e+53], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, -5e-42], t$95$2, If[LessEqual[y, 1.45e-44], x, If[LessEqual[y, 6.8e+65], t$95$1, If[LessEqual[y, 1.65e+130], t$95$2, If[LessEqual[y, 6.4e+273], t$95$1, N[(N[(y / a), $MachinePrecision] * (-z)), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{t}{a}\\
t_2 := y \cdot \frac{-z}{a}\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{+157}:\\
\;\;\;\;\frac{y \cdot \left(-z\right)}{a}\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{+53}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-42}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-44}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+130}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+273}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-z\right)\\
\end{array}
\end{array}
if y < -6.6000000000000003e157Initial program 87.8%
sub-neg87.8%
distribute-frac-neg287.8%
+-commutative87.8%
associate-/l*97.0%
fma-define97.0%
distribute-frac-neg297.0%
distribute-neg-frac97.0%
sub-neg97.0%
distribute-neg-in97.0%
remove-double-neg97.0%
+-commutative97.0%
sub-neg97.0%
Simplified97.0%
Taylor expanded in y around -inf 81.8%
Taylor expanded in t around 0 72.3%
mul-1-neg72.3%
distribute-rgt-neg-out72.3%
Simplified72.3%
if -6.6000000000000003e157 < y < -2.70000000000000019e53Initial program 85.5%
Taylor expanded in t around inf 62.7%
associate-/l*77.0%
Simplified77.0%
if -2.70000000000000019e53 < y < -5.00000000000000003e-42 or 6.7999999999999999e65 < y < 1.65e130Initial program 89.5%
Taylor expanded in z around inf 63.3%
mul-1-neg63.3%
associate-/l*68.3%
distribute-rgt-neg-in68.3%
distribute-neg-frac268.3%
Simplified68.3%
if -5.00000000000000003e-42 < y < 1.4500000000000001e-44Initial program 99.9%
Taylor expanded in x around inf 67.7%
if 1.4500000000000001e-44 < y < 6.7999999999999999e65 or 1.65e130 < y < 6.4000000000000004e273Initial program 92.5%
Taylor expanded in z around 0 76.7%
+-commutative76.7%
mul-1-neg76.7%
*-commutative76.7%
associate-*r/71.9%
associate-/l*74.5%
distribute-lft-neg-in74.5%
distribute-rgt-in96.7%
sub-neg96.7%
Simplified96.7%
Taylor expanded in t around inf 51.3%
*-commutative51.3%
associate-*r/55.5%
Simplified55.5%
if 6.4000000000000004e273 < y Initial program 68.6%
Taylor expanded in z around inf 46.6%
mul-1-neg46.6%
associate-/l*67.6%
distribute-rgt-neg-in67.6%
distribute-neg-frac267.6%
Simplified67.6%
Taylor expanded in y around 0 46.6%
mul-1-neg46.6%
*-commutative46.6%
associate-*r/77.9%
*-commutative77.9%
distribute-lft-neg-in77.9%
distribute-neg-frac277.9%
Simplified77.9%
Final simplification66.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z) a))))
(if (<= y -2.2e+160)
t_1
(if (<= y -9.2e+51)
(* (/ y a) t)
(if (<= y -7e-37)
t_1
(if (<= y 2.6e-45)
x
(if (or (<= y 7.5e+65) (not (<= y 1.85e+130)))
(* y (/ t a))
t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (-z / a);
double tmp;
if (y <= -2.2e+160) {
tmp = t_1;
} else if (y <= -9.2e+51) {
tmp = (y / a) * t;
} else if (y <= -7e-37) {
tmp = t_1;
} else if (y <= 2.6e-45) {
tmp = x;
} else if ((y <= 7.5e+65) || !(y <= 1.85e+130)) {
tmp = y * (t / a);
} 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 = y * (-z / a)
if (y <= (-2.2d+160)) then
tmp = t_1
else if (y <= (-9.2d+51)) then
tmp = (y / a) * t
else if (y <= (-7d-37)) then
tmp = t_1
else if (y <= 2.6d-45) then
tmp = x
else if ((y <= 7.5d+65) .or. (.not. (y <= 1.85d+130))) then
tmp = y * (t / a)
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 = y * (-z / a);
double tmp;
if (y <= -2.2e+160) {
tmp = t_1;
} else if (y <= -9.2e+51) {
tmp = (y / a) * t;
} else if (y <= -7e-37) {
tmp = t_1;
} else if (y <= 2.6e-45) {
tmp = x;
} else if ((y <= 7.5e+65) || !(y <= 1.85e+130)) {
tmp = y * (t / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (-z / a) tmp = 0 if y <= -2.2e+160: tmp = t_1 elif y <= -9.2e+51: tmp = (y / a) * t elif y <= -7e-37: tmp = t_1 elif y <= 2.6e-45: tmp = x elif (y <= 7.5e+65) or not (y <= 1.85e+130): tmp = y * (t / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(-z) / a)) tmp = 0.0 if (y <= -2.2e+160) tmp = t_1; elseif (y <= -9.2e+51) tmp = Float64(Float64(y / a) * t); elseif (y <= -7e-37) tmp = t_1; elseif (y <= 2.6e-45) tmp = x; elseif ((y <= 7.5e+65) || !(y <= 1.85e+130)) tmp = Float64(y * Float64(t / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (-z / a); tmp = 0.0; if (y <= -2.2e+160) tmp = t_1; elseif (y <= -9.2e+51) tmp = (y / a) * t; elseif (y <= -7e-37) tmp = t_1; elseif (y <= 2.6e-45) tmp = x; elseif ((y <= 7.5e+65) || ~((y <= 1.85e+130))) tmp = y * (t / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[((-z) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e+160], t$95$1, If[LessEqual[y, -9.2e+51], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, -7e-37], t$95$1, If[LessEqual[y, 2.6e-45], x, If[Or[LessEqual[y, 7.5e+65], N[Not[LessEqual[y, 1.85e+130]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{-z}{a}\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -9.2 \cdot 10^{+51}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-45}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+65} \lor \neg \left(y \leq 1.85 \cdot 10^{+130}\right):\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.19999999999999992e160 or -9.2000000000000002e51 < y < -7.0000000000000003e-37 or 7.50000000000000006e65 < y < 1.8500000000000001e130Initial program 88.7%
Taylor expanded in z around inf 67.5%
mul-1-neg67.5%
associate-/l*66.2%
distribute-rgt-neg-in66.2%
distribute-neg-frac266.2%
Simplified66.2%
if -2.19999999999999992e160 < y < -9.2000000000000002e51Initial program 85.5%
Taylor expanded in t around inf 62.7%
associate-/l*77.0%
Simplified77.0%
if -7.0000000000000003e-37 < y < 2.59999999999999987e-45Initial program 99.9%
Taylor expanded in x around inf 67.7%
if 2.59999999999999987e-45 < y < 7.50000000000000006e65 or 1.8500000000000001e130 < y Initial program 89.5%
Taylor expanded in z around 0 74.3%
+-commutative74.3%
mul-1-neg74.3%
*-commutative74.3%
associate-*r/72.7%
associate-/l*74.9%
distribute-lft-neg-in74.9%
distribute-rgt-in97.1%
sub-neg97.1%
Simplified97.1%
Taylor expanded in t around inf 49.3%
*-commutative49.3%
associate-*r/54.3%
Simplified54.3%
Final simplification64.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- z))))
(if (<= y -3.3e+158)
t_1
(if (<= y -4.5e+53)
(* (/ y a) t)
(if (<= y -4e-38)
(* y (/ (- z) a))
(if (<= y 9e-45) x (if (<= y 4.5e+64) (* y (/ t a)) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * -z;
double tmp;
if (y <= -3.3e+158) {
tmp = t_1;
} else if (y <= -4.5e+53) {
tmp = (y / a) * t;
} else if (y <= -4e-38) {
tmp = y * (-z / a);
} else if (y <= 9e-45) {
tmp = x;
} else if (y <= 4.5e+64) {
tmp = y * (t / a);
} 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 = (y / a) * -z
if (y <= (-3.3d+158)) then
tmp = t_1
else if (y <= (-4.5d+53)) then
tmp = (y / a) * t
else if (y <= (-4d-38)) then
tmp = y * (-z / a)
else if (y <= 9d-45) then
tmp = x
else if (y <= 4.5d+64) then
tmp = y * (t / a)
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 = (y / a) * -z;
double tmp;
if (y <= -3.3e+158) {
tmp = t_1;
} else if (y <= -4.5e+53) {
tmp = (y / a) * t;
} else if (y <= -4e-38) {
tmp = y * (-z / a);
} else if (y <= 9e-45) {
tmp = x;
} else if (y <= 4.5e+64) {
tmp = y * (t / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * -z tmp = 0 if y <= -3.3e+158: tmp = t_1 elif y <= -4.5e+53: tmp = (y / a) * t elif y <= -4e-38: tmp = y * (-z / a) elif y <= 9e-45: tmp = x elif y <= 4.5e+64: tmp = y * (t / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(-z)) tmp = 0.0 if (y <= -3.3e+158) tmp = t_1; elseif (y <= -4.5e+53) tmp = Float64(Float64(y / a) * t); elseif (y <= -4e-38) tmp = Float64(y * Float64(Float64(-z) / a)); elseif (y <= 9e-45) tmp = x; elseif (y <= 4.5e+64) tmp = Float64(y * Float64(t / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * -z; tmp = 0.0; if (y <= -3.3e+158) tmp = t_1; elseif (y <= -4.5e+53) tmp = (y / a) * t; elseif (y <= -4e-38) tmp = y * (-z / a); elseif (y <= 9e-45) tmp = x; elseif (y <= 4.5e+64) tmp = y * (t / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[y, -3.3e+158], t$95$1, If[LessEqual[y, -4.5e+53], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, -4e-38], N[(y * N[((-z) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e-45], x, If[LessEqual[y, 4.5e+64], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(-z\right)\\
\mathbf{if}\;y \leq -3.3 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{+53}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-38}:\\
\;\;\;\;y \cdot \frac{-z}{a}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-45}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+64}:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.30000000000000017e158 or 4.49999999999999973e64 < y Initial program 85.1%
Taylor expanded in z around inf 51.5%
mul-1-neg51.5%
associate-/l*54.4%
distribute-rgt-neg-in54.4%
distribute-neg-frac254.4%
Simplified54.4%
Taylor expanded in y around 0 51.5%
mul-1-neg51.5%
*-commutative51.5%
associate-*r/57.3%
*-commutative57.3%
distribute-lft-neg-in57.3%
distribute-neg-frac257.3%
Simplified57.3%
if -3.30000000000000017e158 < y < -4.5000000000000002e53Initial program 85.5%
Taylor expanded in t around inf 62.7%
associate-/l*77.0%
Simplified77.0%
if -4.5000000000000002e53 < y < -3.9999999999999998e-38Initial program 95.1%
Taylor expanded in z around inf 70.8%
mul-1-neg70.8%
associate-/l*70.9%
distribute-rgt-neg-in70.9%
distribute-neg-frac270.9%
Simplified70.9%
if -3.9999999999999998e-38 < y < 8.9999999999999997e-45Initial program 99.9%
Taylor expanded in x around inf 67.7%
if 8.9999999999999997e-45 < y < 4.49999999999999973e64Initial program 99.8%
Taylor expanded in z around 0 95.9%
+-commutative95.9%
mul-1-neg95.9%
*-commutative95.9%
associate-*r/95.9%
associate-/l*95.9%
distribute-lft-neg-in95.9%
distribute-rgt-in99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 52.1%
*-commutative52.1%
associate-*r/52.1%
Simplified52.1%
Final simplification63.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -8e-45) (not (<= y 1.65e-142))) (* y (/ (- t z) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -8e-45) || !(y <= 1.65e-142)) {
tmp = y * ((t - z) / 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 <= (-8d-45)) .or. (.not. (y <= 1.65d-142))) then
tmp = y * ((t - z) / 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 <= -8e-45) || !(y <= 1.65e-142)) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -8e-45) or not (y <= 1.65e-142): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -8e-45) || !(y <= 1.65e-142)) tmp = Float64(y * Float64(Float64(t - z) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -8e-45) || ~((y <= 1.65e-142))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -8e-45], N[Not[LessEqual[y, 1.65e-142]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-45} \lor \neg \left(y \leq 1.65 \cdot 10^{-142}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.99999999999999987e-45 or 1.6499999999999998e-142 < y Initial program 90.0%
Taylor expanded in x around 0 73.6%
mul-1-neg73.6%
associate-*r/80.7%
distribute-rgt-neg-in80.7%
neg-sub080.7%
div-sub75.5%
associate-+l-75.5%
neg-sub075.5%
+-commutative75.5%
sub-neg75.5%
div-sub80.7%
Simplified80.7%
if -7.99999999999999987e-45 < y < 1.6499999999999998e-142Initial program 99.9%
Taylor expanded in x around inf 74.2%
Final simplification78.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -9.8e+137) (+ x (/ (* y t) a)) (if (<= t 2.05e+114) (- x (/ y (/ a z))) (* (/ y a) (- t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.8e+137) {
tmp = x + ((y * t) / a);
} else if (t <= 2.05e+114) {
tmp = x - (y / (a / z));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-9.8d+137)) then
tmp = x + ((y * t) / a)
else if (t <= 2.05d+114) then
tmp = x - (y / (a / z))
else
tmp = (y / a) * (t - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.8e+137) {
tmp = x + ((y * t) / a);
} else if (t <= 2.05e+114) {
tmp = x - (y / (a / z));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -9.8e+137: tmp = x + ((y * t) / a) elif t <= 2.05e+114: tmp = x - (y / (a / z)) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.8e+137) tmp = Float64(x + Float64(Float64(y * t) / a)); elseif (t <= 2.05e+114) tmp = Float64(x - Float64(y / Float64(a / z))); else tmp = Float64(Float64(y / a) * Float64(t - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -9.8e+137) tmp = x + ((y * t) / a); elseif (t <= 2.05e+114) tmp = x - (y / (a / z)); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.8e+137], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.05e+114], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.8 \cdot 10^{+137}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;t \leq 2.05 \cdot 10^{+114}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if t < -9.80000000000000065e137Initial program 94.5%
sub-neg94.5%
distribute-frac-neg294.5%
+-commutative94.5%
associate-/l*94.2%
fma-define94.2%
distribute-frac-neg294.2%
distribute-neg-frac94.2%
sub-neg94.2%
distribute-neg-in94.2%
remove-double-neg94.2%
+-commutative94.2%
sub-neg94.2%
Simplified94.2%
Taylor expanded in z around 0 85.7%
if -9.80000000000000065e137 < t < 2.05e114Initial program 95.0%
Taylor expanded in z around inf 83.6%
associate-/l*83.1%
Simplified83.1%
clear-num83.1%
un-div-inv83.2%
Applied egg-rr83.2%
if 2.05e114 < t Initial program 85.1%
Taylor expanded in x around 0 76.5%
mul-1-neg76.5%
associate-*r/84.7%
distribute-rgt-neg-in84.7%
neg-sub084.7%
div-sub77.9%
associate-+l-77.9%
neg-sub077.9%
+-commutative77.9%
sub-neg77.9%
div-sub84.7%
Simplified84.7%
*-commutative84.7%
div-inv84.7%
associate-*l*88.9%
associate-/r/88.8%
clear-num88.9%
Applied egg-rr88.9%
Final simplification84.5%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.75e-36) (* (/ y a) (- t z)) (if (<= y 1.35e+29) (+ x (/ (* y t) a)) (* y (/ (- t z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.75e-36) {
tmp = (y / a) * (t - z);
} else if (y <= 1.35e+29) {
tmp = x + ((y * t) / a);
} else {
tmp = 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 (y <= (-2.75d-36)) then
tmp = (y / a) * (t - z)
else if (y <= 1.35d+29) then
tmp = x + ((y * t) / a)
else
tmp = 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 (y <= -2.75e-36) {
tmp = (y / a) * (t - z);
} else if (y <= 1.35e+29) {
tmp = x + ((y * t) / a);
} else {
tmp = y * ((t - z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.75e-36: tmp = (y / a) * (t - z) elif y <= 1.35e+29: tmp = x + ((y * t) / a) else: tmp = y * ((t - z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.75e-36) tmp = Float64(Float64(y / a) * Float64(t - z)); elseif (y <= 1.35e+29) tmp = Float64(x + Float64(Float64(y * t) / a)); else tmp = Float64(y * Float64(Float64(t - z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.75e-36) tmp = (y / a) * (t - z); elseif (y <= 1.35e+29) tmp = x + ((y * t) / a); else tmp = y * ((t - z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.75e-36], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+29], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{-36}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+29}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\end{array}
\end{array}
if y < -2.74999999999999992e-36Initial program 89.5%
Taylor expanded in x around 0 81.0%
mul-1-neg81.0%
associate-*r/86.5%
distribute-rgt-neg-in86.5%
neg-sub086.5%
div-sub80.3%
associate-+l-80.3%
neg-sub080.3%
+-commutative80.3%
sub-neg80.3%
div-sub86.5%
Simplified86.5%
*-commutative86.5%
div-inv86.4%
associate-*l*88.2%
associate-/r/88.2%
clear-num88.2%
Applied egg-rr88.2%
if -2.74999999999999992e-36 < y < 1.35e29Initial program 99.9%
sub-neg99.9%
distribute-frac-neg299.9%
+-commutative99.9%
associate-/l*88.9%
fma-define88.9%
distribute-frac-neg288.9%
distribute-neg-frac88.9%
sub-neg88.9%
distribute-neg-in88.9%
remove-double-neg88.9%
+-commutative88.9%
sub-neg88.9%
Simplified88.9%
Taylor expanded in z around 0 82.1%
if 1.35e29 < y Initial program 85.5%
Taylor expanded in x around 0 72.4%
mul-1-neg72.4%
associate-*r/85.2%
distribute-rgt-neg-in85.2%
neg-sub085.2%
div-sub78.3%
associate-+l-78.3%
neg-sub078.3%
+-commutative78.3%
sub-neg78.3%
div-sub85.2%
Simplified85.2%
Final simplification84.5%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.7e-45) (* (/ y a) (- t z)) (if (<= y 1.45e-139) x (* y (/ (- t z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.7e-45) {
tmp = (y / a) * (t - z);
} else if (y <= 1.45e-139) {
tmp = x;
} else {
tmp = 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 (y <= (-1.7d-45)) then
tmp = (y / a) * (t - z)
else if (y <= 1.45d-139) then
tmp = x
else
tmp = 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 (y <= -1.7e-45) {
tmp = (y / a) * (t - z);
} else if (y <= 1.45e-139) {
tmp = x;
} else {
tmp = y * ((t - z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.7e-45: tmp = (y / a) * (t - z) elif y <= 1.45e-139: tmp = x else: tmp = y * ((t - z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.7e-45) tmp = Float64(Float64(y / a) * Float64(t - z)); elseif (y <= 1.45e-139) tmp = x; else tmp = Float64(y * Float64(Float64(t - z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.7e-45) tmp = (y / a) * (t - z); elseif (y <= 1.45e-139) tmp = x; else tmp = y * ((t - z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.7e-45], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e-139], x, N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-45}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-139}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\end{array}
\end{array}
if y < -1.70000000000000002e-45Initial program 89.9%
Taylor expanded in x around 0 79.8%
mul-1-neg79.8%
associate-*r/85.1%
distribute-rgt-neg-in85.1%
neg-sub085.1%
div-sub79.1%
associate-+l-79.1%
neg-sub079.1%
+-commutative79.1%
sub-neg79.1%
div-sub85.1%
Simplified85.1%
*-commutative85.1%
div-inv84.9%
associate-*l*86.6%
associate-/r/86.6%
clear-num86.7%
Applied egg-rr86.7%
if -1.70000000000000002e-45 < y < 1.4499999999999999e-139Initial program 99.9%
Taylor expanded in x around inf 74.2%
if 1.4499999999999999e-139 < y Initial program 90.1%
Taylor expanded in x around 0 69.7%
mul-1-neg69.7%
associate-*r/77.9%
distribute-rgt-neg-in77.9%
neg-sub077.9%
div-sub73.2%
associate-+l-73.2%
neg-sub073.2%
+-commutative73.2%
sub-neg73.2%
div-sub77.9%
Simplified77.9%
Final simplification79.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.6e-36) (not (<= y 9.5e-45))) (* (/ y a) t) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.6e-36) || !(y <= 9.5e-45)) {
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 ((y <= (-1.6d-36)) .or. (.not. (y <= 9.5d-45))) 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 ((y <= -1.6e-36) || !(y <= 9.5e-45)) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.6e-36) or not (y <= 9.5e-45): tmp = (y / a) * t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.6e-36) || !(y <= 9.5e-45)) tmp = Float64(Float64(y / a) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.6e-36) || ~((y <= 9.5e-45))) tmp = (y / a) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.6e-36], N[Not[LessEqual[y, 9.5e-45]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-36} \lor \neg \left(y \leq 9.5 \cdot 10^{-45}\right):\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.60000000000000011e-36 or 9.5000000000000002e-45 < y Initial program 88.8%
Taylor expanded in t around inf 38.8%
associate-/l*45.4%
Simplified45.4%
if -1.60000000000000011e-36 < y < 9.5000000000000002e-45Initial program 99.9%
Taylor expanded in x around inf 67.7%
Final simplification54.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 93.3%
Taylor expanded in x around inf 36.5%
(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 2024096
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:alt
(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)))