
(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 10 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 (fma (/ y a) (- t z) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), (t - z), x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), Float64(t - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, t - z, x\right)
\end{array}
Initial program 91.9%
sub-neg91.9%
distribute-frac-neg91.9%
distribute-lft-neg-out91.9%
+-commutative91.9%
distribute-lft-neg-out91.9%
distribute-rgt-neg-in91.9%
associate-*l/96.9%
fma-def96.9%
sub-neg96.9%
distribute-neg-in96.9%
remove-double-neg96.9%
+-commutative96.9%
sub-neg96.9%
Simplified96.9%
Final simplification96.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) t)))
(if (<= y -7.5e+40)
t_1
(if (<= y 1.15e-87)
x
(if (<= y 1.55e-39)
t_1
(if (<= y 1.12e+85) x (if (<= y 2.6e+218) t_1 (/ (- y) (/ a z)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * t;
double tmp;
if (y <= -7.5e+40) {
tmp = t_1;
} else if (y <= 1.15e-87) {
tmp = x;
} else if (y <= 1.55e-39) {
tmp = t_1;
} else if (y <= 1.12e+85) {
tmp = x;
} else if (y <= 2.6e+218) {
tmp = t_1;
} else {
tmp = -y / (a / 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) :: t_1
real(8) :: tmp
t_1 = (y / a) * t
if (y <= (-7.5d+40)) then
tmp = t_1
else if (y <= 1.15d-87) then
tmp = x
else if (y <= 1.55d-39) then
tmp = t_1
else if (y <= 1.12d+85) then
tmp = x
else if (y <= 2.6d+218) then
tmp = t_1
else
tmp = -y / (a / z)
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) * t;
double tmp;
if (y <= -7.5e+40) {
tmp = t_1;
} else if (y <= 1.15e-87) {
tmp = x;
} else if (y <= 1.55e-39) {
tmp = t_1;
} else if (y <= 1.12e+85) {
tmp = x;
} else if (y <= 2.6e+218) {
tmp = t_1;
} else {
tmp = -y / (a / z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * t tmp = 0 if y <= -7.5e+40: tmp = t_1 elif y <= 1.15e-87: tmp = x elif y <= 1.55e-39: tmp = t_1 elif y <= 1.12e+85: tmp = x elif y <= 2.6e+218: tmp = t_1 else: tmp = -y / (a / z) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * t) tmp = 0.0 if (y <= -7.5e+40) tmp = t_1; elseif (y <= 1.15e-87) tmp = x; elseif (y <= 1.55e-39) tmp = t_1; elseif (y <= 1.12e+85) tmp = x; elseif (y <= 2.6e+218) tmp = t_1; else tmp = Float64(Float64(-y) / Float64(a / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * t; tmp = 0.0; if (y <= -7.5e+40) tmp = t_1; elseif (y <= 1.15e-87) tmp = x; elseif (y <= 1.55e-39) tmp = t_1; elseif (y <= 1.12e+85) tmp = x; elseif (y <= 2.6e+218) tmp = t_1; else tmp = -y / (a / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[y, -7.5e+40], t$95$1, If[LessEqual[y, 1.15e-87], x, If[LessEqual[y, 1.55e-39], t$95$1, If[LessEqual[y, 1.12e+85], x, If[LessEqual[y, 2.6e+218], t$95$1, N[((-y) / N[(a / z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot t\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{+40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-87}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+85}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+218}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-y}{\frac{a}{z}}\\
\end{array}
\end{array}
if y < -7.4999999999999996e40 or 1.1500000000000001e-87 < y < 1.54999999999999985e-39 or 1.11999999999999993e85 < y < 2.60000000000000002e218Initial program 84.7%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in t around inf 45.6%
associate-*r/53.2%
Simplified53.2%
if -7.4999999999999996e40 < y < 1.1500000000000001e-87 or 1.54999999999999985e-39 < y < 1.11999999999999993e85Initial program 98.1%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in x around inf 59.8%
if 2.60000000000000002e218 < y Initial program 86.8%
associate-*l/95.7%
Simplified95.7%
*-commutative95.7%
clear-num95.7%
un-div-inv95.7%
Applied egg-rr95.7%
Taylor expanded in z around inf 64.6%
mul-1-neg64.6%
associate-/l*68.8%
Simplified68.8%
Final simplification58.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) t)))
(if (<= y -1.85e+38)
t_1
(if (<= y 1.2e-87)
x
(if (<= y 8.2e-40)
t_1
(if (<= y 5.5e+78) x (if (<= y 3.3e+218) t_1 (* (/ z a) (- y)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * t;
double tmp;
if (y <= -1.85e+38) {
tmp = t_1;
} else if (y <= 1.2e-87) {
tmp = x;
} else if (y <= 8.2e-40) {
tmp = t_1;
} else if (y <= 5.5e+78) {
tmp = x;
} else if (y <= 3.3e+218) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (y / a) * t
if (y <= (-1.85d+38)) then
tmp = t_1
else if (y <= 1.2d-87) then
tmp = x
else if (y <= 8.2d-40) then
tmp = t_1
else if (y <= 5.5d+78) then
tmp = x
else if (y <= 3.3d+218) then
tmp = t_1
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 t_1 = (y / a) * t;
double tmp;
if (y <= -1.85e+38) {
tmp = t_1;
} else if (y <= 1.2e-87) {
tmp = x;
} else if (y <= 8.2e-40) {
tmp = t_1;
} else if (y <= 5.5e+78) {
tmp = x;
} else if (y <= 3.3e+218) {
tmp = t_1;
} else {
tmp = (z / a) * -y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * t tmp = 0 if y <= -1.85e+38: tmp = t_1 elif y <= 1.2e-87: tmp = x elif y <= 8.2e-40: tmp = t_1 elif y <= 5.5e+78: tmp = x elif y <= 3.3e+218: tmp = t_1 else: tmp = (z / a) * -y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * t) tmp = 0.0 if (y <= -1.85e+38) tmp = t_1; elseif (y <= 1.2e-87) tmp = x; elseif (y <= 8.2e-40) tmp = t_1; elseif (y <= 5.5e+78) tmp = x; elseif (y <= 3.3e+218) tmp = t_1; else tmp = Float64(Float64(z / a) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * t; tmp = 0.0; if (y <= -1.85e+38) tmp = t_1; elseif (y <= 1.2e-87) tmp = x; elseif (y <= 8.2e-40) tmp = t_1; elseif (y <= 5.5e+78) tmp = x; elseif (y <= 3.3e+218) tmp = t_1; else tmp = (z / a) * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[y, -1.85e+38], t$95$1, If[LessEqual[y, 1.2e-87], x, If[LessEqual[y, 8.2e-40], t$95$1, If[LessEqual[y, 5.5e+78], x, If[LessEqual[y, 3.3e+218], t$95$1, N[(N[(z / a), $MachinePrecision] * (-y)), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot t\\
\mathbf{if}\;y \leq -1.85 \cdot 10^{+38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-87}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+78}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+218}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a} \cdot \left(-y\right)\\
\end{array}
\end{array}
if y < -1.8500000000000001e38 or 1.2e-87 < y < 8.19999999999999926e-40 or 5.4999999999999997e78 < y < 3.29999999999999998e218Initial program 84.7%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in t around inf 45.6%
associate-*r/53.2%
Simplified53.2%
if -1.8500000000000001e38 < y < 1.2e-87 or 8.19999999999999926e-40 < y < 5.4999999999999997e78Initial program 98.1%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in x around inf 59.8%
if 3.29999999999999998e218 < y Initial program 86.8%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in x around 0 82.7%
mul-1-neg82.7%
associate-*r/91.4%
distribute-rgt-neg-out91.4%
distribute-neg-frac91.4%
neg-sub091.4%
associate--r-91.4%
neg-sub091.4%
+-commutative91.4%
sub-neg91.4%
Simplified91.4%
Taylor expanded in t around 0 69.0%
neg-mul-169.0%
distribute-neg-frac69.0%
Simplified69.0%
Final simplification58.0%
(FPCore (x y z t a)
:precision binary64
(if (<= t -6.8e+136)
(/ y (/ a t))
(if (<= t 2.1e-246)
x
(if (<= t 2.4e-165)
(/ (- y) (/ a z))
(if (<= t 1.45e-127)
x
(if (<= t 1.7e-12) (* (/ y a) (- z)) (* (/ y a) t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.8e+136) {
tmp = y / (a / t);
} else if (t <= 2.1e-246) {
tmp = x;
} else if (t <= 2.4e-165) {
tmp = -y / (a / z);
} else if (t <= 1.45e-127) {
tmp = x;
} else if (t <= 1.7e-12) {
tmp = (y / a) * -z;
} else {
tmp = (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 <= (-6.8d+136)) then
tmp = y / (a / t)
else if (t <= 2.1d-246) then
tmp = x
else if (t <= 2.4d-165) then
tmp = -y / (a / z)
else if (t <= 1.45d-127) then
tmp = x
else if (t <= 1.7d-12) then
tmp = (y / a) * -z
else
tmp = (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 <= -6.8e+136) {
tmp = y / (a / t);
} else if (t <= 2.1e-246) {
tmp = x;
} else if (t <= 2.4e-165) {
tmp = -y / (a / z);
} else if (t <= 1.45e-127) {
tmp = x;
} else if (t <= 1.7e-12) {
tmp = (y / a) * -z;
} else {
tmp = (y / a) * t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.8e+136: tmp = y / (a / t) elif t <= 2.1e-246: tmp = x elif t <= 2.4e-165: tmp = -y / (a / z) elif t <= 1.45e-127: tmp = x elif t <= 1.7e-12: tmp = (y / a) * -z else: tmp = (y / a) * t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.8e+136) tmp = Float64(y / Float64(a / t)); elseif (t <= 2.1e-246) tmp = x; elseif (t <= 2.4e-165) tmp = Float64(Float64(-y) / Float64(a / z)); elseif (t <= 1.45e-127) tmp = x; elseif (t <= 1.7e-12) tmp = Float64(Float64(y / a) * Float64(-z)); else tmp = Float64(Float64(y / a) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6.8e+136) tmp = y / (a / t); elseif (t <= 2.1e-246) tmp = x; elseif (t <= 2.4e-165) tmp = -y / (a / z); elseif (t <= 1.45e-127) tmp = x; elseif (t <= 1.7e-12) tmp = (y / a) * -z; else tmp = (y / a) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.8e+136], N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e-246], x, If[LessEqual[t, 2.4e-165], N[((-y) / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.45e-127], x, If[LessEqual[t, 1.7e-12], N[(N[(y / a), $MachinePrecision] * (-z)), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{+136}:\\
\;\;\;\;\frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-246}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{-165}:\\
\;\;\;\;\frac{-y}{\frac{a}{z}}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{-127}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-12}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\end{array}
\end{array}
if t < -6.79999999999999993e136Initial program 84.2%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in t around inf 63.3%
associate-*r/72.0%
Simplified72.0%
associate-*r/63.3%
*-commutative63.3%
associate-/l*74.9%
Applied egg-rr74.9%
if -6.79999999999999993e136 < t < 2.09999999999999995e-246 or 2.4000000000000002e-165 < t < 1.45e-127Initial program 97.4%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in x around inf 52.2%
if 2.09999999999999995e-246 < t < 2.4000000000000002e-165Initial program 87.4%
associate-*l/93.5%
Simplified93.5%
*-commutative93.5%
clear-num93.5%
un-div-inv93.6%
Applied egg-rr93.6%
Taylor expanded in z around inf 54.8%
mul-1-neg54.8%
associate-/l*67.4%
Simplified67.4%
if 1.45e-127 < t < 1.7e-12Initial program 89.7%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 50.3%
mul-1-neg50.3%
associate-*l/61.7%
distribute-rgt-neg-in61.7%
Simplified61.7%
if 1.7e-12 < t Initial program 87.8%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in t around inf 54.4%
associate-*r/59.6%
Simplified59.6%
Final simplification58.5%
(FPCore (x y z t a)
:precision binary64
(if (or (<= y -1.9e-40)
(and (not (<= y 4.55e-91)) (or (<= y 1.06e-37) (not (<= y 20.5)))))
(* y (/ (- t z) a))
x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.9e-40) || (!(y <= 4.55e-91) && ((y <= 1.06e-37) || !(y <= 20.5)))) {
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 <= (-1.9d-40)) .or. (.not. (y <= 4.55d-91)) .and. (y <= 1.06d-37) .or. (.not. (y <= 20.5d0))) 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 <= -1.9e-40) || (!(y <= 4.55e-91) && ((y <= 1.06e-37) || !(y <= 20.5)))) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.9e-40) or (not (y <= 4.55e-91) and ((y <= 1.06e-37) or not (y <= 20.5))): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.9e-40) || (!(y <= 4.55e-91) && ((y <= 1.06e-37) || !(y <= 20.5)))) 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 <= -1.9e-40) || (~((y <= 4.55e-91)) && ((y <= 1.06e-37) || ~((y <= 20.5))))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.9e-40], And[N[Not[LessEqual[y, 4.55e-91]], $MachinePrecision], Or[LessEqual[y, 1.06e-37], N[Not[LessEqual[y, 20.5]], $MachinePrecision]]]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-40} \lor \neg \left(y \leq 4.55 \cdot 10^{-91}\right) \land \left(y \leq 1.06 \cdot 10^{-37} \lor \neg \left(y \leq 20.5\right)\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.8999999999999999e-40 or 4.5499999999999998e-91 < y < 1.06000000000000003e-37 or 20.5 < y Initial program 86.9%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in x around 0 69.2%
mul-1-neg69.2%
associate-*r/77.8%
distribute-rgt-neg-out77.8%
distribute-neg-frac77.8%
neg-sub077.8%
associate--r-77.8%
neg-sub077.8%
+-commutative77.8%
sub-neg77.8%
Simplified77.8%
if -1.8999999999999999e-40 < y < 4.5499999999999998e-91 or 1.06000000000000003e-37 < y < 20.5Initial program 99.4%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in x around inf 65.5%
Final simplification72.9%
(FPCore (x y z t a)
:precision binary64
(if (or (<= y -2.75e+38)
(and (not (<= y 1.2e-87)) (or (<= y 8e-40) (not (<= y 1.15e+73)))))
(* (/ y a) t)
x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.75e+38) || (!(y <= 1.2e-87) && ((y <= 8e-40) || !(y <= 1.15e+73)))) {
tmp = (y / a) * t;
} 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.75d+38)) .or. (.not. (y <= 1.2d-87)) .and. (y <= 8d-40) .or. (.not. (y <= 1.15d+73))) then
tmp = (y / a) * t
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.75e+38) || (!(y <= 1.2e-87) && ((y <= 8e-40) || !(y <= 1.15e+73)))) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -2.75e+38) or (not (y <= 1.2e-87) and ((y <= 8e-40) or not (y <= 1.15e+73))): tmp = (y / a) * t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -2.75e+38) || (!(y <= 1.2e-87) && ((y <= 8e-40) || !(y <= 1.15e+73)))) tmp = Float64(Float64(y / a) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -2.75e+38) || (~((y <= 1.2e-87)) && ((y <= 8e-40) || ~((y <= 1.15e+73))))) tmp = (y / a) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -2.75e+38], And[N[Not[LessEqual[y, 1.2e-87]], $MachinePrecision], Or[LessEqual[y, 8e-40], N[Not[LessEqual[y, 1.15e+73]], $MachinePrecision]]]], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{+38} \lor \neg \left(y \leq 1.2 \cdot 10^{-87}\right) \land \left(y \leq 8 \cdot 10^{-40} \lor \neg \left(y \leq 1.15 \cdot 10^{+73}\right)\right):\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.7500000000000002e38 or 1.2e-87 < y < 7.9999999999999994e-40 or 1.15e73 < y Initial program 85.1%
associate-*l/96.8%
Simplified96.8%
Taylor expanded in t around inf 44.3%
associate-*r/52.1%
Simplified52.1%
if -2.7500000000000002e38 < y < 1.2e-87 or 7.9999999999999994e-40 < y < 1.15e73Initial program 98.1%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in x around inf 59.8%
Final simplification56.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -4.5e+75) (not (<= y 14500.0))) (* y (/ (- t z) a)) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -4.5e+75) || !(y <= 14500.0)) {
tmp = y * ((t - 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 ((y <= (-4.5d+75)) .or. (.not. (y <= 14500.0d0))) then
tmp = y * ((t - 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 ((y <= -4.5e+75) || !(y <= 14500.0)) {
tmp = y * ((t - z) / a);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -4.5e+75) or not (y <= 14500.0): tmp = y * ((t - z) / a) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -4.5e+75) || !(y <= 14500.0)) tmp = Float64(y * Float64(Float64(t - z) / a)); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -4.5e+75) || ~((y <= 14500.0))) tmp = y * ((t - z) / a); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4.5e+75], N[Not[LessEqual[y, 14500.0]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+75} \lor \neg \left(y \leq 14500\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if y < -4.5000000000000004e75 or 14500 < y Initial program 83.0%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in x around 0 69.5%
mul-1-neg69.5%
associate-*r/81.3%
distribute-rgt-neg-out81.3%
distribute-neg-frac81.3%
neg-sub081.3%
associate--r-81.3%
neg-sub081.3%
+-commutative81.3%
sub-neg81.3%
Simplified81.3%
if -4.5000000000000004e75 < y < 14500Initial program 98.8%
sub-neg98.8%
distribute-frac-neg98.8%
distribute-lft-neg-out98.8%
+-commutative98.8%
distribute-lft-neg-out98.8%
distribute-rgt-neg-in98.8%
associate-*l/97.3%
fma-def97.3%
sub-neg97.3%
distribute-neg-in97.3%
remove-double-neg97.3%
+-commutative97.3%
sub-neg97.3%
Simplified97.3%
Taylor expanded in z around 0 77.4%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.1e+118) (not (<= t 2.35e-12))) (+ x (* (/ y a) t)) (- x (* (/ y a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.1e+118) || !(t <= 2.35e-12)) {
tmp = x + ((y / a) * t);
} else {
tmp = x - ((y / a) * 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 ((t <= (-1.1d+118)) .or. (.not. (t <= 2.35d-12))) then
tmp = x + ((y / a) * t)
else
tmp = x - ((y / a) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.1e+118) || !(t <= 2.35e-12)) {
tmp = x + ((y / a) * t);
} else {
tmp = x - ((y / a) * z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.1e+118) or not (t <= 2.35e-12): tmp = x + ((y / a) * t) else: tmp = x - ((y / a) * z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.1e+118) || !(t <= 2.35e-12)) tmp = Float64(x + Float64(Float64(y / a) * t)); else tmp = Float64(x - Float64(Float64(y / a) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.1e+118) || ~((t <= 2.35e-12))) tmp = x + ((y / a) * t); else tmp = x - ((y / a) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.1e+118], N[Not[LessEqual[t, 2.35e-12]], $MachinePrecision]], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+118} \lor \neg \left(t \leq 2.35 \cdot 10^{-12}\right):\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{a} \cdot z\\
\end{array}
\end{array}
if t < -1.09999999999999993e118 or 2.34999999999999988e-12 < t Initial program 86.6%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in z around 0 81.7%
sub-neg81.7%
mul-1-neg81.7%
remove-double-neg81.7%
+-commutative81.7%
associate-*r/89.4%
Simplified89.4%
if -1.09999999999999993e118 < t < 2.34999999999999988e-12Initial program 95.3%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in z around inf 86.0%
associate-*l/89.6%
*-commutative89.6%
Simplified89.6%
Final simplification89.5%
(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.9%
associate-*l/96.9%
Simplified96.9%
Final simplification96.9%
(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.9%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in x around inf 38.5%
Final simplification38.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 2024019
(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)))