
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (- t z) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (a / y));
}
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 - z) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (a / y));
}
def code(x, y, z, t, a): return x + ((t - z) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(t - z) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((t - z) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{t - z}{\frac{a}{y}}
\end{array}
Initial program 91.8%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in y around 0 91.8%
*-commutative91.8%
associate-/l*97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ y (- a)))))
(if (<= y -2.25e+206)
t_1
(if (<= y -1.9e+128)
(/ t (/ a y))
(if (or (<= y -5.3e+14) (and (not (<= y -2.4e-45)) (<= y 6500000000.0)))
x
t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / -a);
double tmp;
if (y <= -2.25e+206) {
tmp = t_1;
} else if (y <= -1.9e+128) {
tmp = t / (a / y);
} else if ((y <= -5.3e+14) || (!(y <= -2.4e-45) && (y <= 6500000000.0))) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = z * (y / -a)
if (y <= (-2.25d+206)) then
tmp = t_1
else if (y <= (-1.9d+128)) then
tmp = t / (a / y)
else if ((y <= (-5.3d+14)) .or. (.not. (y <= (-2.4d-45))) .and. (y <= 6500000000.0d0)) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / -a);
double tmp;
if (y <= -2.25e+206) {
tmp = t_1;
} else if (y <= -1.9e+128) {
tmp = t / (a / y);
} else if ((y <= -5.3e+14) || (!(y <= -2.4e-45) && (y <= 6500000000.0))) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (y / -a) tmp = 0 if y <= -2.25e+206: tmp = t_1 elif y <= -1.9e+128: tmp = t / (a / y) elif (y <= -5.3e+14) or (not (y <= -2.4e-45) and (y <= 6500000000.0)): tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(y / Float64(-a))) tmp = 0.0 if (y <= -2.25e+206) tmp = t_1; elseif (y <= -1.9e+128) tmp = Float64(t / Float64(a / y)); elseif ((y <= -5.3e+14) || (!(y <= -2.4e-45) && (y <= 6500000000.0))) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (y / -a); tmp = 0.0; if (y <= -2.25e+206) tmp = t_1; elseif (y <= -1.9e+128) tmp = t / (a / y); elseif ((y <= -5.3e+14) || (~((y <= -2.4e-45)) && (y <= 6500000000.0))) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.25e+206], t$95$1, If[LessEqual[y, -1.9e+128], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -5.3e+14], And[N[Not[LessEqual[y, -2.4e-45]], $MachinePrecision], LessEqual[y, 6500000000.0]]], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{-a}\\
\mathbf{if}\;y \leq -2.25 \cdot 10^{+206}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{+128}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;y \leq -5.3 \cdot 10^{+14} \lor \neg \left(y \leq -2.4 \cdot 10^{-45}\right) \land y \leq 6500000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -2.25000000000000009e206 or -5.3e14 < y < -2.3999999999999999e-45 or 6.5e9 < y Initial program 86.3%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in z around inf 52.2%
mul-1-neg52.2%
associate-*l/57.5%
*-commutative57.5%
distribute-rgt-neg-in57.5%
*-lft-identity57.5%
associate-*l/57.4%
remove-double-neg57.4%
neg-mul-157.4%
associate-*r*57.4%
*-commutative57.4%
neg-mul-157.4%
*-commutative57.4%
distribute-neg-frac57.4%
metadata-eval57.4%
metadata-eval57.4%
associate-/r*57.4%
neg-mul-157.4%
associate-*r/57.5%
*-rgt-identity57.5%
distribute-frac-neg57.5%
remove-double-neg57.5%
Simplified57.5%
if -2.25000000000000009e206 < y < -1.89999999999999995e128Initial program 84.8%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in t around inf 59.4%
associate-*r/69.3%
Simplified69.3%
clear-num69.3%
div-inv69.4%
Applied egg-rr69.4%
if -1.89999999999999995e128 < y < -5.3e14 or -2.3999999999999999e-45 < y < 6.5e9Initial program 97.1%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in x around inf 61.1%
Final simplification60.3%
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.3e+206)
(/ y (/ a (- z)))
(if (<= y -7.5e+127)
(/ t (/ a y))
(if (or (<= y -19500000000000.0)
(and (not (<= y -2.05e-45)) (<= y 42000000.0)))
x
(* z (/ y (- a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.3e+206) {
tmp = y / (a / -z);
} else if (y <= -7.5e+127) {
tmp = t / (a / y);
} else if ((y <= -19500000000000.0) || (!(y <= -2.05e-45) && (y <= 42000000.0))) {
tmp = x;
} else {
tmp = 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 (y <= (-1.3d+206)) then
tmp = y / (a / -z)
else if (y <= (-7.5d+127)) then
tmp = t / (a / y)
else if ((y <= (-19500000000000.0d0)) .or. (.not. (y <= (-2.05d-45))) .and. (y <= 42000000.0d0)) then
tmp = x
else
tmp = 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 (y <= -1.3e+206) {
tmp = y / (a / -z);
} else if (y <= -7.5e+127) {
tmp = t / (a / y);
} else if ((y <= -19500000000000.0) || (!(y <= -2.05e-45) && (y <= 42000000.0))) {
tmp = x;
} else {
tmp = z * (y / -a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.3e+206: tmp = y / (a / -z) elif y <= -7.5e+127: tmp = t / (a / y) elif (y <= -19500000000000.0) or (not (y <= -2.05e-45) and (y <= 42000000.0)): tmp = x else: tmp = z * (y / -a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.3e+206) tmp = Float64(y / Float64(a / Float64(-z))); elseif (y <= -7.5e+127) tmp = Float64(t / Float64(a / y)); elseif ((y <= -19500000000000.0) || (!(y <= -2.05e-45) && (y <= 42000000.0))) tmp = x; else tmp = Float64(z * Float64(y / Float64(-a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.3e+206) tmp = y / (a / -z); elseif (y <= -7.5e+127) tmp = t / (a / y); elseif ((y <= -19500000000000.0) || (~((y <= -2.05e-45)) && (y <= 42000000.0))) tmp = x; else tmp = z * (y / -a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.3e+206], N[(y / N[(a / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -7.5e+127], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -19500000000000.0], And[N[Not[LessEqual[y, -2.05e-45]], $MachinePrecision], LessEqual[y, 42000000.0]]], x, N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+206}:\\
\;\;\;\;\frac{y}{\frac{a}{-z}}\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{+127}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;y \leq -19500000000000 \lor \neg \left(y \leq -2.05 \cdot 10^{-45}\right) \land y \leq 42000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\end{array}
\end{array}
if y < -1.29999999999999994e206Initial program 95.1%
associate-*l/95.0%
Simplified95.0%
Taylor expanded in y around 0 95.1%
*-commutative95.1%
associate-/l*95.2%
Simplified95.2%
Taylor expanded in z around inf 62.3%
associate-*r/62.3%
mul-1-neg62.3%
distribute-rgt-neg-out62.3%
associate-/l*66.9%
Simplified66.9%
if -1.29999999999999994e206 < y < -7.4999999999999996e127Initial program 84.8%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in t around inf 59.4%
associate-*r/69.3%
Simplified69.3%
clear-num69.3%
div-inv69.4%
Applied egg-rr69.4%
if -7.4999999999999996e127 < y < -1.95e13 or -2.05e-45 < y < 4.2e7Initial program 97.1%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in x around inf 61.1%
if -1.95e13 < y < -2.05e-45 or 4.2e7 < y Initial program 84.2%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around inf 49.8%
mul-1-neg49.8%
associate-*l/55.4%
*-commutative55.4%
distribute-rgt-neg-in55.4%
*-lft-identity55.4%
associate-*l/55.4%
remove-double-neg55.4%
neg-mul-155.4%
associate-*r*55.4%
*-commutative55.4%
neg-mul-155.4%
*-commutative55.4%
distribute-neg-frac55.4%
metadata-eval55.4%
metadata-eval55.4%
associate-/r*55.4%
neg-mul-155.4%
associate-*r/55.4%
*-rgt-identity55.4%
distribute-frac-neg55.4%
remove-double-neg55.4%
Simplified55.4%
Final simplification60.3%
(FPCore (x y z t a)
:precision binary64
(if (<= y -2.95e+206)
(/ y (/ a (- z)))
(if (<= y -2.7e+128)
(/ t (/ a y))
(if (or (<= y -2.35e+14) (and (not (<= y -7e-46)) (<= y 38000000.0)))
x
(/ (- z) (/ a y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.95e+206) {
tmp = y / (a / -z);
} else if (y <= -2.7e+128) {
tmp = t / (a / y);
} else if ((y <= -2.35e+14) || (!(y <= -7e-46) && (y <= 38000000.0))) {
tmp = x;
} else {
tmp = -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.95d+206)) then
tmp = y / (a / -z)
else if (y <= (-2.7d+128)) then
tmp = t / (a / y)
else if ((y <= (-2.35d+14)) .or. (.not. (y <= (-7d-46))) .and. (y <= 38000000.0d0)) then
tmp = x
else
tmp = -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.95e+206) {
tmp = y / (a / -z);
} else if (y <= -2.7e+128) {
tmp = t / (a / y);
} else if ((y <= -2.35e+14) || (!(y <= -7e-46) && (y <= 38000000.0))) {
tmp = x;
} else {
tmp = -z / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.95e+206: tmp = y / (a / -z) elif y <= -2.7e+128: tmp = t / (a / y) elif (y <= -2.35e+14) or (not (y <= -7e-46) and (y <= 38000000.0)): tmp = x else: tmp = -z / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.95e+206) tmp = Float64(y / Float64(a / Float64(-z))); elseif (y <= -2.7e+128) tmp = Float64(t / Float64(a / y)); elseif ((y <= -2.35e+14) || (!(y <= -7e-46) && (y <= 38000000.0))) tmp = x; else tmp = Float64(Float64(-z) / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.95e+206) tmp = y / (a / -z); elseif (y <= -2.7e+128) tmp = t / (a / y); elseif ((y <= -2.35e+14) || (~((y <= -7e-46)) && (y <= 38000000.0))) tmp = x; else tmp = -z / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.95e+206], N[(y / N[(a / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.7e+128], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2.35e+14], And[N[Not[LessEqual[y, -7e-46]], $MachinePrecision], LessEqual[y, 38000000.0]]], x, N[((-z) / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.95 \cdot 10^{+206}:\\
\;\;\;\;\frac{y}{\frac{a}{-z}}\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{+128}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;y \leq -2.35 \cdot 10^{+14} \lor \neg \left(y \leq -7 \cdot 10^{-46}\right) \land y \leq 38000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -2.95e206Initial program 95.1%
associate-*l/95.0%
Simplified95.0%
Taylor expanded in y around 0 95.1%
*-commutative95.1%
associate-/l*95.2%
Simplified95.2%
Taylor expanded in z around inf 62.3%
associate-*r/62.3%
mul-1-neg62.3%
distribute-rgt-neg-out62.3%
associate-/l*66.9%
Simplified66.9%
if -2.95e206 < y < -2.70000000000000001e128Initial program 84.8%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in t around inf 59.4%
associate-*r/69.3%
Simplified69.3%
clear-num69.3%
div-inv69.4%
Applied egg-rr69.4%
if -2.70000000000000001e128 < y < -2.35e14 or -7.0000000000000004e-46 < y < 3.8e7Initial program 97.1%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in x around inf 61.1%
if -2.35e14 < y < -7.0000000000000004e-46 or 3.8e7 < y Initial program 84.2%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around inf 49.8%
mul-1-neg49.8%
associate-*l/55.4%
*-commutative55.4%
distribute-rgt-neg-in55.4%
*-lft-identity55.4%
associate-*l/55.4%
remove-double-neg55.4%
neg-mul-155.4%
associate-*r*55.4%
*-commutative55.4%
neg-mul-155.4%
*-commutative55.4%
distribute-neg-frac55.4%
metadata-eval55.4%
metadata-eval55.4%
associate-/r*55.4%
neg-mul-155.4%
associate-*r/55.4%
*-rgt-identity55.4%
distribute-frac-neg55.4%
remove-double-neg55.4%
Simplified55.4%
add-sqr-sqrt26.4%
sqrt-unprod22.1%
sqr-neg22.1%
sqrt-unprod2.5%
add-sqr-sqrt4.2%
clear-num4.2%
div-inv4.2%
frac-2neg4.2%
distribute-frac-neg4.2%
add-sqr-sqrt1.6%
sqrt-unprod26.1%
sqr-neg26.1%
sqrt-unprod28.9%
add-sqr-sqrt56.0%
Applied egg-rr56.0%
Final simplification60.5%
(FPCore (x y z t a)
:precision binary64
(if (or (<= y -5e+127)
(and (not (<= y -7.2e+115))
(or (<= y -1.85e-128) (not (<= y 3.2e-50)))))
(* y (/ (- t z) a))
x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5e+127) || (!(y <= -7.2e+115) && ((y <= -1.85e-128) || !(y <= 3.2e-50)))) {
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 <= (-5d+127)) .or. (.not. (y <= (-7.2d+115))) .and. (y <= (-1.85d-128)) .or. (.not. (y <= 3.2d-50))) 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 <= -5e+127) || (!(y <= -7.2e+115) && ((y <= -1.85e-128) || !(y <= 3.2e-50)))) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -5e+127) or (not (y <= -7.2e+115) and ((y <= -1.85e-128) or not (y <= 3.2e-50))): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5e+127) || (!(y <= -7.2e+115) && ((y <= -1.85e-128) || !(y <= 3.2e-50)))) 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 <= -5e+127) || (~((y <= -7.2e+115)) && ((y <= -1.85e-128) || ~((y <= 3.2e-50))))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5e+127], And[N[Not[LessEqual[y, -7.2e+115]], $MachinePrecision], Or[LessEqual[y, -1.85e-128], N[Not[LessEqual[y, 3.2e-50]], $MachinePrecision]]]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+127} \lor \neg \left(y \leq -7.2 \cdot 10^{+115}\right) \land \left(y \leq -1.85 \cdot 10^{-128} \lor \neg \left(y \leq 3.2 \cdot 10^{-50}\right)\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.0000000000000004e127 or -7.2000000000000001e115 < y < -1.85e-128 or 3.2e-50 < y Initial program 88.0%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in x around 0 70.3%
mul-1-neg70.3%
associate-*r/76.9%
distribute-rgt-neg-out76.9%
*-rgt-identity76.9%
*-rgt-identity76.9%
distribute-neg-frac76.9%
neg-sub076.9%
associate--r-76.9%
neg-sub076.9%
+-commutative76.9%
sub-neg76.9%
Simplified76.9%
if -5.0000000000000004e127 < y < -7.2000000000000001e115 or -1.85e-128 < y < 3.2e-50Initial program 98.8%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in x around inf 70.2%
Final simplification74.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.1e-39) (+ x (* t (/ y a))) (if (<= t 2.65e+57) (- x (/ y (/ a z))) (- x (/ y (/ (- a) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.1e-39) {
tmp = x + (t * (y / a));
} else if (t <= 2.65e+57) {
tmp = x - (y / (a / z));
} else {
tmp = x - (y / (-a / t));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-3.1d-39)) then
tmp = x + (t * (y / a))
else if (t <= 2.65d+57) then
tmp = x - (y / (a / z))
else
tmp = x - (y / (-a / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.1e-39) {
tmp = x + (t * (y / a));
} else if (t <= 2.65e+57) {
tmp = x - (y / (a / z));
} else {
tmp = x - (y / (-a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.1e-39: tmp = x + (t * (y / a)) elif t <= 2.65e+57: tmp = x - (y / (a / z)) else: tmp = x - (y / (-a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.1e-39) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (t <= 2.65e+57) tmp = Float64(x - Float64(y / Float64(a / z))); else tmp = Float64(x - Float64(y / Float64(Float64(-a) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.1e-39) tmp = x + (t * (y / a)); elseif (t <= 2.65e+57) tmp = x - (y / (a / z)); else tmp = x - (y / (-a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.1e-39], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.65e+57], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[((-a) / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{-39}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{+57}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{-a}{t}}\\
\end{array}
\end{array}
if t < -3.0999999999999997e-39Initial program 90.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around 0 74.8%
cancel-sign-sub-inv74.8%
metadata-eval74.8%
*-lft-identity74.8%
+-commutative74.8%
associate-*r/82.3%
Simplified82.3%
if -3.0999999999999997e-39 < t < 2.64999999999999993e57Initial program 91.9%
associate-/l*95.0%
Simplified95.0%
Taylor expanded in z around inf 89.6%
if 2.64999999999999993e57 < t Initial program 94.1%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in z around 0 92.0%
associate-*r/92.0%
neg-mul-192.0%
Simplified92.0%
Final simplification87.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -8.2e+25) (not (<= x 7e-56))) (+ x (* t (/ y a))) (* y (/ (- t z) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -8.2e+25) || !(x <= 7e-56)) {
tmp = x + (t * (y / a));
} else {
tmp = 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 ((x <= (-8.2d+25)) .or. (.not. (x <= 7d-56))) then
tmp = x + (t * (y / a))
else
tmp = 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 ((x <= -8.2e+25) || !(x <= 7e-56)) {
tmp = x + (t * (y / a));
} else {
tmp = y * ((t - z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -8.2e+25) or not (x <= 7e-56): tmp = x + (t * (y / a)) else: tmp = y * ((t - z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -8.2e+25) || !(x <= 7e-56)) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(y * Float64(Float64(t - z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -8.2e+25) || ~((x <= 7e-56))) tmp = x + (t * (y / a)); else tmp = y * ((t - z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -8.2e+25], N[Not[LessEqual[x, 7e-56]], $MachinePrecision]], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+25} \lor \neg \left(x \leq 7 \cdot 10^{-56}\right):\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\end{array}
\end{array}
if x < -8.19999999999999933e25 or 6.9999999999999996e-56 < x Initial program 91.9%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in z around 0 74.0%
cancel-sign-sub-inv74.0%
metadata-eval74.0%
*-lft-identity74.0%
+-commutative74.0%
associate-*r/78.9%
Simplified78.9%
if -8.19999999999999933e25 < x < 6.9999999999999996e-56Initial program 91.6%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in x around 0 78.5%
mul-1-neg78.5%
associate-*r/79.4%
distribute-rgt-neg-out79.4%
*-rgt-identity79.4%
*-rgt-identity79.4%
distribute-neg-frac79.4%
neg-sub079.4%
associate--r-79.4%
neg-sub079.4%
+-commutative79.4%
sub-neg79.4%
Simplified79.4%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -65000000.0) (not (<= z 1.2e+91))) (- x (/ y (/ a z))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -65000000.0) || !(z <= 1.2e+91)) {
tmp = x - (y / (a / z));
} 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 <= (-65000000.0d0)) .or. (.not. (z <= 1.2d+91))) then
tmp = x - (y / (a / z))
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 <= -65000000.0) || !(z <= 1.2e+91)) {
tmp = x - (y / (a / z));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -65000000.0) or not (z <= 1.2e+91): tmp = x - (y / (a / z)) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -65000000.0) || !(z <= 1.2e+91)) tmp = Float64(x - Float64(y / Float64(a / z))); 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 <= -65000000.0) || ~((z <= 1.2e+91))) tmp = x - (y / (a / z)); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -65000000.0], N[Not[LessEqual[z, 1.2e+91]], $MachinePrecision]], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -65000000 \lor \neg \left(z \leq 1.2 \cdot 10^{+91}\right):\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -6.5e7 or 1.19999999999999991e91 < z Initial program 88.1%
associate-/l*93.2%
Simplified93.2%
Taylor expanded in z around inf 88.9%
if -6.5e7 < z < 1.19999999999999991e91Initial program 95.1%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around 0 80.0%
cancel-sign-sub-inv80.0%
metadata-eval80.0%
*-lft-identity80.0%
+-commutative80.0%
associate-*r/86.3%
Simplified86.3%
Final simplification87.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -5e+127) (not (<= y 320000000.0))) (* t (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5e+127) || !(y <= 320000000.0)) {
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 ((y <= (-5d+127)) .or. (.not. (y <= 320000000.0d0))) 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 ((y <= -5e+127) || !(y <= 320000000.0)) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -5e+127) or not (y <= 320000000.0): tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5e+127) || !(y <= 320000000.0)) 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 ((y <= -5e+127) || ~((y <= 320000000.0))) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5e+127], N[Not[LessEqual[y, 320000000.0]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+127} \lor \neg \left(y \leq 320000000\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.0000000000000004e127 or 3.2e8 < y Initial program 83.9%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in t around inf 40.0%
associate-*r/47.8%
Simplified47.8%
if -5.0000000000000004e127 < y < 3.2e8Initial program 97.4%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in x around inf 56.4%
Final simplification52.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -2.9e+128) (not (<= y 2500000000.0))) (/ t (/ a y)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.9e+128) || !(y <= 2500000000.0)) {
tmp = t / (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 <= (-2.9d+128)) .or. (.not. (y <= 2500000000.0d0))) then
tmp = t / (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 <= -2.9e+128) || !(y <= 2500000000.0)) {
tmp = t / (a / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -2.9e+128) or not (y <= 2500000000.0): tmp = t / (a / y) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -2.9e+128) || !(y <= 2500000000.0)) tmp = Float64(t / Float64(a / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -2.9e+128) || ~((y <= 2500000000.0))) tmp = t / (a / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -2.9e+128], N[Not[LessEqual[y, 2500000000.0]], $MachinePrecision]], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+128} \lor \neg \left(y \leq 2500000000\right):\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.9e128 or 2.5e9 < y Initial program 83.9%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in t around inf 40.0%
associate-*r/47.8%
Simplified47.8%
clear-num47.8%
div-inv47.9%
Applied egg-rr47.9%
if -2.9e128 < y < 2.5e9Initial program 97.4%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in x around inf 56.4%
Final simplification52.9%
(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 91.8%
associate-*l/97.4%
Simplified97.4%
Final simplification97.4%
(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 91.8%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in x around inf 39.1%
Final simplification39.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 2024014
(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)))