
(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 (+ 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 93.8%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in y around 0 93.8%
*-commutative93.8%
associate-/l*97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (x y z t a)
:precision binary64
(if (<= x -1.15e+238)
x
(if (or (<= x -1.05e+108) (and (not (<= x -2e+61)) (<= x 2.3e+41)))
(* (/ y a) (- t z))
x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.15e+238) {
tmp = x;
} else if ((x <= -1.05e+108) || (!(x <= -2e+61) && (x <= 2.3e+41))) {
tmp = (y / a) * (t - 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 <= (-1.15d+238)) then
tmp = x
else if ((x <= (-1.05d+108)) .or. (.not. (x <= (-2d+61))) .and. (x <= 2.3d+41)) then
tmp = (y / a) * (t - 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 <= -1.15e+238) {
tmp = x;
} else if ((x <= -1.05e+108) || (!(x <= -2e+61) && (x <= 2.3e+41))) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.15e+238: tmp = x elif (x <= -1.05e+108) or (not (x <= -2e+61) and (x <= 2.3e+41)): tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.15e+238) tmp = x; elseif ((x <= -1.05e+108) || (!(x <= -2e+61) && (x <= 2.3e+41))) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.15e+238) tmp = x; elseif ((x <= -1.05e+108) || (~((x <= -2e+61)) && (x <= 2.3e+41))) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.15e+238], x, If[Or[LessEqual[x, -1.05e+108], And[N[Not[LessEqual[x, -2e+61]], $MachinePrecision], LessEqual[x, 2.3e+41]]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+238}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{+108} \lor \neg \left(x \leq -2 \cdot 10^{+61}\right) \land x \leq 2.3 \cdot 10^{+41}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.15000000000000001e238 or -1.05000000000000005e108 < x < -1.9999999999999999e61 or 2.2999999999999998e41 < x Initial program 92.7%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in x around inf 76.3%
if -1.15000000000000001e238 < x < -1.05000000000000005e108 or -1.9999999999999999e61 < x < 2.2999999999999998e41Initial program 94.3%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in y around 0 94.3%
*-commutative94.3%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in x around 0 73.9%
mul-1-neg73.9%
associate-*l/76.4%
distribute-rgt-out--70.2%
sub-neg70.2%
+-commutative70.2%
distribute-neg-in70.2%
remove-double-neg70.2%
sub-neg70.2%
distribute-rgt-out--76.4%
Simplified76.4%
Final simplification76.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y) (/ a z))))
(if (<= y -42000000.0)
t_1
(if (<= y 0.000125) x (if (<= y 2.55e+175) (/ t (/ a y)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y / (a / z);
double tmp;
if (y <= -42000000.0) {
tmp = t_1;
} else if (y <= 0.000125) {
tmp = x;
} else if (y <= 2.55e+175) {
tmp = t / (a / y);
} 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 = -y / (a / z)
if (y <= (-42000000.0d0)) then
tmp = t_1
else if (y <= 0.000125d0) then
tmp = x
else if (y <= 2.55d+175) then
tmp = t / (a / y)
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 = -y / (a / z);
double tmp;
if (y <= -42000000.0) {
tmp = t_1;
} else if (y <= 0.000125) {
tmp = x;
} else if (y <= 2.55e+175) {
tmp = t / (a / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y / (a / z) tmp = 0 if y <= -42000000.0: tmp = t_1 elif y <= 0.000125: tmp = x elif y <= 2.55e+175: tmp = t / (a / y) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) / Float64(a / z)) tmp = 0.0 if (y <= -42000000.0) tmp = t_1; elseif (y <= 0.000125) tmp = x; elseif (y <= 2.55e+175) tmp = Float64(t / Float64(a / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -y / (a / z); tmp = 0.0; if (y <= -42000000.0) tmp = t_1; elseif (y <= 0.000125) tmp = x; elseif (y <= 2.55e+175) tmp = t / (a / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) / N[(a / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -42000000.0], t$95$1, If[LessEqual[y, 0.000125], x, If[LessEqual[y, 2.55e+175], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-y}{\frac{a}{z}}\\
\mathbf{if}\;y \leq -42000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 0.000125:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{+175}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -4.2e7 or 2.55000000000000003e175 < y Initial program 83.8%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in z around inf 51.3%
mul-1-neg51.3%
associate-/l*61.2%
Simplified61.2%
if -4.2e7 < y < 1.25e-4Initial program 99.4%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in x around inf 56.5%
if 1.25e-4 < y < 2.55000000000000003e175Initial program 95.0%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in t around inf 51.8%
associate-/l*56.6%
Simplified56.6%
Final simplification58.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ y (- a)))))
(if (<= y -880.0)
t_1
(if (<= y 0.00155) x (if (<= y 6.2e+177) (/ t (/ a y)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / -a);
double tmp;
if (y <= -880.0) {
tmp = t_1;
} else if (y <= 0.00155) {
tmp = x;
} else if (y <= 6.2e+177) {
tmp = t / (a / y);
} 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 <= (-880.0d0)) then
tmp = t_1
else if (y <= 0.00155d0) then
tmp = x
else if (y <= 6.2d+177) then
tmp = t / (a / y)
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 <= -880.0) {
tmp = t_1;
} else if (y <= 0.00155) {
tmp = x;
} else if (y <= 6.2e+177) {
tmp = t / (a / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (y / -a) tmp = 0 if y <= -880.0: tmp = t_1 elif y <= 0.00155: tmp = x elif y <= 6.2e+177: tmp = t / (a / y) 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 <= -880.0) tmp = t_1; elseif (y <= 0.00155) tmp = x; elseif (y <= 6.2e+177) tmp = Float64(t / Float64(a / y)); 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 <= -880.0) tmp = t_1; elseif (y <= 0.00155) tmp = x; elseif (y <= 6.2e+177) tmp = t / (a / y); 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, -880.0], t$95$1, If[LessEqual[y, 0.00155], x, If[LessEqual[y, 6.2e+177], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{-a}\\
\mathbf{if}\;y \leq -880:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 0.00155:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+177}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -880 or 6.1999999999999998e177 < y Initial program 83.8%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in z around inf 51.3%
mul-1-neg51.3%
associate-*l/65.8%
*-commutative65.8%
distribute-rgt-neg-in65.8%
*-lft-identity65.8%
associate-*l/65.8%
remove-double-neg65.8%
neg-mul-165.8%
associate-*r*65.8%
*-commutative65.8%
neg-mul-165.8%
*-commutative65.8%
distribute-neg-frac65.8%
metadata-eval65.8%
metadata-eval65.8%
associate-/r*65.8%
neg-mul-165.8%
associate-*r/65.8%
*-rgt-identity65.8%
distribute-frac-neg65.8%
remove-double-neg65.8%
Simplified65.8%
if -880 < y < 0.00154999999999999995Initial program 99.4%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in x around inf 56.5%
if 0.00154999999999999995 < y < 6.1999999999999998e177Initial program 95.0%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in t around inf 51.8%
associate-/l*56.6%
Simplified56.6%
Final simplification59.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ z (/ (- a) y))))
(if (<= y -2950.0)
t_1
(if (<= y 0.00028) x (if (<= y 2.1e+175) (/ t (/ a y)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z / (-a / y);
double tmp;
if (y <= -2950.0) {
tmp = t_1;
} else if (y <= 0.00028) {
tmp = x;
} else if (y <= 2.1e+175) {
tmp = t / (a / y);
} 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 / (-a / y)
if (y <= (-2950.0d0)) then
tmp = t_1
else if (y <= 0.00028d0) then
tmp = x
else if (y <= 2.1d+175) then
tmp = t / (a / y)
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 / (-a / y);
double tmp;
if (y <= -2950.0) {
tmp = t_1;
} else if (y <= 0.00028) {
tmp = x;
} else if (y <= 2.1e+175) {
tmp = t / (a / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z / (-a / y) tmp = 0 if y <= -2950.0: tmp = t_1 elif y <= 0.00028: tmp = x elif y <= 2.1e+175: tmp = t / (a / y) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(z / Float64(Float64(-a) / y)) tmp = 0.0 if (y <= -2950.0) tmp = t_1; elseif (y <= 0.00028) tmp = x; elseif (y <= 2.1e+175) tmp = Float64(t / Float64(a / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z / (-a / y); tmp = 0.0; if (y <= -2950.0) tmp = t_1; elseif (y <= 0.00028) tmp = x; elseif (y <= 2.1e+175) tmp = t / (a / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z / N[((-a) / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2950.0], t$95$1, If[LessEqual[y, 0.00028], x, If[LessEqual[y, 2.1e+175], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{\frac{-a}{y}}\\
\mathbf{if}\;y \leq -2950:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 0.00028:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+175}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -2950 or 2.0999999999999999e175 < y Initial program 83.8%
sub-neg83.8%
distribute-rgt-in79.9%
Applied egg-rr79.9%
Taylor expanded in z around inf 51.3%
associate-*r/51.3%
*-commutative51.3%
neg-mul-151.3%
*-commutative51.3%
distribute-rgt-neg-in51.3%
associate-*l/65.8%
Simplified65.8%
add-sqr-sqrt30.7%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod4.2%
add-sqr-sqrt6.0%
associate-*l/5.0%
*-commutative5.0%
frac-2neg5.0%
*-commutative5.0%
distribute-rgt-neg-out5.0%
*-commutative5.0%
add-sqr-sqrt1.9%
sqrt-unprod27.8%
sqr-neg27.8%
sqrt-unprod30.6%
add-sqr-sqrt51.3%
Applied egg-rr51.3%
associate-/l*66.1%
Simplified66.1%
if -2950 < y < 2.7999999999999998e-4Initial program 99.4%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in x around inf 56.5%
if 2.7999999999999998e-4 < y < 2.0999999999999999e175Initial program 95.0%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in t around inf 51.8%
associate-/l*56.6%
Simplified56.6%
Final simplification59.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1e-8) (not (<= x 7.2e-15))) (+ x (* t (/ y a))) (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1e-8) || !(x <= 7.2e-15)) {
tmp = x + (t * (y / a));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x <= (-1d-8)) .or. (.not. (x <= 7.2d-15))) then
tmp = x + (t * (y / a))
else
tmp = (y / a) * (t - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1e-8) || !(x <= 7.2e-15)) {
tmp = x + (t * (y / a));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -1e-8) or not (x <= 7.2e-15): tmp = x + (t * (y / a)) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1e-8) || !(x <= 7.2e-15)) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(Float64(y / a) * Float64(t - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -1e-8) || ~((x <= 7.2e-15))) tmp = x + (t * (y / a)); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1e-8], N[Not[LessEqual[x, 7.2e-15]], $MachinePrecision]], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-8} \lor \neg \left(x \leq 7.2 \cdot 10^{-15}\right):\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if x < -1e-8 or 7.2000000000000002e-15 < x Initial program 92.3%
sub-neg92.3%
distribute-rgt-in90.7%
Applied egg-rr90.7%
Taylor expanded in z around 0 81.2%
cancel-sign-sub-inv81.2%
metadata-eval81.2%
associate-*r/83.5%
*-lft-identity83.5%
Simplified83.5%
if -1e-8 < x < 7.2000000000000002e-15Initial program 95.2%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in y around 0 95.2%
*-commutative95.2%
associate-/l*96.4%
Simplified96.4%
Taylor expanded in x around 0 79.8%
mul-1-neg79.8%
associate-*l/81.0%
distribute-rgt-out--76.4%
sub-neg76.4%
+-commutative76.4%
distribute-neg-in76.4%
remove-double-neg76.4%
sub-neg76.4%
distribute-rgt-out--81.0%
Simplified81.0%
Final simplification82.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.9e+52) (+ x (* t (/ y a))) (if (<= t 65200.0) (- x (* y (/ z a))) (+ x (* y (/ t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.9e+52) {
tmp = x + (t * (y / a));
} else if (t <= 65200.0) {
tmp = x - (y * (z / a));
} else {
tmp = x + (y * (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 (t <= (-3.9d+52)) then
tmp = x + (t * (y / a))
else if (t <= 65200.0d0) then
tmp = x - (y * (z / a))
else
tmp = x + (y * (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 (t <= -3.9e+52) {
tmp = x + (t * (y / a));
} else if (t <= 65200.0) {
tmp = x - (y * (z / a));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.9e+52: tmp = x + (t * (y / a)) elif t <= 65200.0: tmp = x - (y * (z / a)) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.9e+52) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (t <= 65200.0) tmp = Float64(x - Float64(y * Float64(z / a))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.9e+52) tmp = x + (t * (y / a)); elseif (t <= 65200.0) tmp = x - (y * (z / a)); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.9e+52], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 65200.0], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.9 \cdot 10^{+52}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 65200:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if t < -3.9e52Initial program 94.9%
sub-neg94.9%
distribute-rgt-in93.0%
Applied egg-rr93.0%
Taylor expanded in z around 0 87.3%
cancel-sign-sub-inv87.3%
metadata-eval87.3%
associate-*r/88.9%
*-lft-identity88.9%
Simplified88.9%
if -3.9e52 < t < 65200Initial program 94.8%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around inf 89.4%
*-commutative89.4%
associate-/l*94.6%
associate-/r/91.9%
Simplified91.9%
if 65200 < t Initial program 90.4%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in z around 0 83.6%
cancel-sign-sub-inv83.6%
metadata-eval83.6%
*-lft-identity83.6%
+-commutative83.6%
associate-/l*85.2%
associate-/r/86.8%
Simplified86.8%
Final simplification90.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -4.3e+51) (+ x (* t (/ y a))) (if (<= t 2.9e+77) (- x (/ z (/ a y))) (+ x (* y (/ t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.3e+51) {
tmp = x + (t * (y / a));
} else if (t <= 2.9e+77) {
tmp = x - (z / (a / y));
} else {
tmp = x + (y * (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 (t <= (-4.3d+51)) then
tmp = x + (t * (y / a))
else if (t <= 2.9d+77) then
tmp = x - (z / (a / y))
else
tmp = x + (y * (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 (t <= -4.3e+51) {
tmp = x + (t * (y / a));
} else if (t <= 2.9e+77) {
tmp = x - (z / (a / y));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.3e+51: tmp = x + (t * (y / a)) elif t <= 2.9e+77: tmp = x - (z / (a / y)) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.3e+51) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (t <= 2.9e+77) tmp = Float64(x - Float64(z / Float64(a / y))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.3e+51) tmp = x + (t * (y / a)); elseif (t <= 2.9e+77) tmp = x - (z / (a / y)); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.3e+51], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.9e+77], N[(x - N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{+51}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{+77}:\\
\;\;\;\;x - \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if t < -4.2999999999999997e51Initial program 94.9%
sub-neg94.9%
distribute-rgt-in93.0%
Applied egg-rr93.0%
Taylor expanded in z around 0 87.3%
cancel-sign-sub-inv87.3%
metadata-eval87.3%
associate-*r/88.9%
*-lft-identity88.9%
Simplified88.9%
if -4.2999999999999997e51 < t < 2.9000000000000002e77Initial program 94.9%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in z around inf 86.7%
*-commutative86.7%
associate-/l*92.9%
associate-/r/89.4%
Simplified89.4%
associate-/r/92.9%
Applied egg-rr92.9%
if 2.9000000000000002e77 < t Initial program 87.5%
associate-*l/94.9%
Simplified94.9%
Taylor expanded in z around 0 84.8%
cancel-sign-sub-inv84.8%
metadata-eval84.8%
*-lft-identity84.8%
+-commutative84.8%
associate-/l*87.4%
associate-/r/89.8%
Simplified89.8%
Final simplification91.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -6.5e-135) x (if (<= a 1e-55) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6.5e-135) {
tmp = x;
} else if (a <= 1e-55) {
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 <= (-6.5d-135)) then
tmp = x
else if (a <= 1d-55) 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 <= -6.5e-135) {
tmp = x;
} else if (a <= 1e-55) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -6.5e-135: tmp = x elif a <= 1e-55: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -6.5e-135) tmp = x; elseif (a <= 1e-55) 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 <= -6.5e-135) tmp = x; elseif (a <= 1e-55) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6.5e-135], x, If[LessEqual[a, 1e-55], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{-135}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 10^{-55}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -6.50000000000000056e-135 or 9.99999999999999995e-56 < a Initial program 90.4%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in x around inf 54.2%
if -6.50000000000000056e-135 < a < 9.99999999999999995e-56Initial program 99.3%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in y around 0 99.3%
*-commutative99.3%
associate-/l*97.1%
Simplified97.1%
Taylor expanded in t around inf 50.2%
associate-*r/55.4%
Simplified55.4%
Final simplification54.7%
(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 93.8%
associate-*l/97.2%
Simplified97.2%
Final simplification97.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.8%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in x around inf 39.5%
Final simplification39.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(- x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(- x (/ (* y (- z t)) a))
(- x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x - (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x - ((y * (z - t)) / a)
else
tmp = x - (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x - (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x - ((y * (z - t)) / a) else: tmp = x - (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x - Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x - Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x - Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x - (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x - ((y * (z - t)) / a); else tmp = x - (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x - N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x - \frac{1}{\frac{t_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t_1}\\
\end{array}
\end{array}
herbie shell --seed 2023308
(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)))