
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ 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 94.1%
associate-*l/98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.5e+142) (not (<= z 4e+160))) (* (/ y a) (- t z)) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.5e+142) || !(z <= 4e+160)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + ((y * t) / 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 <= (-9.5d+142)) .or. (.not. (z <= 4d+160))) then
tmp = (y / a) * (t - z)
else
tmp = x + ((y * t) / 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 <= -9.5e+142) || !(z <= 4e+160)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.5e+142) or not (z <= 4e+160): tmp = (y / a) * (t - z) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.5e+142) || !(z <= 4e+160)) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9.5e+142) || ~((z <= 4e+160))) tmp = (y / a) * (t - z); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.5e+142], N[Not[LessEqual[z, 4e+160]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+142} \lor \neg \left(z \leq 4 \cdot 10^{+160}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -9.50000000000000001e142 or 4.00000000000000003e160 < z Initial program 89.1%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in x around 0 72.2%
associate-*r/68.9%
*-commutative68.9%
associate-*r*68.9%
neg-mul-168.9%
neg-sub068.9%
div-sub62.2%
associate-+l-62.2%
neg-sub062.2%
+-commutative62.2%
sub-neg62.2%
div-sub68.9%
*-rgt-identity68.9%
associate-*r/68.8%
associate-*l*81.2%
associate-*l/81.3%
associate-*r/81.3%
*-lft-identity81.3%
Simplified81.3%
if -9.50000000000000001e142 < z < 4.00000000000000003e160Initial program 95.7%
sub-neg95.7%
+-commutative95.7%
distribute-neg-frac95.7%
distribute-rgt-neg-in95.7%
associate-*r/95.0%
distribute-frac-neg95.0%
fma-def95.0%
distribute-frac-neg95.0%
sub-neg95.0%
+-commutative95.0%
distribute-neg-in95.0%
unsub-neg95.0%
remove-double-neg95.0%
Simplified95.0%
Taylor expanded in z around 0 83.8%
Final simplification83.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1e+86) (not (<= t 1.06e+15))) (+ x (/ (* y t) a)) (- x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1e+86) || !(t <= 1.06e+15)) {
tmp = x + ((y * t) / a);
} else {
tmp = x - (y * (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 ((t <= (-1d+86)) .or. (.not. (t <= 1.06d+15))) then
tmp = x + ((y * t) / a)
else
tmp = x - (y * (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 ((t <= -1e+86) || !(t <= 1.06e+15)) {
tmp = x + ((y * t) / a);
} else {
tmp = x - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1e+86) or not (t <= 1.06e+15): tmp = x + ((y * t) / a) else: tmp = x - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1e+86) || !(t <= 1.06e+15)) tmp = Float64(x + Float64(Float64(y * t) / a)); else tmp = Float64(x - Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1e+86) || ~((t <= 1.06e+15))) tmp = x + ((y * t) / a); else tmp = x - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1e+86], N[Not[LessEqual[t, 1.06e+15]], $MachinePrecision]], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+86} \lor \neg \left(t \leq 1.06 \cdot 10^{+15}\right):\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -1e86 or 1.06e15 < t Initial program 93.5%
sub-neg93.5%
+-commutative93.5%
distribute-neg-frac93.5%
distribute-rgt-neg-in93.5%
associate-*r/90.1%
distribute-frac-neg90.1%
fma-def90.1%
distribute-frac-neg90.1%
sub-neg90.1%
+-commutative90.1%
distribute-neg-in90.1%
unsub-neg90.1%
remove-double-neg90.1%
Simplified90.1%
Taylor expanded in z around 0 86.0%
if -1e86 < t < 1.06e15Initial program 94.6%
associate-*r/95.8%
Simplified95.8%
Taylor expanded in z around inf 88.3%
Final simplification87.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7.5e+86) (not (<= t 5.8e+45))) (+ x (/ (* y t) a)) (- x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7.5e+86) || !(t <= 5.8e+45)) {
tmp = x + ((y * t) / a);
} 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 <= (-7.5d+86)) .or. (.not. (t <= 5.8d+45))) then
tmp = x + ((y * t) / a)
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 <= -7.5e+86) || !(t <= 5.8e+45)) {
tmp = x + ((y * t) / a);
} else {
tmp = x - (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -7.5e+86) or not (t <= 5.8e+45): tmp = x + ((y * t) / a) else: tmp = x - (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7.5e+86) || !(t <= 5.8e+45)) tmp = Float64(x + Float64(Float64(y * t) / a)); 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 <= -7.5e+86) || ~((t <= 5.8e+45))) tmp = x + ((y * t) / a); else tmp = x - (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -7.5e+86], N[Not[LessEqual[t, 5.8e+45]], $MachinePrecision]], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+86} \lor \neg \left(t \leq 5.8 \cdot 10^{+45}\right):\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -7.4999999999999997e86 or 5.7999999999999994e45 < t Initial program 93.2%
sub-neg93.2%
+-commutative93.2%
distribute-neg-frac93.2%
distribute-rgt-neg-in93.2%
associate-*r/89.6%
distribute-frac-neg89.6%
fma-def89.6%
distribute-frac-neg89.6%
sub-neg89.6%
+-commutative89.6%
distribute-neg-in89.6%
unsub-neg89.6%
remove-double-neg89.6%
Simplified89.6%
Taylor expanded in z around 0 87.0%
if -7.4999999999999997e86 < t < 5.7999999999999994e45Initial program 94.8%
associate-/l*96.2%
Simplified96.2%
Taylor expanded in z around inf 87.7%
Final simplification87.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.25e+20) x (if (<= a 3.2e+32) (* y (/ (- t z) a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.25e+20) {
tmp = x;
} else if (a <= 3.2e+32) {
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 (a <= (-2.25d+20)) then
tmp = x
else if (a <= 3.2d+32) 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 (a <= -2.25e+20) {
tmp = x;
} else if (a <= 3.2e+32) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.25e+20: tmp = x elif a <= 3.2e+32: tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.25e+20) tmp = x; elseif (a <= 3.2e+32) 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 (a <= -2.25e+20) tmp = x; elseif (a <= 3.2e+32) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.25e+20], x, If[LessEqual[a, 3.2e+32], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.25 \cdot 10^{+20}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{+32}:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.25e20 or 3.1999999999999999e32 < a Initial program 89.1%
associate-*l/99.0%
Simplified99.0%
Taylor expanded in x around inf 71.6%
if -2.25e20 < a < 3.1999999999999999e32Initial program 98.5%
associate-*l/97.7%
Simplified97.7%
*-commutative97.7%
clear-num97.7%
un-div-inv98.1%
Applied egg-rr98.1%
Taylor expanded in x around 0 82.7%
associate-/l*82.6%
associate-*r/82.6%
neg-mul-182.6%
neg-sub082.6%
associate--r-82.6%
neg-sub082.6%
+-commutative82.6%
sub-neg82.6%
associate-/r/74.3%
div-sub69.9%
*-commutative69.9%
div-sub74.3%
Simplified74.3%
Final simplification73.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -6e+20) x (if (<= a 5.2e+32) (* (/ y a) (- t z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6e+20) {
tmp = x;
} else if (a <= 5.2e+32) {
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 (a <= (-6d+20)) then
tmp = x
else if (a <= 5.2d+32) 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 (a <= -6e+20) {
tmp = x;
} else if (a <= 5.2e+32) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -6e+20: tmp = x elif a <= 5.2e+32: tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -6e+20) tmp = x; elseif (a <= 5.2e+32) 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 (a <= -6e+20) tmp = x; elseif (a <= 5.2e+32) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6e+20], x, If[LessEqual[a, 5.2e+32], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6 \cdot 10^{+20}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+32}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -6e20 or 5.2000000000000004e32 < a Initial program 89.1%
associate-*l/99.0%
Simplified99.0%
Taylor expanded in x around inf 71.6%
if -6e20 < a < 5.2000000000000004e32Initial program 98.5%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around 0 82.7%
associate-*r/74.3%
*-commutative74.3%
associate-*r*74.3%
neg-mul-174.3%
neg-sub074.3%
div-sub69.9%
associate-+l-69.9%
neg-sub069.9%
+-commutative69.9%
sub-neg69.9%
div-sub74.3%
*-rgt-identity74.3%
associate-*r/74.3%
associate-*l*82.5%
associate-*l/82.6%
associate-*r/82.6%
*-lft-identity82.6%
Simplified82.6%
Final simplification77.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -9.1e+18) x (if (<= a 1.08e-74) (* (/ y a) t) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9.1e+18) {
tmp = x;
} else if (a <= 1.08e-74) {
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 (a <= (-9.1d+18)) then
tmp = x
else if (a <= 1.08d-74) 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 (a <= -9.1e+18) {
tmp = x;
} else if (a <= 1.08e-74) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -9.1e+18: tmp = x elif a <= 1.08e-74: tmp = (y / a) * t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9.1e+18) tmp = x; elseif (a <= 1.08e-74) 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 (a <= -9.1e+18) tmp = x; elseif (a <= 1.08e-74) tmp = (y / a) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9.1e+18], x, If[LessEqual[a, 1.08e-74], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.1 \cdot 10^{+18}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.08 \cdot 10^{-74}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -9.1e18 or 1.0799999999999999e-74 < a Initial program 90.3%
associate-*l/99.1%
Simplified99.1%
Taylor expanded in x around inf 68.1%
if -9.1e18 < a < 1.0799999999999999e-74Initial program 98.3%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in t around inf 55.0%
*-commutative55.0%
associate-*r/59.5%
Simplified59.5%
Final simplification64.1%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- t z) a))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - 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 * ((t - z) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / a));
}
def code(x, y, z, t, a): return x + (y * ((t - z) / a))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(t - z) / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((t - z) / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{t - z}{a}
\end{array}
Initial program 94.1%
associate-*r/93.2%
Simplified93.2%
Final simplification93.2%
(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.1%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in x around inf 43.0%
Final simplification43.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(- x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(- x (/ (* y (- z t)) a))
(- x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x - (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x - ((y * (z - t)) / a)
else
tmp = x - (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x - (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x - ((y * (z - t)) / a) else: tmp = x - (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x - Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x - Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x - Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x - (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x - ((y * (z - t)) / a); else tmp = x - (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x - N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x - \frac{1}{\frac{t_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t_1}\\
\end{array}
\end{array}
herbie shell --seed 2023242
(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)))