
(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 7 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 92.4%
associate-*l/97.4%
Simplified97.4%
Final simplification97.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ t a)))))
(if (<= t -1.26e-37)
t_1
(if (<= t 1.1e-63)
(- x (/ (* y z) a))
(if (or (<= t 6.3e-25) (not (<= t 1.55e+43)))
t_1
(- x (* (/ y a) z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (t / a));
double tmp;
if (t <= -1.26e-37) {
tmp = t_1;
} else if (t <= 1.1e-63) {
tmp = x - ((y * z) / a);
} else if ((t <= 6.3e-25) || !(t <= 1.55e+43)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + (y * (t / a))
if (t <= (-1.26d-37)) then
tmp = t_1
else if (t <= 1.1d-63) then
tmp = x - ((y * z) / a)
else if ((t <= 6.3d-25) .or. (.not. (t <= 1.55d+43))) then
tmp = t_1
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 t_1 = x + (y * (t / a));
double tmp;
if (t <= -1.26e-37) {
tmp = t_1;
} else if (t <= 1.1e-63) {
tmp = x - ((y * z) / a);
} else if ((t <= 6.3e-25) || !(t <= 1.55e+43)) {
tmp = t_1;
} else {
tmp = x - ((y / a) * z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * (t / a)) tmp = 0 if t <= -1.26e-37: tmp = t_1 elif t <= 1.1e-63: tmp = x - ((y * z) / a) elif (t <= 6.3e-25) or not (t <= 1.55e+43): tmp = t_1 else: tmp = x - ((y / a) * z) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(t / a))) tmp = 0.0 if (t <= -1.26e-37) tmp = t_1; elseif (t <= 1.1e-63) tmp = Float64(x - Float64(Float64(y * z) / a)); elseif ((t <= 6.3e-25) || !(t <= 1.55e+43)) tmp = t_1; else tmp = Float64(x - Float64(Float64(y / a) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * (t / a)); tmp = 0.0; if (t <= -1.26e-37) tmp = t_1; elseif (t <= 1.1e-63) tmp = x - ((y * z) / a); elseif ((t <= 6.3e-25) || ~((t <= 1.55e+43))) tmp = t_1; else tmp = x - ((y / a) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.26e-37], t$95$1, If[LessEqual[t, 1.1e-63], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 6.3e-25], N[Not[LessEqual[t, 1.55e+43]], $MachinePrecision]], t$95$1, N[(x - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{t}{a}\\
\mathbf{if}\;t \leq -1.26 \cdot 10^{-37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{-63}:\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 6.3 \cdot 10^{-25} \lor \neg \left(t \leq 1.55 \cdot 10^{+43}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{a} \cdot z\\
\end{array}
\end{array}
if t < -1.25999999999999992e-37 or 1.1e-63 < t < 6.29999999999999961e-25 or 1.5500000000000001e43 < t Initial program 88.2%
associate-*r/91.8%
Simplified91.8%
Taylor expanded in z around 0 83.5%
neg-mul-183.5%
distribute-neg-frac83.5%
Simplified83.5%
if -1.25999999999999992e-37 < t < 1.1e-63Initial program 98.2%
associate-*r/96.4%
Simplified96.4%
Taylor expanded in z around inf 96.3%
if 6.29999999999999961e-25 < t < 1.5500000000000001e43Initial program 86.1%
associate-*r/86.7%
Simplified86.7%
Taylor expanded in z around inf 75.6%
associate-*l/89.2%
*-commutative89.2%
Simplified89.2%
Final simplification89.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ y a) t))))
(if (<= t -1.22e-42)
t_1
(if (<= t 1.12e-63)
(- x (/ (* y z) a))
(if (<= t 3.1e-25)
(+ x (* y (/ t a)))
(if (<= t 5.5e+42) (- x (* (/ y a) z)) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y / a) * t);
double tmp;
if (t <= -1.22e-42) {
tmp = t_1;
} else if (t <= 1.12e-63) {
tmp = x - ((y * z) / a);
} else if (t <= 3.1e-25) {
tmp = x + (y * (t / a));
} else if (t <= 5.5e+42) {
tmp = x - ((y / a) * z);
} 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 = x + ((y / a) * t)
if (t <= (-1.22d-42)) then
tmp = t_1
else if (t <= 1.12d-63) then
tmp = x - ((y * z) / a)
else if (t <= 3.1d-25) then
tmp = x + (y * (t / a))
else if (t <= 5.5d+42) then
tmp = x - ((y / a) * z)
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 = x + ((y / a) * t);
double tmp;
if (t <= -1.22e-42) {
tmp = t_1;
} else if (t <= 1.12e-63) {
tmp = x - ((y * z) / a);
} else if (t <= 3.1e-25) {
tmp = x + (y * (t / a));
} else if (t <= 5.5e+42) {
tmp = x - ((y / a) * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y / a) * t) tmp = 0 if t <= -1.22e-42: tmp = t_1 elif t <= 1.12e-63: tmp = x - ((y * z) / a) elif t <= 3.1e-25: tmp = x + (y * (t / a)) elif t <= 5.5e+42: tmp = x - ((y / a) * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y / a) * t)) tmp = 0.0 if (t <= -1.22e-42) tmp = t_1; elseif (t <= 1.12e-63) tmp = Float64(x - Float64(Float64(y * z) / a)); elseif (t <= 3.1e-25) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (t <= 5.5e+42) tmp = Float64(x - Float64(Float64(y / a) * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y / a) * t); tmp = 0.0; if (t <= -1.22e-42) tmp = t_1; elseif (t <= 1.12e-63) tmp = x - ((y * z) / a); elseif (t <= 3.1e-25) tmp = x + (y * (t / a)); elseif (t <= 5.5e+42) tmp = x - ((y / a) * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.22e-42], t$95$1, If[LessEqual[t, 1.12e-63], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e-25], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e+42], N[(x - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{a} \cdot t\\
\mathbf{if}\;t \leq -1.22 \cdot 10^{-42}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{-63}:\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-25}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+42}:\\
\;\;\;\;x - \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.22000000000000007e-42 or 5.50000000000000001e42 < t Initial program 87.4%
associate-*r/91.3%
Simplified91.3%
Taylor expanded in z around 0 78.5%
mul-1-neg78.5%
associate-*l/87.2%
distribute-rgt-neg-out87.2%
Simplified87.2%
if -1.22000000000000007e-42 < t < 1.12000000000000002e-63Initial program 98.2%
associate-*r/96.4%
Simplified96.4%
Taylor expanded in z around inf 96.3%
if 1.12000000000000002e-63 < t < 3.09999999999999995e-25Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
neg-mul-199.8%
distribute-neg-frac99.8%
Simplified99.8%
if 3.09999999999999995e-25 < t < 5.50000000000000001e42Initial program 86.1%
associate-*r/86.7%
Simplified86.7%
Taylor expanded in z around inf 75.6%
associate-*l/89.2%
*-commutative89.2%
Simplified89.2%
Final simplification91.7%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4e-34)
(- x (/ t (/ (- a) y)))
(if (<= t 1.12e-63)
(- x (/ (* y z) a))
(if (<= t 3.1e-25)
(+ x (* y (/ t a)))
(if (<= t 9.5e+42) (- x (* (/ y a) z)) (+ x (* (/ y a) t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4e-34) {
tmp = x - (t / (-a / y));
} else if (t <= 1.12e-63) {
tmp = x - ((y * z) / a);
} else if (t <= 3.1e-25) {
tmp = x + (y * (t / a));
} else if (t <= 9.5e+42) {
tmp = x - ((y / a) * z);
} else {
tmp = x + ((y / a) * t);
}
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-34)) then
tmp = x - (t / (-a / y))
else if (t <= 1.12d-63) then
tmp = x - ((y * z) / a)
else if (t <= 3.1d-25) then
tmp = x + (y * (t / a))
else if (t <= 9.5d+42) then
tmp = x - ((y / a) * z)
else
tmp = x + ((y / a) * t)
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-34) {
tmp = x - (t / (-a / y));
} else if (t <= 1.12e-63) {
tmp = x - ((y * z) / a);
} else if (t <= 3.1e-25) {
tmp = x + (y * (t / a));
} else if (t <= 9.5e+42) {
tmp = x - ((y / a) * z);
} else {
tmp = x + ((y / a) * t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4e-34: tmp = x - (t / (-a / y)) elif t <= 1.12e-63: tmp = x - ((y * z) / a) elif t <= 3.1e-25: tmp = x + (y * (t / a)) elif t <= 9.5e+42: tmp = x - ((y / a) * z) else: tmp = x + ((y / a) * t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4e-34) tmp = Float64(x - Float64(t / Float64(Float64(-a) / y))); elseif (t <= 1.12e-63) tmp = Float64(x - Float64(Float64(y * z) / a)); elseif (t <= 3.1e-25) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (t <= 9.5e+42) tmp = Float64(x - Float64(Float64(y / a) * z)); else tmp = Float64(x + Float64(Float64(y / a) * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4e-34) tmp = x - (t / (-a / y)); elseif (t <= 1.12e-63) tmp = x - ((y * z) / a); elseif (t <= 3.1e-25) tmp = x + (y * (t / a)); elseif (t <= 9.5e+42) tmp = x - ((y / a) * z); else tmp = x + ((y / a) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4e-34], N[(x - N[(t / N[((-a) / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.12e-63], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e-25], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.5e+42], N[(x - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{-34}:\\
\;\;\;\;x - \frac{t}{\frac{-a}{y}}\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{-63}:\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-25}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+42}:\\
\;\;\;\;x - \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\end{array}
\end{array}
if t < -3.99999999999999971e-34Initial program 89.5%
associate-*r/94.7%
Simplified94.7%
div-sub94.7%
Applied egg-rr94.7%
Taylor expanded in z around 0 78.5%
associate-*r/82.4%
*-commutative82.4%
associate-*r*82.4%
*-commutative82.4%
associate-*l/82.4%
associate-*r/82.4%
metadata-eval82.4%
associate-/r*82.4%
neg-mul-182.4%
associate-*r/82.4%
*-commutative82.4%
*-lft-identity82.4%
/-rgt-identity82.4%
times-frac78.5%
*-rgt-identity78.5%
associate-/l*82.5%
distribute-frac-neg82.5%
Simplified82.5%
if -3.99999999999999971e-34 < t < 1.12000000000000002e-63Initial program 98.2%
associate-*r/96.4%
Simplified96.4%
Taylor expanded in z around inf 96.3%
if 1.12000000000000002e-63 < t < 3.09999999999999995e-25Initial program 99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
neg-mul-199.8%
distribute-neg-frac99.8%
Simplified99.8%
if 3.09999999999999995e-25 < t < 9.50000000000000019e42Initial program 86.1%
associate-*r/86.7%
Simplified86.7%
Taylor expanded in z around inf 75.6%
associate-*l/89.2%
*-commutative89.2%
Simplified89.2%
if 9.50000000000000019e42 < t Initial program 84.5%
associate-*r/86.5%
Simplified86.5%
Taylor expanded in z around 0 78.5%
mul-1-neg78.5%
associate-*l/93.9%
distribute-rgt-neg-out93.9%
Simplified93.9%
Final simplification91.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 4.15e+73) (+ x (* y (/ (- t z) a))) (+ x (* (/ y a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 4.15e+73) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y / a) * t);
}
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.15d+73) then
tmp = x + (y * ((t - z) / a))
else
tmp = x + ((y / a) * t)
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.15e+73) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y / a) * t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 4.15e+73: tmp = x + (y * ((t - z) / a)) else: tmp = x + ((y / a) * t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 4.15e+73) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); else tmp = Float64(x + Float64(Float64(y / a) * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 4.15e+73) tmp = x + (y * ((t - z) / a)); else tmp = x + ((y / a) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 4.15e+73], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.15 \cdot 10^{+73}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\end{array}
\end{array}
if t < 4.15000000000000003e73Initial program 94.0%
associate-*r/95.4%
Simplified95.4%
if 4.15000000000000003e73 < t Initial program 84.7%
associate-*r/84.6%
Simplified84.6%
Taylor expanded in z around 0 80.1%
mul-1-neg80.1%
associate-*l/95.3%
distribute-rgt-neg-out95.3%
Simplified95.3%
Final simplification95.4%
(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 92.4%
associate-*r/93.5%
Simplified93.5%
Taylor expanded in z around inf 67.7%
Final simplification67.7%
(FPCore (x y z t a) :precision binary64 (- x (* (/ y a) z)))
double code(double x, double y, double z, double t, double a) {
return x - ((y / a) * 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) * z)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y / a) * z);
}
def code(x, y, z, t, a): return x - ((y / a) * z)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y / a) * z)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y / a) * z); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{a} \cdot z
\end{array}
Initial program 92.4%
associate-*r/93.5%
Simplified93.5%
Taylor expanded in z around inf 68.0%
associate-*l/71.1%
*-commutative71.1%
Simplified71.1%
Final simplification71.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 2023238
(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)))