
(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 (<= a 8.6e-40) (- x (/ (* y (- z t)) a)) (+ x (* y (/ (- t z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 8.6e-40) {
tmp = x - ((y * (z - t)) / a);
} 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 (a <= 8.6d-40) then
tmp = x - ((y * (z - t)) / a)
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 (a <= 8.6e-40) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x + (y * ((t - z) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 8.6e-40: tmp = x - ((y * (z - t)) / a) else: tmp = x + (y * ((t - z) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 8.6e-40) tmp = Float64(x - Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 8.6e-40) tmp = x - ((y * (z - t)) / a); else tmp = x + (y * ((t - z) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 8.6e-40], N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.6 \cdot 10^{-40}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\end{array}
\end{array}
if a < 8.6000000000000005e-40Initial program 98.4%
if 8.6000000000000005e-40 < a Initial program 89.7%
associate-/l*99.9%
Simplified99.9%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -2.5e+37) (not (<= y 2.2))) (* y (/ (- t z) a)) (- x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.5e+37) || !(y <= 2.2)) {
tmp = y * ((t - z) / 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 ((y <= (-2.5d+37)) .or. (.not. (y <= 2.2d0))) then
tmp = y * ((t - z) / 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 ((y <= -2.5e+37) || !(y <= 2.2)) {
tmp = y * ((t - z) / a);
} else {
tmp = x - (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -2.5e+37) or not (y <= 2.2): tmp = y * ((t - z) / a) else: tmp = x - (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -2.5e+37) || !(y <= 2.2)) tmp = Float64(y * Float64(Float64(t - z) / 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 ((y <= -2.5e+37) || ~((y <= 2.2))) tmp = y * ((t - z) / a); else tmp = x - (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -2.5e+37], N[Not[LessEqual[y, 2.2]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+37} \lor \neg \left(y \leq 2.2\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -2.49999999999999994e37 or 2.2000000000000002 < y Initial program 90.3%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 76.1%
mul-1-neg76.1%
distribute-frac-neg76.1%
distribute-rgt-neg-in76.1%
sub-neg76.1%
distribute-neg-in76.1%
remove-double-neg76.1%
+-commutative76.1%
sub-neg76.1%
associate-*r/84.7%
Simplified84.7%
if -2.49999999999999994e37 < y < 2.2000000000000002Initial program 99.9%
associate-/l*89.1%
Simplified89.1%
Taylor expanded in y around 0 99.9%
associate-*l/98.3%
*-commutative98.3%
Simplified98.3%
clear-num97.9%
un-div-inv97.9%
Applied egg-rr97.9%
Taylor expanded in z around inf 82.6%
Final simplification83.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -5.3e-98) (not (<= y 1.05e-117))) (* y (/ (- t z) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.3e-98) || !(y <= 1.05e-117)) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-5.3d-98)) .or. (.not. (y <= 1.05d-117))) then
tmp = y * ((t - z) / a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.3e-98) || !(y <= 1.05e-117)) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -5.3e-98) or not (y <= 1.05e-117): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5.3e-98) || !(y <= 1.05e-117)) tmp = Float64(y * Float64(Float64(t - z) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -5.3e-98) || ~((y <= 1.05e-117))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5.3e-98], N[Not[LessEqual[y, 1.05e-117]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.3 \cdot 10^{-98} \lor \neg \left(y \leq 1.05 \cdot 10^{-117}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.30000000000000031e-98 or 1.05e-117 < y Initial program 93.1%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in x around 0 71.2%
mul-1-neg71.2%
distribute-frac-neg71.2%
distribute-rgt-neg-in71.2%
sub-neg71.2%
distribute-neg-in71.2%
remove-double-neg71.2%
+-commutative71.2%
sub-neg71.2%
associate-*r/76.1%
Simplified76.1%
if -5.30000000000000031e-98 < y < 1.05e-117Initial program 99.9%
associate-/l*86.1%
Simplified86.1%
Taylor expanded in x around inf 69.9%
Final simplification73.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.9e-57) (- x (* y (/ z a))) (if (<= a 8.2e-237) (/ (* y (- t z)) a) (- x (/ z (/ a y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.9e-57) {
tmp = x - (y * (z / a));
} else if (a <= 8.2e-237) {
tmp = (y * (t - z)) / 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 (a <= (-1.9d-57)) then
tmp = x - (y * (z / a))
else if (a <= 8.2d-237) then
tmp = (y * (t - z)) / 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 (a <= -1.9e-57) {
tmp = x - (y * (z / a));
} else if (a <= 8.2e-237) {
tmp = (y * (t - z)) / a;
} else {
tmp = x - (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.9e-57: tmp = x - (y * (z / a)) elif a <= 8.2e-237: tmp = (y * (t - z)) / a else: tmp = x - (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.9e-57) tmp = Float64(x - Float64(y * Float64(z / a))); elseif (a <= 8.2e-237) tmp = Float64(Float64(y * Float64(t - z)) / 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 (a <= -1.9e-57) tmp = x - (y * (z / a)); elseif (a <= 8.2e-237) tmp = (y * (t - z)) / a; else tmp = x - (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.9e-57], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 8.2e-237], N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x - N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{-57}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{elif}\;a \leq 8.2 \cdot 10^{-237}:\\
\;\;\;\;\frac{y \cdot \left(t - z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if a < -1.8999999999999999e-57Initial program 96.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 81.9%
associate-/l*83.1%
Simplified83.1%
if -1.8999999999999999e-57 < a < 8.2000000000000002e-237Initial program 99.9%
sub-neg99.9%
distribute-frac-neg299.9%
+-commutative99.9%
associate-/l*82.5%
fma-define82.5%
distribute-frac-neg282.5%
distribute-neg-frac82.5%
sub-neg82.5%
distribute-neg-in82.5%
remove-double-neg82.5%
+-commutative82.5%
sub-neg82.5%
Simplified82.5%
Taylor expanded in y around -inf 90.8%
if 8.2000000000000002e-237 < a Initial program 93.5%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in y around 0 93.5%
associate-*l/98.3%
*-commutative98.3%
Simplified98.3%
clear-num98.2%
un-div-inv98.9%
Applied egg-rr98.9%
Taylor expanded in z around inf 82.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.2e-23) (not (<= z 2.6e+54))) (* z (/ y (- a))) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.2e-23) || !(z <= 2.6e+54)) {
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 ((z <= (-6.2d-23)) .or. (.not. (z <= 2.6d+54))) 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 ((z <= -6.2e-23) || !(z <= 2.6e+54)) {
tmp = z * (y / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.2e-23) or not (z <= 2.6e+54): tmp = z * (y / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.2e-23) || !(z <= 2.6e+54)) tmp = Float64(z * Float64(y / Float64(-a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6.2e-23) || ~((z <= 2.6e+54))) tmp = z * (y / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.2e-23], N[Not[LessEqual[z, 2.6e+54]], $MachinePrecision]], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{-23} \lor \neg \left(z \leq 2.6 \cdot 10^{+54}\right):\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.1999999999999998e-23 or 2.60000000000000007e54 < z Initial program 93.3%
associate-/l*90.1%
Simplified90.1%
Taylor expanded in y around 0 93.3%
associate-*l/99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in z around inf 62.7%
mul-1-neg62.7%
associate-*l/65.9%
distribute-rgt-neg-in65.9%
Simplified65.9%
if -6.1999999999999998e-23 < z < 2.60000000000000007e54Initial program 97.9%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in x around inf 57.3%
Final simplification61.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -7.4e+40) (not (<= y 1.75e-67))) (* (/ z a) (- y)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -7.4e+40) || !(y <= 1.75e-67)) {
tmp = (z / a) * -y;
} 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 ((y <= (-7.4d+40)) .or. (.not. (y <= 1.75d-67))) then
tmp = (z / a) * -y
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 ((y <= -7.4e+40) || !(y <= 1.75e-67)) {
tmp = (z / a) * -y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -7.4e+40) or not (y <= 1.75e-67): tmp = (z / a) * -y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -7.4e+40) || !(y <= 1.75e-67)) tmp = Float64(Float64(z / a) * Float64(-y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -7.4e+40) || ~((y <= 1.75e-67))) tmp = (z / a) * -y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -7.4e+40], N[Not[LessEqual[y, 1.75e-67]], $MachinePrecision]], N[(N[(z / a), $MachinePrecision] * (-y)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{+40} \lor \neg \left(y \leq 1.75 \cdot 10^{-67}\right):\\
\;\;\;\;\frac{z}{a} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.4e40 or 1.75e-67 < y Initial program 90.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 53.5%
mul-1-neg53.5%
associate-/l*57.5%
distribute-rgt-neg-in57.5%
distribute-neg-frac257.5%
Simplified57.5%
if -7.4e40 < y < 1.75e-67Initial program 99.9%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in x around inf 61.9%
Final simplification59.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -9.5e-59) x (if (<= a 6.3e-232) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9.5e-59) {
tmp = x;
} else if (a <= 6.3e-232) {
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 (a <= (-9.5d-59)) then
tmp = x
else if (a <= 6.3d-232) 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 (a <= -9.5e-59) {
tmp = x;
} else if (a <= 6.3e-232) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -9.5e-59: tmp = x elif a <= 6.3e-232: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9.5e-59) tmp = x; elseif (a <= 6.3e-232) 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 (a <= -9.5e-59) tmp = x; elseif (a <= 6.3e-232) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9.5e-59], x, If[LessEqual[a, 6.3e-232], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.5 \cdot 10^{-59}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 6.3 \cdot 10^{-232}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -9.4999999999999994e-59 or 6.3000000000000001e-232 < a Initial program 94.4%
associate-/l*97.4%
Simplified97.4%
Taylor expanded in x around inf 53.4%
if -9.4999999999999994e-59 < a < 6.3000000000000001e-232Initial program 99.9%
associate-/l*82.8%
Simplified82.8%
Taylor expanded in t around inf 48.7%
associate-/l*54.2%
Simplified54.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -34000000000.0) (* y (/ (- t z) a)) (- x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -34000000000.0) {
tmp = y * ((t - z) / 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 <= (-34000000000.0d0)) then
tmp = y * ((t - z) / 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 <= -34000000000.0) {
tmp = y * ((t - z) / a);
} else {
tmp = x - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -34000000000.0: tmp = y * ((t - z) / a) else: tmp = x - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -34000000000.0) tmp = Float64(y * Float64(Float64(t - z) / 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 <= -34000000000.0) tmp = y * ((t - z) / a); else tmp = x - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -34000000000.0], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -34000000000:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -3.4e10Initial program 90.9%
associate-/l*92.8%
Simplified92.8%
Taylor expanded in x around 0 68.0%
mul-1-neg68.0%
distribute-frac-neg68.0%
distribute-rgt-neg-in68.0%
sub-neg68.0%
distribute-neg-in68.0%
remove-double-neg68.0%
+-commutative68.0%
sub-neg68.0%
associate-*r/69.9%
Simplified69.9%
if -3.4e10 < t Initial program 97.1%
associate-/l*93.8%
Simplified93.8%
Taylor expanded in z around inf 83.4%
associate-/l*81.0%
Simplified81.0%
(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.8%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in y around 0 95.8%
associate-*l/97.1%
*-commutative97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- t z) a))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((t - z) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / a));
}
def code(x, y, z, t, a): return x + (y * ((t - z) / a))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(t - z) / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((t - z) / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{t - z}{a}
\end{array}
Initial program 95.8%
associate-/l*93.6%
Simplified93.6%
Final simplification93.6%
(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.8%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in x around inf 42.4%
(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 2024145
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
: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)))