
(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 (* y (- z t))))
(if (<= t_1 -5e+262)
(+ x (* (- z t) (/ y a)))
(if (<= t_1 4e+124) (+ x (/ t_1 a)) (+ x (/ y (/ a (- z t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -5e+262) {
tmp = x + ((z - t) * (y / a));
} else if (t_1 <= 4e+124) {
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 = y * (z - t)
if (t_1 <= (-5d+262)) then
tmp = x + ((z - t) * (y / a))
else if (t_1 <= 4d+124) 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 = y * (z - t);
double tmp;
if (t_1 <= -5e+262) {
tmp = x + ((z - t) * (y / a));
} else if (t_1 <= 4e+124) {
tmp = x + (t_1 / a);
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if t_1 <= -5e+262: tmp = x + ((z - t) * (y / a)) elif t_1 <= 4e+124: tmp = x + (t_1 / a) else: tmp = x + (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= -5e+262) tmp = Float64(x + Float64(Float64(z - t) * Float64(y / a))); elseif (t_1 <= 4e+124) 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 = y * (z - t); tmp = 0.0; if (t_1 <= -5e+262) tmp = x + ((z - t) * (y / a)); elseif (t_1 <= 4e+124) 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[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+262], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+124], 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 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+262}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+124}:\\
\;\;\;\;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.00000000000000008e262Initial program 68.5%
associate-*l/99.9%
Simplified99.9%
if -5.00000000000000008e262 < (*.f64 y (-.f64 z t)) < 3.99999999999999979e124Initial program 99.8%
if 3.99999999999999979e124 < (*.f64 y (-.f64 z t)) Initial program 90.8%
associate-*l/98.0%
Simplified98.0%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(if (<= x -7.5e-17)
x
(if (<= x -1.9e-65)
(* y (/ z a))
(if (<= x 3.6e-91)
(* t (- (/ y a)))
(if (<= x 4.2e+31) (/ y (/ a z)) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -7.5e-17) {
tmp = x;
} else if (x <= -1.9e-65) {
tmp = y * (z / a);
} else if (x <= 3.6e-91) {
tmp = t * -(y / a);
} else if (x <= 4.2e+31) {
tmp = y / (a / 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 (x <= (-7.5d-17)) then
tmp = x
else if (x <= (-1.9d-65)) then
tmp = y * (z / a)
else if (x <= 3.6d-91) then
tmp = t * -(y / a)
else if (x <= 4.2d+31) then
tmp = y / (a / 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 (x <= -7.5e-17) {
tmp = x;
} else if (x <= -1.9e-65) {
tmp = y * (z / a);
} else if (x <= 3.6e-91) {
tmp = t * -(y / a);
} else if (x <= 4.2e+31) {
tmp = y / (a / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -7.5e-17: tmp = x elif x <= -1.9e-65: tmp = y * (z / a) elif x <= 3.6e-91: tmp = t * -(y / a) elif x <= 4.2e+31: tmp = y / (a / z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -7.5e-17) tmp = x; elseif (x <= -1.9e-65) tmp = Float64(y * Float64(z / a)); elseif (x <= 3.6e-91) tmp = Float64(t * Float64(-Float64(y / a))); elseif (x <= 4.2e+31) tmp = Float64(y / Float64(a / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -7.5e-17) tmp = x; elseif (x <= -1.9e-65) tmp = y * (z / a); elseif (x <= 3.6e-91) tmp = t * -(y / a); elseif (x <= 4.2e+31) tmp = y / (a / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -7.5e-17], x, If[LessEqual[x, -1.9e-65], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.6e-91], N[(t * (-N[(y / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[x, 4.2e+31], N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{-65}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-91}:\\
\;\;\;\;t \cdot \left(-\frac{y}{a}\right)\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+31}:\\
\;\;\;\;\frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.49999999999999984e-17 or 4.19999999999999958e31 < x Initial program 94.0%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 65.6%
if -7.49999999999999984e-17 < x < -1.9000000000000001e-65Initial program 99.7%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around inf 71.6%
Taylor expanded in z around inf 71.9%
if -1.9000000000000001e-65 < x < 3.6e-91Initial program 94.7%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around 0 64.4%
mul-1-neg64.4%
unsub-neg64.4%
associate-*r/68.4%
Simplified68.4%
Taylor expanded in t around 0 64.4%
Taylor expanded in x around 0 50.7%
associate-*r/50.7%
mul-1-neg50.7%
distribute-rgt-neg-out50.7%
associate-*r/55.4%
Simplified55.4%
if 3.6e-91 < x < 4.19999999999999958e31Initial program 81.0%
associate-*l/89.1%
Simplified89.1%
Taylor expanded in y around inf 76.3%
Taylor expanded in z around inf 53.5%
clear-num53.5%
un-div-inv53.5%
Applied egg-rr53.5%
Final simplification61.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -9e-58) (not (<= x 9.5e-6))) (+ x (/ y (/ a z))) (* y (/ (- z t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -9e-58) || !(x <= 9.5e-6)) {
tmp = x + (y / (a / z));
} else {
tmp = y * ((z - 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 ((x <= (-9d-58)) .or. (.not. (x <= 9.5d-6))) then
tmp = x + (y / (a / z))
else
tmp = y * ((z - 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 ((x <= -9e-58) || !(x <= 9.5e-6)) {
tmp = x + (y / (a / z));
} else {
tmp = y * ((z - t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -9e-58) or not (x <= 9.5e-6): tmp = x + (y / (a / z)) else: tmp = y * ((z - t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -9e-58) || !(x <= 9.5e-6)) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(y * Float64(Float64(z - t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -9e-58) || ~((x <= 9.5e-6))) tmp = x + (y / (a / z)); else tmp = y * ((z - t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -9e-58], N[Not[LessEqual[x, 9.5e-6]], $MachinePrecision]], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-58} \lor \neg \left(x \leq 9.5 \cdot 10^{-6}\right):\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if x < -9.0000000000000006e-58 or 9.5000000000000005e-6 < x Initial program 93.5%
associate-*l/96.0%
Simplified96.0%
associate-/r/94.7%
Applied egg-rr94.7%
Taylor expanded in z around inf 79.9%
if -9.0000000000000006e-58 < x < 9.5000000000000005e-6Initial program 92.8%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in y around inf 78.4%
Taylor expanded in z around 0 78.4%
neg-mul-178.4%
+-commutative78.4%
sub-neg78.4%
div-sub78.3%
Simplified78.3%
Final simplification79.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.1e-32) (not (<= z 11500000000.0))) (+ x (* z (/ y a))) (- x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.1e-32) || !(z <= 11500000000.0)) {
tmp = x + (z * (y / a));
} 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 <= (-4.1d-32)) .or. (.not. (z <= 11500000000.0d0))) then
tmp = x + (z * (y / a))
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 <= -4.1e-32) || !(z <= 11500000000.0)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.1e-32) or not (z <= 11500000000.0): tmp = x + (z * (y / a)) else: tmp = x - (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.1e-32) || !(z <= 11500000000.0)) tmp = Float64(x + Float64(z * Float64(y / a))); 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 <= -4.1e-32) || ~((z <= 11500000000.0))) tmp = x + (z * (y / a)); else tmp = x - (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.1e-32], N[Not[LessEqual[z, 11500000000.0]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-32} \lor \neg \left(z \leq 11500000000\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -4.09999999999999975e-32 or 1.15e10 < z Initial program 89.5%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in t around 0 78.1%
+-commutative78.1%
associate-*l/84.5%
*-commutative84.5%
Simplified84.5%
if -4.09999999999999975e-32 < z < 1.15e10Initial program 96.4%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in z around 0 91.0%
mul-1-neg91.0%
unsub-neg91.0%
associate-*r/91.1%
Simplified91.1%
Final simplification88.0%
(FPCore (x y z t a) :precision binary64 (if (<= x -5.5e+124) x (if (<= x 1.06e+40) (* y (/ (- z t) a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -5.5e+124) {
tmp = x;
} else if (x <= 1.06e+40) {
tmp = y * ((z - t) / 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 (x <= (-5.5d+124)) then
tmp = x
else if (x <= 1.06d+40) then
tmp = y * ((z - t) / 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 (x <= -5.5e+124) {
tmp = x;
} else if (x <= 1.06e+40) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -5.5e+124: tmp = x elif x <= 1.06e+40: tmp = y * ((z - t) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -5.5e+124) tmp = x; elseif (x <= 1.06e+40) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -5.5e+124) tmp = x; elseif (x <= 1.06e+40) tmp = y * ((z - t) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -5.5e+124], x, If[LessEqual[x, 1.06e+40], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{+124}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{+40}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.49999999999999977e124 or 1.05999999999999996e40 < x Initial program 97.0%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in x around inf 74.0%
if -5.49999999999999977e124 < x < 1.05999999999999996e40Initial program 90.8%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in y around inf 72.0%
Taylor expanded in z around 0 72.0%
neg-mul-172.0%
+-commutative72.0%
sub-neg72.0%
div-sub72.6%
Simplified72.6%
Final simplification73.2%
(FPCore (x y z t a) :precision binary64 (if (<= x -3.5e-58) (+ x (/ y (/ a z))) (if (<= x 1.4e+38) (* y (/ (- z t) a)) (+ x (/ (* y z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.5e-58) {
tmp = x + (y / (a / z));
} else if (x <= 1.4e+38) {
tmp = y * ((z - 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 (x <= (-3.5d-58)) then
tmp = x + (y / (a / z))
else if (x <= 1.4d+38) then
tmp = y * ((z - 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 (x <= -3.5e-58) {
tmp = x + (y / (a / z));
} else if (x <= 1.4e+38) {
tmp = y * ((z - t) / a);
} else {
tmp = x + ((y * z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.5e-58: tmp = x + (y / (a / z)) elif x <= 1.4e+38: tmp = y * ((z - t) / a) else: tmp = x + ((y * z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.5e-58) tmp = Float64(x + Float64(y / Float64(a / z))); elseif (x <= 1.4e+38) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = Float64(x + Float64(Float64(y * z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -3.5e-58) tmp = x + (y / (a / z)); elseif (x <= 1.4e+38) tmp = y * ((z - t) / a); else tmp = x + ((y * z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.5e-58], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4e+38], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-58}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+38}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if x < -3.4999999999999999e-58Initial program 92.5%
associate-*l/97.5%
Simplified97.5%
associate-/r/95.1%
Applied egg-rr95.1%
Taylor expanded in z around inf 78.5%
if -3.4999999999999999e-58 < x < 1.4e38Initial program 92.0%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in y around inf 78.1%
Taylor expanded in z around 0 78.1%
neg-mul-178.1%
+-commutative78.1%
sub-neg78.1%
div-sub78.0%
Simplified78.0%
if 1.4e38 < x Initial program 96.7%
associate-*l/94.9%
Simplified94.9%
Taylor expanded in z around inf 84.5%
Final simplification79.7%
(FPCore (x y z t a) :precision binary64 (if (<= x -2.35e-57) (+ x (* z (/ y a))) (if (<= x 1.8e+38) (* y (/ (- z t) a)) (+ x (/ (* y z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.35e-57) {
tmp = x + (z * (y / a));
} else if (x <= 1.8e+38) {
tmp = y * ((z - 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 (x <= (-2.35d-57)) then
tmp = x + (z * (y / a))
else if (x <= 1.8d+38) then
tmp = y * ((z - 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 (x <= -2.35e-57) {
tmp = x + (z * (y / a));
} else if (x <= 1.8e+38) {
tmp = y * ((z - t) / a);
} else {
tmp = x + ((y * z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.35e-57: tmp = x + (z * (y / a)) elif x <= 1.8e+38: tmp = y * ((z - t) / a) else: tmp = x + ((y * z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.35e-57) tmp = Float64(x + Float64(z * Float64(y / a))); elseif (x <= 1.8e+38) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = Float64(x + Float64(Float64(y * z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -2.35e-57) tmp = x + (z * (y / a)); elseif (x <= 1.8e+38) tmp = y * ((z - t) / a); else tmp = x + ((y * z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.35e-57], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e+38], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.35 \cdot 10^{-57}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+38}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if x < -2.3499999999999999e-57Initial program 92.5%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in t around 0 77.1%
+-commutative77.1%
associate-*l/79.8%
*-commutative79.8%
Simplified79.8%
if -2.3499999999999999e-57 < x < 1.79999999999999985e38Initial program 92.0%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in y around inf 78.1%
Taylor expanded in z around 0 78.1%
neg-mul-178.1%
+-commutative78.1%
sub-neg78.1%
div-sub78.0%
Simplified78.0%
if 1.79999999999999985e38 < x Initial program 96.7%
associate-*l/94.9%
Simplified94.9%
Taylor expanded in z around inf 84.5%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (if (<= x -2.3e-17) x (if (<= x 6.2e+29) (* y (/ z a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.3e-17) {
tmp = x;
} else if (x <= 6.2e+29) {
tmp = y * (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 (x <= (-2.3d-17)) then
tmp = x
else if (x <= 6.2d+29) then
tmp = y * (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 (x <= -2.3e-17) {
tmp = x;
} else if (x <= 6.2e+29) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.3e-17: tmp = x elif x <= 6.2e+29: tmp = y * (z / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.3e-17) tmp = x; elseif (x <= 6.2e+29) tmp = Float64(y * Float64(z / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -2.3e-17) tmp = x; elseif (x <= 6.2e+29) tmp = y * (z / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.3e-17], x, If[LessEqual[x, 6.2e+29], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+29}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.30000000000000009e-17 or 6.1999999999999998e29 < x Initial program 94.0%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 65.6%
if -2.30000000000000009e-17 < x < 6.1999999999999998e29Initial program 92.4%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in y around inf 76.8%
Taylor expanded in z around inf 41.9%
Final simplification53.8%
(FPCore (x y z t a) :precision binary64 (if (<= x -3.6e-17) x (if (<= x 2.7e+36) (* z (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.6e-17) {
tmp = x;
} else if (x <= 2.7e+36) {
tmp = z * (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 (x <= (-3.6d-17)) then
tmp = x
else if (x <= 2.7d+36) then
tmp = z * (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 (x <= -3.6e-17) {
tmp = x;
} else if (x <= 2.7e+36) {
tmp = z * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.6e-17: tmp = x elif x <= 2.7e+36: tmp = z * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.6e-17) tmp = x; elseif (x <= 2.7e+36) tmp = Float64(z * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -3.6e-17) tmp = x; elseif (x <= 2.7e+36) tmp = z * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.6e-17], x, If[LessEqual[x, 2.7e+36], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+36}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.59999999999999995e-17 or 2.7000000000000001e36 < x Initial program 94.0%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 65.6%
if -3.59999999999999995e-17 < x < 2.7000000000000001e36Initial program 92.4%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in y around inf 76.8%
Taylor expanded in z around inf 41.9%
clear-num41.8%
un-div-inv42.2%
Applied egg-rr42.2%
associate-/r/44.1%
Applied egg-rr44.1%
Final simplification54.9%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / 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 + ((z - t) * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / a));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{a}
\end{array}
Initial program 93.2%
associate-*l/96.2%
Simplified96.2%
Final simplification96.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 93.2%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in x around inf 42.1%
Final simplification42.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 2023293
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
: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)))