
(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 (if (<= (- z t) -5e+143) (+ x (* (/ y a) (- t z))) (+ x (/ (* y (- t z)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z - t) <= -5e+143) {
tmp = x + ((y / a) * (t - z));
} else {
tmp = x + ((y * (t - 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 ((z - t) <= (-5d+143)) then
tmp = x + ((y / a) * (t - z))
else
tmp = x + ((y * (t - 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 ((z - t) <= -5e+143) {
tmp = x + ((y / a) * (t - z));
} else {
tmp = x + ((y * (t - z)) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z - t) <= -5e+143: tmp = x + ((y / a) * (t - z)) else: tmp = x + ((y * (t - z)) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(z - t) <= -5e+143) tmp = Float64(x + Float64(Float64(y / a) * Float64(t - z))); else tmp = Float64(x + Float64(Float64(y * Float64(t - z)) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z - t) <= -5e+143) tmp = x + ((y / a) * (t - z)); else tmp = x + ((y * (t - z)) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z - t), $MachinePrecision], -5e+143], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - t \leq -5 \cdot 10^{+143}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\end{array}
\end{array}
if (-.f64 z t) < -5.00000000000000012e143Initial program 83.7%
associate-*l/98.4%
Simplified98.4%
if -5.00000000000000012e143 < (-.f64 z t) Initial program 99.2%
Final simplification99.0%
(FPCore (x y z t a)
:precision binary64
(if (<= x -2.05e+43)
x
(if (or (<= x -92.0) (and (not (<= x -2.4e-29)) (<= x 2.1e-99)))
(* y (/ t a))
x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.05e+43) {
tmp = x;
} else if ((x <= -92.0) || (!(x <= -2.4e-29) && (x <= 2.1e-99))) {
tmp = y * (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 <= (-2.05d+43)) then
tmp = x
else if ((x <= (-92.0d0)) .or. (.not. (x <= (-2.4d-29))) .and. (x <= 2.1d-99)) then
tmp = y * (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 <= -2.05e+43) {
tmp = x;
} else if ((x <= -92.0) || (!(x <= -2.4e-29) && (x <= 2.1e-99))) {
tmp = y * (t / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.05e+43: tmp = x elif (x <= -92.0) or (not (x <= -2.4e-29) and (x <= 2.1e-99)): tmp = y * (t / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.05e+43) tmp = x; elseif ((x <= -92.0) || (!(x <= -2.4e-29) && (x <= 2.1e-99))) tmp = Float64(y * Float64(t / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -2.05e+43) tmp = x; elseif ((x <= -92.0) || (~((x <= -2.4e-29)) && (x <= 2.1e-99))) tmp = y * (t / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.05e+43], x, If[Or[LessEqual[x, -92.0], And[N[Not[LessEqual[x, -2.4e-29]], $MachinePrecision], LessEqual[x, 2.1e-99]]], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{+43}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -92 \lor \neg \left(x \leq -2.4 \cdot 10^{-29}\right) \land x \leq 2.1 \cdot 10^{-99}:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.05e43 or -92 < x < -2.39999999999999992e-29 or 2.09999999999999984e-99 < x Initial program 97.4%
associate-*r/93.7%
Simplified93.7%
Taylor expanded in z around 0 73.8%
neg-mul-173.8%
distribute-neg-frac73.8%
Simplified73.8%
Taylor expanded in x around inf 59.8%
if -2.05e43 < x < -92 or -2.39999999999999992e-29 < x < 2.09999999999999984e-99Initial program 93.1%
associate-*r/92.5%
Simplified92.5%
Taylor expanded in z around 0 66.3%
neg-mul-166.3%
distribute-neg-frac66.3%
Simplified66.3%
Taylor expanded in x around 0 54.6%
*-commutative54.6%
associate-*l/54.8%
*-commutative54.8%
Simplified54.8%
Final simplification57.8%
(FPCore (x y z t a)
:precision binary64
(if (<= x -2.1e+54)
x
(if (or (<= x -260.0) (and (not (<= x -2.1e-29)) (<= x 3.4e-30)))
(* t (/ y a))
x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.1e+54) {
tmp = x;
} else if ((x <= -260.0) || (!(x <= -2.1e-29) && (x <= 3.4e-30))) {
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 (x <= (-2.1d+54)) then
tmp = x
else if ((x <= (-260.0d0)) .or. (.not. (x <= (-2.1d-29))) .and. (x <= 3.4d-30)) 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 (x <= -2.1e+54) {
tmp = x;
} else if ((x <= -260.0) || (!(x <= -2.1e-29) && (x <= 3.4e-30))) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.1e+54: tmp = x elif (x <= -260.0) or (not (x <= -2.1e-29) and (x <= 3.4e-30)): tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.1e+54) tmp = x; elseif ((x <= -260.0) || (!(x <= -2.1e-29) && (x <= 3.4e-30))) tmp = Float64(t * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -2.1e+54) tmp = x; elseif ((x <= -260.0) || (~((x <= -2.1e-29)) && (x <= 3.4e-30))) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.1e+54], x, If[Or[LessEqual[x, -260.0], And[N[Not[LessEqual[x, -2.1e-29]], $MachinePrecision], LessEqual[x, 3.4e-30]]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+54}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -260 \lor \neg \left(x \leq -2.1 \cdot 10^{-29}\right) \land x \leq 3.4 \cdot 10^{-30}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.09999999999999986e54 or -260 < x < -2.09999999999999989e-29 or 3.4000000000000003e-30 < x Initial program 96.9%
associate-*r/96.2%
Simplified96.2%
Taylor expanded in z around 0 77.8%
neg-mul-177.8%
distribute-neg-frac77.8%
Simplified77.8%
Taylor expanded in x around inf 65.6%
if -2.09999999999999986e54 < x < -260 or -2.09999999999999989e-29 < x < 3.4000000000000003e-30Initial program 94.4%
associate-*r/90.3%
Simplified90.3%
Taylor expanded in z around 0 63.8%
neg-mul-163.8%
distribute-neg-frac63.8%
Simplified63.8%
Taylor expanded in x around 0 50.7%
associate-*l/51.9%
Applied egg-rr51.9%
Final simplification58.7%
(FPCore (x y z t a)
:precision binary64
(if (<= x -6.1e+52)
x
(if (<= x -0.25)
(/ (* t y) a)
(if (<= x -2.25e-29) x (if (<= x 1.35e-33) (* t (/ y a)) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.1e+52) {
tmp = x;
} else if (x <= -0.25) {
tmp = (t * y) / a;
} else if (x <= -2.25e-29) {
tmp = x;
} else if (x <= 1.35e-33) {
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 (x <= (-6.1d+52)) then
tmp = x
else if (x <= (-0.25d0)) then
tmp = (t * y) / a
else if (x <= (-2.25d-29)) then
tmp = x
else if (x <= 1.35d-33) 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 (x <= -6.1e+52) {
tmp = x;
} else if (x <= -0.25) {
tmp = (t * y) / a;
} else if (x <= -2.25e-29) {
tmp = x;
} else if (x <= 1.35e-33) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -6.1e+52: tmp = x elif x <= -0.25: tmp = (t * y) / a elif x <= -2.25e-29: tmp = x elif x <= 1.35e-33: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.1e+52) tmp = x; elseif (x <= -0.25) tmp = Float64(Float64(t * y) / a); elseif (x <= -2.25e-29) tmp = x; elseif (x <= 1.35e-33) tmp = Float64(t * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -6.1e+52) tmp = x; elseif (x <= -0.25) tmp = (t * y) / a; elseif (x <= -2.25e-29) tmp = x; elseif (x <= 1.35e-33) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.1e+52], x, If[LessEqual[x, -0.25], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[x, -2.25e-29], x, If[LessEqual[x, 1.35e-33], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.1 \cdot 10^{+52}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -0.25:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-29}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-33}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.09999999999999996e52 or -0.25 < x < -2.2499999999999999e-29 or 1.35e-33 < x Initial program 96.9%
associate-*r/96.2%
Simplified96.2%
Taylor expanded in z around 0 77.8%
neg-mul-177.8%
distribute-neg-frac77.8%
Simplified77.8%
Taylor expanded in x around inf 65.6%
if -6.09999999999999996e52 < x < -0.25Initial program 100.0%
associate-*r/89.2%
Simplified89.2%
Taylor expanded in z around 0 73.0%
neg-mul-173.0%
distribute-neg-frac73.0%
Simplified73.0%
Taylor expanded in x around 0 57.9%
if -2.2499999999999999e-29 < x < 1.35e-33Initial program 93.5%
associate-*r/90.5%
Simplified90.5%
Taylor expanded in z around 0 62.3%
neg-mul-162.3%
distribute-neg-frac62.3%
Simplified62.3%
Taylor expanded in x around 0 49.5%
associate-*l/51.8%
Applied egg-rr51.8%
Final simplification59.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.05e+24) (not (<= z 5.9e+69))) (- x (* y (/ z a))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.05e+24) || !(z <= 5.9e+69)) {
tmp = x - (y * (z / 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 <= (-1.05d+24)) .or. (.not. (z <= 5.9d+69))) then
tmp = x - (y * (z / 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 <= -1.05e+24) || !(z <= 5.9e+69)) {
tmp = x - (y * (z / a));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.05e+24) or not (z <= 5.9e+69): tmp = x - (y * (z / a)) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.05e+24) || !(z <= 5.9e+69)) tmp = Float64(x - Float64(y * Float64(z / 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 <= -1.05e+24) || ~((z <= 5.9e+69))) tmp = x - (y * (z / a)); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.05e+24], N[Not[LessEqual[z, 5.9e+69]], $MachinePrecision]], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+24} \lor \neg \left(z \leq 5.9 \cdot 10^{+69}\right):\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.0500000000000001e24 or 5.90000000000000004e69 < z Initial program 94.3%
associate-*r/91.0%
Simplified91.0%
Taylor expanded in z around inf 84.5%
if -1.0500000000000001e24 < z < 5.90000000000000004e69Initial program 96.6%
associate-*r/94.8%
Simplified94.8%
Taylor expanded in z around 0 86.9%
neg-mul-186.9%
distribute-neg-frac86.9%
Simplified86.9%
sub-neg86.9%
+-commutative86.9%
distribute-lft-neg-in86.9%
*-commutative86.9%
frac-2neg86.9%
remove-double-neg86.9%
associate-/r/89.4%
frac-2neg89.4%
div-inv90.0%
clear-num90.0%
Applied egg-rr90.0%
Final simplification87.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9e+25) (not (<= z 3.35e+68))) (- x (* z (/ y a))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e+25) || !(z <= 3.35e+68)) {
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 <= (-9d+25)) .or. (.not. (z <= 3.35d+68))) 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 <= -9e+25) || !(z <= 3.35e+68)) {
tmp = x - (z * (y / a));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9e+25) or not (z <= 3.35e+68): 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 <= -9e+25) || !(z <= 3.35e+68)) 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 <= -9e+25) || ~((z <= 3.35e+68))) 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, -9e+25], N[Not[LessEqual[z, 3.35e+68]], $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 -9 \cdot 10^{+25} \lor \neg \left(z \leq 3.35 \cdot 10^{+68}\right):\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -9.0000000000000006e25 or 3.3499999999999999e68 < z Initial program 94.3%
associate-*r/91.0%
Simplified91.0%
Taylor expanded in z around inf 86.2%
associate-*l/90.9%
*-commutative90.9%
Simplified90.9%
if -9.0000000000000006e25 < z < 3.3499999999999999e68Initial program 96.6%
associate-*r/94.8%
Simplified94.8%
Taylor expanded in z around 0 86.9%
neg-mul-186.9%
distribute-neg-frac86.9%
Simplified86.9%
sub-neg86.9%
+-commutative86.9%
distribute-lft-neg-in86.9%
*-commutative86.9%
frac-2neg86.9%
remove-double-neg86.9%
associate-/r/89.4%
frac-2neg89.4%
div-inv90.0%
clear-num90.0%
Applied egg-rr90.0%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.8e+23) (- x (* z (/ y a))) (if (<= z 7.4e+68) (+ x (* t (/ y a))) (- x (/ z (/ a y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.8e+23) {
tmp = x - (z * (y / a));
} else if (z <= 7.4e+68) {
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 (z <= (-4.8d+23)) then
tmp = x - (z * (y / a))
else if (z <= 7.4d+68) 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 (z <= -4.8e+23) {
tmp = x - (z * (y / a));
} else if (z <= 7.4e+68) {
tmp = x + (t * (y / a));
} else {
tmp = x - (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.8e+23: tmp = x - (z * (y / a)) elif z <= 7.4e+68: tmp = x + (t * (y / a)) else: tmp = x - (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.8e+23) tmp = Float64(x - Float64(z * Float64(y / a))); elseif (z <= 7.4e+68) 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 (z <= -4.8e+23) tmp = x - (z * (y / a)); elseif (z <= 7.4e+68) tmp = x + (t * (y / a)); else tmp = x - (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.8e+23], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.4e+68], 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}\;z \leq -4.8 \cdot 10^{+23}:\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+68}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -4.8e23Initial program 93.2%
associate-*r/91.8%
Simplified91.8%
Taylor expanded in z around inf 84.5%
associate-*l/91.2%
*-commutative91.2%
Simplified91.2%
if -4.8e23 < z < 7.39999999999999996e68Initial program 96.6%
associate-*r/94.8%
Simplified94.8%
Taylor expanded in z around 0 86.9%
neg-mul-186.9%
distribute-neg-frac86.9%
Simplified86.9%
sub-neg86.9%
+-commutative86.9%
distribute-lft-neg-in86.9%
*-commutative86.9%
frac-2neg86.9%
remove-double-neg86.9%
associate-/r/89.4%
frac-2neg89.4%
div-inv90.0%
clear-num90.0%
Applied egg-rr90.0%
if 7.39999999999999996e68 < z Initial program 95.6%
associate-*r/90.0%
Simplified90.0%
Taylor expanded in z around inf 82.4%
*-commutative82.4%
associate-/r/90.5%
Applied egg-rr90.5%
Final simplification90.4%
(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 95.6%
associate-*r/93.2%
Simplified93.2%
Final simplification93.2%
(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 95.6%
associate-*l/97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (x y z t a) :precision binary64 (+ x (* t (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x + (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 + (t * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (t * (y / a));
}
def code(x, y, z, t, a): return x + (t * (y / a))
function code(x, y, z, t, a) return Float64(x + Float64(t * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (t * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + t \cdot \frac{y}{a}
\end{array}
Initial program 95.6%
associate-*r/93.2%
Simplified93.2%
Taylor expanded in z around 0 70.7%
neg-mul-170.7%
distribute-neg-frac70.7%
Simplified70.7%
sub-neg70.7%
+-commutative70.7%
distribute-lft-neg-in70.7%
*-commutative70.7%
frac-2neg70.7%
remove-double-neg70.7%
associate-/r/73.4%
frac-2neg73.4%
div-inv73.7%
clear-num73.8%
Applied egg-rr73.8%
Final simplification73.8%
(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 95.6%
associate-*r/93.2%
Simplified93.2%
Taylor expanded in z around 0 70.7%
neg-mul-170.7%
distribute-neg-frac70.7%
Simplified70.7%
Taylor expanded in x around inf 41.1%
Final simplification41.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 2023224
(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)))