
(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 13 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 (/ (- t z) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (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 + ((t - z) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (a / y));
}
def code(x, y, z, t, a): return x + ((t - z) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(t - z) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((t - z) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{t - z}{\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
(let* ((t_1 (* z (/ (- y) a))))
(if (<= z -4e+133)
t_1
(if (<= z -7.5e-202)
x
(if (<= z 1.85e-273) (* y (/ t a)) (if (<= z 6e+69) x t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (-y / a);
double tmp;
if (z <= -4e+133) {
tmp = t_1;
} else if (z <= -7.5e-202) {
tmp = x;
} else if (z <= 1.85e-273) {
tmp = y * (t / a);
} else if (z <= 6e+69) {
tmp = x;
} 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 = z * (-y / a)
if (z <= (-4d+133)) then
tmp = t_1
else if (z <= (-7.5d-202)) then
tmp = x
else if (z <= 1.85d-273) then
tmp = y * (t / a)
else if (z <= 6d+69) then
tmp = x
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 = z * (-y / a);
double tmp;
if (z <= -4e+133) {
tmp = t_1;
} else if (z <= -7.5e-202) {
tmp = x;
} else if (z <= 1.85e-273) {
tmp = y * (t / a);
} else if (z <= 6e+69) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (-y / a) tmp = 0 if z <= -4e+133: tmp = t_1 elif z <= -7.5e-202: tmp = x elif z <= 1.85e-273: tmp = y * (t / a) elif z <= 6e+69: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(Float64(-y) / a)) tmp = 0.0 if (z <= -4e+133) tmp = t_1; elseif (z <= -7.5e-202) tmp = x; elseif (z <= 1.85e-273) tmp = Float64(y * Float64(t / a)); elseif (z <= 6e+69) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (-y / a); tmp = 0.0; if (z <= -4e+133) tmp = t_1; elseif (z <= -7.5e-202) tmp = x; elseif (z <= 1.85e-273) tmp = y * (t / a); elseif (z <= 6e+69) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e+133], t$95$1, If[LessEqual[z, -7.5e-202], x, If[LessEqual[z, 1.85e-273], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e+69], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{-y}{a}\\
\mathbf{if}\;z \leq -4 \cdot 10^{+133}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{-202}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-273}:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+69}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.0000000000000001e133 or 5.99999999999999967e69 < z Initial program 92.5%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in z around inf 59.0%
mul-1-neg59.0%
associate-*l/62.1%
*-commutative62.1%
Simplified62.1%
if -4.0000000000000001e133 < z < -7.50000000000000005e-202 or 1.8500000000000002e-273 < z < 5.99999999999999967e69Initial program 92.5%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in x around inf 56.2%
if -7.50000000000000005e-202 < z < 1.8500000000000002e-273Initial program 90.9%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in t around inf 57.2%
associate-/l*59.4%
associate-/r/61.5%
Applied egg-rr61.5%
Final simplification58.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.8e+135)
(* (/ z a) (- y))
(if (<= z -9.2e-198)
x
(if (<= z 1.6e-273)
(* y (/ t a))
(if (<= z 2.9e+67) x (* z (/ (- y) a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.8e+135) {
tmp = (z / a) * -y;
} else if (z <= -9.2e-198) {
tmp = x;
} else if (z <= 1.6e-273) {
tmp = y * (t / a);
} else if (z <= 2.9e+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 <= (-2.8d+135)) then
tmp = (z / a) * -y
else if (z <= (-9.2d-198)) then
tmp = x
else if (z <= 1.6d-273) then
tmp = y * (t / a)
else if (z <= 2.9d+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 <= -2.8e+135) {
tmp = (z / a) * -y;
} else if (z <= -9.2e-198) {
tmp = x;
} else if (z <= 1.6e-273) {
tmp = y * (t / a);
} else if (z <= 2.9e+67) {
tmp = x;
} else {
tmp = z * (-y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.8e+135: tmp = (z / a) * -y elif z <= -9.2e-198: tmp = x elif z <= 1.6e-273: tmp = y * (t / a) elif z <= 2.9e+67: tmp = x else: tmp = z * (-y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.8e+135) tmp = Float64(Float64(z / a) * Float64(-y)); elseif (z <= -9.2e-198) tmp = x; elseif (z <= 1.6e-273) tmp = Float64(y * Float64(t / a)); elseif (z <= 2.9e+67) tmp = x; else tmp = Float64(z * Float64(Float64(-y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.8e+135) tmp = (z / a) * -y; elseif (z <= -9.2e-198) tmp = x; elseif (z <= 1.6e-273) tmp = y * (t / a); elseif (z <= 2.9e+67) tmp = x; else tmp = z * (-y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e+135], N[(N[(z / a), $MachinePrecision] * (-y)), $MachinePrecision], If[LessEqual[z, -9.2e-198], x, If[LessEqual[z, 1.6e-273], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e+67], x, N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+135}:\\
\;\;\;\;\frac{z}{a} \cdot \left(-y\right)\\
\mathbf{elif}\;z \leq -9.2 \cdot 10^{-198}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-273}:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+67}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-y}{a}\\
\end{array}
\end{array}
if z < -2.80000000000000002e135Initial program 94.1%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in z around inf 56.6%
mul-1-neg56.6%
*-commutative56.6%
associate-/l*59.7%
associate-/r/62.6%
Simplified62.6%
if -2.80000000000000002e135 < z < -9.20000000000000053e-198 or 1.59999999999999995e-273 < z < 2.90000000000000023e67Initial program 92.5%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in x around inf 56.2%
if -9.20000000000000053e-198 < z < 1.59999999999999995e-273Initial program 90.9%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in t around inf 57.2%
associate-/l*59.4%
associate-/r/61.5%
Applied egg-rr61.5%
if 2.90000000000000023e67 < z Initial program 91.4%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around inf 60.8%
mul-1-neg60.8%
associate-*l/62.9%
*-commutative62.9%
Simplified62.9%
Final simplification59.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -520.0)
(* t (/ y a))
(if (<= t 1.9e+143)
x
(if (<= t 7.2e+198) (/ y (/ a t)) (if (<= t 2.4e+209) x (/ t (/ a y)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -520.0) {
tmp = t * (y / a);
} else if (t <= 1.9e+143) {
tmp = x;
} else if (t <= 7.2e+198) {
tmp = y / (a / t);
} else if (t <= 2.4e+209) {
tmp = x;
} else {
tmp = t / (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 <= (-520.0d0)) then
tmp = t * (y / a)
else if (t <= 1.9d+143) then
tmp = x
else if (t <= 7.2d+198) then
tmp = y / (a / t)
else if (t <= 2.4d+209) then
tmp = x
else
tmp = t / (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 <= -520.0) {
tmp = t * (y / a);
} else if (t <= 1.9e+143) {
tmp = x;
} else if (t <= 7.2e+198) {
tmp = y / (a / t);
} else if (t <= 2.4e+209) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -520.0: tmp = t * (y / a) elif t <= 1.9e+143: tmp = x elif t <= 7.2e+198: tmp = y / (a / t) elif t <= 2.4e+209: tmp = x else: tmp = t / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -520.0) tmp = Float64(t * Float64(y / a)); elseif (t <= 1.9e+143) tmp = x; elseif (t <= 7.2e+198) tmp = Float64(y / Float64(a / t)); elseif (t <= 2.4e+209) tmp = x; else tmp = Float64(t / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -520.0) tmp = t * (y / a); elseif (t <= 1.9e+143) tmp = x; elseif (t <= 7.2e+198) tmp = y / (a / t); elseif (t <= 2.4e+209) tmp = x; else tmp = t / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -520.0], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.9e+143], x, If[LessEqual[t, 7.2e+198], N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e+209], x, N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -520:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{+143}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+198}:\\
\;\;\;\;\frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+209}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -520Initial program 91.1%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in t around inf 55.3%
associate-*r/59.8%
Simplified59.8%
if -520 < t < 1.9e143 or 7.2000000000000004e198 < t < 2.39999999999999996e209Initial program 95.3%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in x around inf 54.8%
if 1.9e143 < t < 7.2000000000000004e198Initial program 87.1%
associate-*l/93.5%
Simplified93.5%
Taylor expanded in t around inf 47.8%
associate-*r/54.0%
Simplified54.0%
associate-*r/47.8%
*-commutative47.8%
associate-/l*59.5%
Applied egg-rr59.5%
if 2.39999999999999996e209 < t Initial program 75.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in t around inf 69.8%
associate-/l*76.2%
Simplified76.2%
Final simplification57.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -2.9e-22) (not (<= y 3.2e-77))) (* (/ y a) (- t z)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.9e-22) || !(y <= 3.2e-77)) {
tmp = (y / a) * (t - z);
} 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 <= (-2.9d-22)) .or. (.not. (y <= 3.2d-77))) then
tmp = (y / a) * (t - z)
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 <= -2.9e-22) || !(y <= 3.2e-77)) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -2.9e-22) or not (y <= 3.2e-77): tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -2.9e-22) || !(y <= 3.2e-77)) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -2.9e-22) || ~((y <= 3.2e-77))) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -2.9e-22], N[Not[LessEqual[y, 3.2e-77]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-22} \lor \neg \left(y \leq 3.2 \cdot 10^{-77}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.9000000000000002e-22 or 3.2e-77 < y Initial program 86.8%
associate-*l/97.2%
Simplified97.2%
*-commutative97.2%
clear-num97.1%
un-div-inv98.1%
Applied egg-rr98.1%
Taylor expanded in x around 0 68.4%
mul-1-neg68.4%
associate-*l/74.9%
distribute-rgt-out--63.1%
sub-neg63.1%
+-commutative63.1%
distribute-neg-in63.1%
remove-double-neg63.1%
sub-neg63.1%
distribute-rgt-out--74.9%
Simplified74.9%
if -2.9000000000000002e-22 < y < 3.2e-77Initial program 98.6%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in x around inf 67.2%
Final simplification71.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.6e+134) (not (<= z 8.2e+68))) (* (/ y a) (- t z)) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.6e+134) || !(z <= 8.2e+68)) {
tmp = (y / a) * (t - z);
} 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 ((z <= (-6.6d+134)) .or. (.not. (z <= 8.2d+68))) then
tmp = (y / a) * (t - z)
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 ((z <= -6.6e+134) || !(z <= 8.2e+68)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.6e+134) or not (z <= 8.2e+68): tmp = (y / a) * (t - z) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.6e+134) || !(z <= 8.2e+68)) tmp = Float64(Float64(y / a) * Float64(t - z)); 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 ((z <= -6.6e+134) || ~((z <= 8.2e+68))) tmp = (y / a) * (t - z); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.6e+134], N[Not[LessEqual[z, 8.2e+68]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+134} \lor \neg \left(z \leq 8.2 \cdot 10^{+68}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -6.6e134 or 8.1999999999999998e68 < z Initial program 92.5%
associate-*l/97.2%
Simplified97.2%
*-commutative97.2%
clear-num96.5%
un-div-inv96.6%
Applied egg-rr96.6%
Taylor expanded in x around 0 70.2%
mul-1-neg70.2%
associate-*l/74.5%
distribute-rgt-out--61.4%
sub-neg61.4%
+-commutative61.4%
distribute-neg-in61.4%
remove-double-neg61.4%
sub-neg61.4%
distribute-rgt-out--74.5%
Simplified74.5%
if -6.6e134 < z < 8.1999999999999998e68Initial program 92.1%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in z around 0 83.6%
cancel-sign-sub-inv83.6%
metadata-eval83.6%
*-lft-identity83.6%
+-commutative83.6%
associate-*r/87.9%
Simplified87.9%
Final simplification83.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.1e+134) (not (<= z 3.8e+71))) (* (/ y a) (- t z)) (+ x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.1e+134) || !(z <= 3.8e+71)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + (t / (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 ((z <= (-2.1d+134)) .or. (.not. (z <= 3.8d+71))) then
tmp = (y / a) * (t - z)
else
tmp = x + (t / (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 ((z <= -2.1e+134) || !(z <= 3.8e+71)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.1e+134) or not (z <= 3.8e+71): tmp = (y / a) * (t - z) else: tmp = x + (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.1e+134) || !(z <= 3.8e+71)) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = Float64(x + Float64(t / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.1e+134) || ~((z <= 3.8e+71))) tmp = (y / a) * (t - z); else tmp = x + (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.1e+134], N[Not[LessEqual[z, 3.8e+71]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+134} \lor \neg \left(z \leq 3.8 \cdot 10^{+71}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -2.1000000000000001e134 or 3.8000000000000001e71 < z Initial program 92.5%
associate-*l/97.2%
Simplified97.2%
*-commutative97.2%
clear-num96.5%
un-div-inv96.6%
Applied egg-rr96.6%
Taylor expanded in x around 0 70.2%
mul-1-neg70.2%
associate-*l/74.5%
distribute-rgt-out--61.4%
sub-neg61.4%
+-commutative61.4%
distribute-neg-in61.4%
remove-double-neg61.4%
sub-neg61.4%
distribute-rgt-out--74.5%
Simplified74.5%
if -2.1000000000000001e134 < z < 3.8000000000000001e71Initial program 92.1%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in z around 0 83.6%
cancel-sign-sub-inv83.6%
metadata-eval83.6%
*-lft-identity83.6%
+-commutative83.6%
associate-*r/87.9%
Simplified87.9%
associate-*r/83.6%
associate-/l*88.5%
Applied egg-rr88.5%
Final simplification84.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4e-16) (not (<= t 6.1e+72))) (+ x (/ t (/ a y))) (- x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4e-16) || !(t <= 6.1e+72)) {
tmp = x + (t / (a / y));
} else {
tmp = x - (y / (a / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-4d-16)) .or. (.not. (t <= 6.1d+72))) then
tmp = x + (t / (a / y))
else
tmp = x - (y / (a / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4e-16) || !(t <= 6.1e+72)) {
tmp = x + (t / (a / y));
} else {
tmp = x - (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4e-16) or not (t <= 6.1e+72): tmp = x + (t / (a / y)) else: tmp = x - (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4e-16) || !(t <= 6.1e+72)) tmp = Float64(x + Float64(t / Float64(a / y))); else tmp = Float64(x - Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4e-16) || ~((t <= 6.1e+72))) tmp = x + (t / (a / y)); else tmp = x - (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4e-16], N[Not[LessEqual[t, 6.1e+72]], $MachinePrecision]], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{-16} \lor \neg \left(t \leq 6.1 \cdot 10^{+72}\right):\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -3.9999999999999999e-16 or 6.09999999999999991e72 < t Initial program 87.7%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in z around 0 78.2%
cancel-sign-sub-inv78.2%
metadata-eval78.2%
*-lft-identity78.2%
+-commutative78.2%
associate-*r/88.1%
Simplified88.1%
associate-*r/78.2%
associate-/l*88.1%
Applied egg-rr88.1%
if -3.9999999999999999e-16 < t < 6.09999999999999991e72Initial program 96.1%
associate-/l*94.3%
Simplified94.3%
Taylor expanded in z around inf 84.1%
Final simplification85.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.6e+133) (not (<= z 4.6e+22))) (- x (/ (* z y) a)) (+ x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.6e+133) || !(z <= 4.6e+22)) {
tmp = x - ((z * y) / a);
} else {
tmp = x + (t / (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 ((z <= (-8.6d+133)) .or. (.not. (z <= 4.6d+22))) then
tmp = x - ((z * y) / a)
else
tmp = x + (t / (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 ((z <= -8.6e+133) || !(z <= 4.6e+22)) {
tmp = x - ((z * y) / a);
} else {
tmp = x + (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8.6e+133) or not (z <= 4.6e+22): tmp = x - ((z * y) / a) else: tmp = x + (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8.6e+133) || !(z <= 4.6e+22)) tmp = Float64(x - Float64(Float64(z * y) / a)); else tmp = Float64(x + Float64(t / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -8.6e+133) || ~((z <= 4.6e+22))) tmp = x - ((z * y) / a); else tmp = x + (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8.6e+133], N[Not[LessEqual[z, 4.6e+22]], $MachinePrecision]], N[(x - N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+133} \lor \neg \left(z \leq 4.6 \cdot 10^{+22}\right):\\
\;\;\;\;x - \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -8.59999999999999989e133 or 4.6000000000000004e22 < z Initial program 93.2%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in z around inf 82.7%
if -8.59999999999999989e133 < z < 4.6000000000000004e22Initial program 91.8%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in z around 0 83.9%
cancel-sign-sub-inv83.9%
metadata-eval83.9%
*-lft-identity83.9%
+-commutative83.9%
associate-*r/88.4%
Simplified88.4%
associate-*r/83.9%
associate-/l*89.0%
Applied egg-rr89.0%
Final simplification86.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -170.0) (not (<= t 2.4e+141))) (* t (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -170.0) || !(t <= 2.4e+141)) {
tmp = 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 ((t <= (-170.0d0)) .or. (.not. (t <= 2.4d+141))) then
tmp = 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 ((t <= -170.0) || !(t <= 2.4e+141)) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -170.0) or not (t <= 2.4e+141): tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -170.0) || !(t <= 2.4e+141)) tmp = Float64(t * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -170.0) || ~((t <= 2.4e+141))) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -170.0], N[Not[LessEqual[t, 2.4e+141]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -170 \lor \neg \left(t \leq 2.4 \cdot 10^{+141}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -170 or 2.39999999999999997e141 < t Initial program 86.9%
associate-*l/98.9%
Simplified98.9%
Taylor expanded in t around inf 54.8%
associate-*r/59.8%
Simplified59.8%
if -170 < t < 2.39999999999999997e141Initial program 95.8%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 53.6%
Final simplification56.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -1950.0) (* t (/ y a)) (if (<= t 1.1e+146) x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1950.0) {
tmp = t * (y / a);
} else if (t <= 1.1e+146) {
tmp = x;
} else {
tmp = t / (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 <= (-1950.0d0)) then
tmp = t * (y / a)
else if (t <= 1.1d+146) then
tmp = x
else
tmp = t / (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 <= -1950.0) {
tmp = t * (y / a);
} else if (t <= 1.1e+146) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1950.0: tmp = t * (y / a) elif t <= 1.1e+146: tmp = x else: tmp = t / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1950.0) tmp = Float64(t * Float64(y / a)); elseif (t <= 1.1e+146) tmp = x; else tmp = Float64(t / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1950.0) tmp = t * (y / a); elseif (t <= 1.1e+146) tmp = x; else tmp = t / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1950.0], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.1e+146], x, N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1950:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+146}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -1950Initial program 91.1%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in t around inf 55.3%
associate-*r/59.8%
Simplified59.8%
if -1950 < t < 1.0999999999999999e146Initial program 95.8%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 53.6%
if 1.0999999999999999e146 < t Initial program 79.8%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in t around inf 54.1%
associate-/l*59.7%
Simplified59.7%
Final simplification56.1%
(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 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.1%
Final simplification44.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 2023279
(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)))