
(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 11 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
(let* ((t_1 (* (- z t) y)))
(if (<= t_1 -5e+250)
(+ x (* y (/ (- z t) a)))
(if (<= t_1 2e+107) (+ x (/ t_1 a)) (+ x (/ y (/ a (- z t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) * y;
double tmp;
if (t_1 <= -5e+250) {
tmp = x + (y * ((z - t) / a));
} else if (t_1 <= 2e+107) {
tmp = x + (t_1 / a);
} else {
tmp = x + (y / (a / (z - 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) :: t_1
real(8) :: tmp
t_1 = (z - t) * y
if (t_1 <= (-5d+250)) then
tmp = x + (y * ((z - t) / a))
else if (t_1 <= 2d+107) then
tmp = x + (t_1 / a)
else
tmp = x + (y / (a / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) * y;
double tmp;
if (t_1 <= -5e+250) {
tmp = x + (y * ((z - t) / a));
} else if (t_1 <= 2e+107) {
tmp = x + (t_1 / a);
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) * y tmp = 0 if t_1 <= -5e+250: tmp = x + (y * ((z - t) / a)) elif t_1 <= 2e+107: tmp = x + (t_1 / a) else: tmp = x + (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) * y) tmp = 0.0 if (t_1 <= -5e+250) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); elseif (t_1 <= 2e+107) tmp = Float64(x + Float64(t_1 / a)); else tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) * y; tmp = 0.0; if (t_1 <= -5e+250) tmp = x + (y * ((z - t) / a)); elseif (t_1 <= 2e+107) tmp = x + (t_1 / a); else tmp = x + (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+250], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+107], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z - t\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+250}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+107}:\\
\;\;\;\;x + \frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -5.0000000000000002e250Initial program 77.3%
associate-/l*100.0%
Simplified100.0%
if -5.0000000000000002e250 < (*.f64 y (-.f64 z t)) < 1.9999999999999999e107Initial program 99.9%
if 1.9999999999999999e107 < (*.f64 y (-.f64 z t)) Initial program 82.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 82.1%
associate-*l/99.8%
associate-/r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.5e+79) (not (<= t 2.6e+146))) (- x (* t (/ y a))) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.5e+79) || !(t <= 2.6e+146)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-3.5d+79)) .or. (.not. (t <= 2.6d+146))) then
tmp = x - (t * (y / a))
else
tmp = x + (z / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.5e+79) || !(t <= 2.6e+146)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.5e+79) or not (t <= 2.6e+146): tmp = x - (t * (y / a)) else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.5e+79) || !(t <= 2.6e+146)) tmp = Float64(x - Float64(t * Float64(y / a))); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.5e+79) || ~((t <= 2.6e+146))) tmp = x - (t * (y / a)); else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.5e+79], N[Not[LessEqual[t, 2.6e+146]], $MachinePrecision]], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{+79} \lor \neg \left(t \leq 2.6 \cdot 10^{+146}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -3.4999999999999998e79 or 2.60000000000000014e146 < t Initial program 85.1%
+-commutative85.1%
associate-/l*91.3%
fma-define91.3%
Simplified91.3%
fma-undefine91.3%
associate-*r/85.1%
*-commutative85.1%
associate-/l*98.6%
Applied egg-rr98.6%
Taylor expanded in z around 0 77.6%
associate-*l/83.7%
*-commutative83.7%
neg-mul-183.7%
sub-neg83.7%
associate-*r/77.6%
associate-*l/89.8%
*-commutative89.8%
Simplified89.8%
if -3.4999999999999998e79 < t < 2.60000000000000014e146Initial program 95.2%
+-commutative95.2%
associate-/l*96.2%
fma-define96.2%
Simplified96.2%
fma-undefine96.2%
associate-*r/95.2%
*-commutative95.2%
associate-/l*96.2%
Applied egg-rr96.2%
clear-num96.1%
un-div-inv96.8%
sub-neg96.8%
add-sqr-sqrt40.9%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod53.1%
add-sqr-sqrt91.4%
Applied egg-rr91.4%
Taylor expanded in z around inf 91.6%
Final simplification91.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.3e+136) (not (<= t 9.4e+216))) (* t (/ (- y) a)) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.3e+136) || !(t <= 9.4e+216)) {
tmp = t * (-y / a);
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-2.3d+136)) .or. (.not. (t <= 9.4d+216))) then
tmp = t * (-y / a)
else
tmp = x + (z / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.3e+136) || !(t <= 9.4e+216)) {
tmp = t * (-y / a);
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.3e+136) or not (t <= 9.4e+216): tmp = t * (-y / a) else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.3e+136) || !(t <= 9.4e+216)) tmp = Float64(t * Float64(Float64(-y) / a)); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.3e+136) || ~((t <= 9.4e+216))) tmp = t * (-y / a); else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.3e+136], N[Not[LessEqual[t, 9.4e+216]], $MachinePrecision]], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{+136} \lor \neg \left(t \leq 9.4 \cdot 10^{+216}\right):\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -2.3e136 or 9.4000000000000004e216 < t Initial program 83.7%
associate-/l*91.9%
Simplified91.9%
Taylor expanded in z around 0 81.7%
mul-1-neg81.7%
unsub-neg81.7%
*-commutative81.7%
associate-/l*90.2%
Simplified90.2%
clear-num90.2%
un-div-inv90.3%
Applied egg-rr90.3%
Taylor expanded in x around 0 67.5%
associate-*r/67.5%
neg-mul-167.5%
distribute-rgt-neg-out67.5%
associate-*r/79.4%
Simplified79.4%
if -2.3e136 < t < 9.4000000000000004e216Initial program 94.0%
+-commutative94.0%
associate-/l*95.4%
fma-define95.4%
Simplified95.4%
fma-undefine95.4%
associate-*r/94.0%
*-commutative94.0%
associate-/l*96.3%
Applied egg-rr96.3%
clear-num96.2%
un-div-inv96.7%
sub-neg96.7%
add-sqr-sqrt39.8%
sqrt-unprod85.4%
sqr-neg85.4%
sqrt-unprod50.8%
add-sqr-sqrt86.5%
Applied egg-rr86.5%
Taylor expanded in z around inf 87.6%
Final simplification86.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2e+112) (not (<= t 9.4e+216))) (* t (/ (- y) a)) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2e+112) || !(t <= 9.4e+216)) {
tmp = t * (-y / 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 <= (-2d+112)) .or. (.not. (t <= 9.4d+216))) then
tmp = t * (-y / 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 <= -2e+112) || !(t <= 9.4e+216)) {
tmp = t * (-y / a);
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2e+112) or not (t <= 9.4e+216): tmp = t * (-y / a) else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2e+112) || !(t <= 9.4e+216)) tmp = Float64(t * Float64(Float64(-y) / 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 <= -2e+112) || ~((t <= 9.4e+216))) tmp = t * (-y / a); else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2e+112], N[Not[LessEqual[t, 9.4e+216]], $MachinePrecision]], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+112} \lor \neg \left(t \leq 9.4 \cdot 10^{+216}\right):\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -1.9999999999999999e112 or 9.4000000000000004e216 < t Initial program 85.2%
associate-/l*92.7%
Simplified92.7%
Taylor expanded in z around 0 81.5%
mul-1-neg81.5%
unsub-neg81.5%
*-commutative81.5%
associate-/l*89.2%
Simplified89.2%
clear-num89.2%
un-div-inv89.3%
Applied egg-rr89.3%
Taylor expanded in x around 0 66.8%
associate-*r/66.8%
neg-mul-166.8%
distribute-rgt-neg-out66.8%
associate-*r/77.6%
Simplified77.6%
if -1.9999999999999999e112 < t < 9.4000000000000004e216Initial program 93.9%
associate-/l*95.3%
Simplified95.3%
Taylor expanded in t around 0 84.8%
+-commutative84.8%
associate-/l*86.6%
Simplified86.6%
clear-num86.6%
un-div-inv87.2%
Applied egg-rr87.2%
Final simplification85.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.1e+112) (not (<= t 9.4e+216))) (* t (/ (- y) a)) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.1e+112) || !(t <= 9.4e+216)) {
tmp = t * (-y / 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 <= (-2.1d+112)) .or. (.not. (t <= 9.4d+216))) then
tmp = t * (-y / 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 <= -2.1e+112) || !(t <= 9.4e+216)) {
tmp = t * (-y / a);
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.1e+112) or not (t <= 9.4e+216): tmp = t * (-y / a) else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.1e+112) || !(t <= 9.4e+216)) tmp = Float64(t * Float64(Float64(-y) / 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 <= -2.1e+112) || ~((t <= 9.4e+216))) tmp = t * (-y / a); else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.1e+112], N[Not[LessEqual[t, 9.4e+216]], $MachinePrecision]], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+112} \lor \neg \left(t \leq 9.4 \cdot 10^{+216}\right):\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -2.0999999999999999e112 or 9.4000000000000004e216 < t Initial program 85.2%
associate-/l*92.7%
Simplified92.7%
Taylor expanded in z around 0 81.5%
mul-1-neg81.5%
unsub-neg81.5%
*-commutative81.5%
associate-/l*89.2%
Simplified89.2%
clear-num89.2%
un-div-inv89.3%
Applied egg-rr89.3%
Taylor expanded in x around 0 66.8%
associate-*r/66.8%
neg-mul-166.8%
distribute-rgt-neg-out66.8%
associate-*r/77.6%
Simplified77.6%
if -2.0999999999999999e112 < t < 9.4000000000000004e216Initial program 93.9%
associate-/l*95.3%
Simplified95.3%
Taylor expanded in t around 0 84.8%
+-commutative84.8%
associate-/l*86.6%
Simplified86.6%
Final simplification84.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.05e+113) (not (<= t 9.4e+216))) (* t (/ (- y) a)) (+ x (/ (* z y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.05e+113) || !(t <= 9.4e+216)) {
tmp = t * (-y / a);
} else {
tmp = x + ((z * y) / a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-2.05d+113)) .or. (.not. (t <= 9.4d+216))) then
tmp = t * (-y / a)
else
tmp = x + ((z * y) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.05e+113) || !(t <= 9.4e+216)) {
tmp = t * (-y / a);
} else {
tmp = x + ((z * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.05e+113) or not (t <= 9.4e+216): tmp = t * (-y / a) else: tmp = x + ((z * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.05e+113) || !(t <= 9.4e+216)) tmp = Float64(t * Float64(Float64(-y) / a)); else tmp = Float64(x + Float64(Float64(z * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.05e+113) || ~((t <= 9.4e+216))) tmp = t * (-y / a); else tmp = x + ((z * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.05e+113], N[Not[LessEqual[t, 9.4e+216]], $MachinePrecision]], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.05 \cdot 10^{+113} \lor \neg \left(t \leq 9.4 \cdot 10^{+216}\right):\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\end{array}
\end{array}
if t < -2.04999999999999996e113 or 9.4000000000000004e216 < t Initial program 85.2%
associate-/l*92.7%
Simplified92.7%
Taylor expanded in z around 0 81.5%
mul-1-neg81.5%
unsub-neg81.5%
*-commutative81.5%
associate-/l*89.2%
Simplified89.2%
clear-num89.2%
un-div-inv89.3%
Applied egg-rr89.3%
Taylor expanded in x around 0 66.8%
associate-*r/66.8%
neg-mul-166.8%
distribute-rgt-neg-out66.8%
associate-*r/77.6%
Simplified77.6%
if -2.04999999999999996e113 < t < 9.4000000000000004e216Initial program 93.9%
associate-/l*95.3%
Simplified95.3%
Taylor expanded in z around inf 84.8%
Final simplification83.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.8e+98) (not (<= t 9e+158))) (* t (/ (- y) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.8e+98) || !(t <= 9e+158)) {
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 <= (-1.8d+98)) .or. (.not. (t <= 9d+158))) 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 <= -1.8e+98) || !(t <= 9e+158)) {
tmp = t * (-y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.8e+98) or not (t <= 9e+158): tmp = t * (-y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.8e+98) || !(t <= 9e+158)) tmp = Float64(t * Float64(Float64(-y) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.8e+98) || ~((t <= 9e+158))) tmp = t * (-y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.8e+98], N[Not[LessEqual[t, 9e+158]], $MachinePrecision]], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+98} \lor \neg \left(t \leq 9 \cdot 10^{+158}\right):\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.7999999999999999e98 or 9.00000000000000092e158 < t Initial program 85.5%
associate-/l*90.7%
Simplified90.7%
Taylor expanded in z around 0 77.4%
mul-1-neg77.4%
unsub-neg77.4%
*-commutative77.4%
associate-/l*82.6%
Simplified82.6%
clear-num82.6%
un-div-inv84.1%
Applied egg-rr84.1%
Taylor expanded in x around 0 61.4%
associate-*r/61.4%
neg-mul-161.4%
distribute-rgt-neg-out61.4%
associate-*r/70.1%
Simplified70.1%
if -1.7999999999999999e98 < t < 9.00000000000000092e158Initial program 94.8%
associate-/l*96.3%
Simplified96.3%
Taylor expanded in x around inf 49.4%
Final simplification55.3%
(FPCore (x y z t a) :precision binary64 (+ (* (- z t) (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / a)) + 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 = ((z - t) * (y / a)) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / a)) + x;
}
def code(x, y, z, t, a): return ((z - t) * (y / a)) + x
function code(x, y, z, t, a) return Float64(Float64(Float64(z - t) * Float64(y / a)) + x) end
function tmp = code(x, y, z, t, a) tmp = ((z - t) * (y / a)) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(z - t\right) \cdot \frac{y}{a} + x
\end{array}
Initial program 92.1%
+-commutative92.1%
associate-/l*94.7%
fma-define94.8%
Simplified94.8%
fma-undefine94.7%
associate-*r/92.1%
*-commutative92.1%
associate-/l*96.9%
Applied egg-rr96.9%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ a (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / (a / (z - t)));
}
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 - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / (a / (z - t)));
}
def code(x, y, z, t, a): return x + (y / (a / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(a / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / (a / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a}{z - t}}
\end{array}
Initial program 92.1%
associate-/l*94.7%
Simplified94.7%
Taylor expanded in y around 0 92.1%
associate-*l/96.9%
associate-/r/95.7%
Simplified95.7%
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a}
\end{array}
Initial program 92.1%
associate-/l*94.7%
Simplified94.7%
(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.1%
associate-/l*94.7%
Simplified94.7%
Taylor expanded in x around inf 41.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 2024185
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:alt
(! :herbie-platform default (if (< y -430450648655599/4000000000000000000000000) (+ x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t)))))))
(+ x (/ (* y (- z t)) a)))