
(FPCore (x y z t) :precision binary64 (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))
double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / 8.0d0) * x) - ((y * z) / 2.0d0)) + t
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
def code(x, y, z, t): return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / 8.0) * x) - Float64(Float64(y * z) / 2.0)) + t) end
function tmp = code(x, y, z, t) tmp = (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / 8.0), $MachinePrecision] * x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))
double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / 8.0d0) * x) - ((y * z) / 2.0d0)) + t
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
def code(x, y, z, t): return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / 8.0) * x) - Float64(Float64(y * z) / 2.0)) + t) end
function tmp = code(x, y, z, t) tmp = (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / 8.0), $MachinePrecision] * x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (+ (fma y (* -0.5 z) (* 0.125 x)) t))
double code(double x, double y, double z, double t) {
return fma(y, (-0.5 * z), (0.125 * x)) + t;
}
function code(x, y, z, t) return Float64(fma(y, Float64(-0.5 * z), Float64(0.125 * x)) + t) end
code[x_, y_, z_, t_] := N[(N[(y * N[(-0.5 * z), $MachinePrecision] + N[(0.125 * x), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, -0.5 \cdot z, 0.125 \cdot x\right) + t
\end{array}
Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* -0.5 (* y z))))
(if (<= (* y z) -5.4e-10)
t_1
(if (<= (* y z) -1.2e-308)
t
(if (<= (* y z) 1.2e-245)
(* 0.125 x)
(if (<= (* y z) 5.4e-58)
t
(if (<= (* y z) 1900000000.0) (* 0.125 x) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = -0.5 * (y * z);
double tmp;
if ((y * z) <= -5.4e-10) {
tmp = t_1;
} else if ((y * z) <= -1.2e-308) {
tmp = t;
} else if ((y * z) <= 1.2e-245) {
tmp = 0.125 * x;
} else if ((y * z) <= 5.4e-58) {
tmp = t;
} else if ((y * z) <= 1900000000.0) {
tmp = 0.125 * x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (-0.5d0) * (y * z)
if ((y * z) <= (-5.4d-10)) then
tmp = t_1
else if ((y * z) <= (-1.2d-308)) then
tmp = t
else if ((y * z) <= 1.2d-245) then
tmp = 0.125d0 * x
else if ((y * z) <= 5.4d-58) then
tmp = t
else if ((y * z) <= 1900000000.0d0) then
tmp = 0.125d0 * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -0.5 * (y * z);
double tmp;
if ((y * z) <= -5.4e-10) {
tmp = t_1;
} else if ((y * z) <= -1.2e-308) {
tmp = t;
} else if ((y * z) <= 1.2e-245) {
tmp = 0.125 * x;
} else if ((y * z) <= 5.4e-58) {
tmp = t;
} else if ((y * z) <= 1900000000.0) {
tmp = 0.125 * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -0.5 * (y * z) tmp = 0 if (y * z) <= -5.4e-10: tmp = t_1 elif (y * z) <= -1.2e-308: tmp = t elif (y * z) <= 1.2e-245: tmp = 0.125 * x elif (y * z) <= 5.4e-58: tmp = t elif (y * z) <= 1900000000.0: tmp = 0.125 * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(-0.5 * Float64(y * z)) tmp = 0.0 if (Float64(y * z) <= -5.4e-10) tmp = t_1; elseif (Float64(y * z) <= -1.2e-308) tmp = t; elseif (Float64(y * z) <= 1.2e-245) tmp = Float64(0.125 * x); elseif (Float64(y * z) <= 5.4e-58) tmp = t; elseif (Float64(y * z) <= 1900000000.0) tmp = Float64(0.125 * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -0.5 * (y * z); tmp = 0.0; if ((y * z) <= -5.4e-10) tmp = t_1; elseif ((y * z) <= -1.2e-308) tmp = t; elseif ((y * z) <= 1.2e-245) tmp = 0.125 * x; elseif ((y * z) <= 5.4e-58) tmp = t; elseif ((y * z) <= 1900000000.0) tmp = 0.125 * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * z), $MachinePrecision], -5.4e-10], t$95$1, If[LessEqual[N[(y * z), $MachinePrecision], -1.2e-308], t, If[LessEqual[N[(y * z), $MachinePrecision], 1.2e-245], N[(0.125 * x), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 5.4e-58], t, If[LessEqual[N[(y * z), $MachinePrecision], 1900000000.0], N[(0.125 * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -0.5 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;y \cdot z \leq -5.4 \cdot 10^{-10}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \cdot z \leq -1.2 \cdot 10^{-308}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \cdot z \leq 1.2 \cdot 10^{-245}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;y \cdot z \leq 5.4 \cdot 10^{-58}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \cdot z \leq 1900000000:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 y z) < -5.4e-10 or 1.9e9 < (*.f64 y z) Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 69.5%
if -5.4e-10 < (*.f64 y z) < -1.1999999999999998e-308 or 1.2e-245 < (*.f64 y z) < 5.3999999999999998e-58Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around inf 62.3%
if -1.1999999999999998e-308 < (*.f64 y z) < 1.2e-245 or 5.3999999999999998e-58 < (*.f64 y z) < 1.9e9Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 61.4%
Final simplification65.8%
(FPCore (x y z t) :precision binary64 (if (<= (* y z) -5e-10) (- t (* 0.5 (* y z))) (if (<= (* y z) 5e-16) (+ (* 0.125 x) t) (- (* 0.125 x) (* y (* z 0.5))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y * z) <= -5e-10) {
tmp = t - (0.5 * (y * z));
} else if ((y * z) <= 5e-16) {
tmp = (0.125 * x) + t;
} else {
tmp = (0.125 * x) - (y * (z * 0.5));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y * z) <= (-5d-10)) then
tmp = t - (0.5d0 * (y * z))
else if ((y * z) <= 5d-16) then
tmp = (0.125d0 * x) + t
else
tmp = (0.125d0 * x) - (y * (z * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y * z) <= -5e-10) {
tmp = t - (0.5 * (y * z));
} else if ((y * z) <= 5e-16) {
tmp = (0.125 * x) + t;
} else {
tmp = (0.125 * x) - (y * (z * 0.5));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y * z) <= -5e-10: tmp = t - (0.5 * (y * z)) elif (y * z) <= 5e-16: tmp = (0.125 * x) + t else: tmp = (0.125 * x) - (y * (z * 0.5)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y * z) <= -5e-10) tmp = Float64(t - Float64(0.5 * Float64(y * z))); elseif (Float64(y * z) <= 5e-16) tmp = Float64(Float64(0.125 * x) + t); else tmp = Float64(Float64(0.125 * x) - Float64(y * Float64(z * 0.5))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y * z) <= -5e-10) tmp = t - (0.5 * (y * z)); elseif ((y * z) <= 5e-16) tmp = (0.125 * x) + t; else tmp = (0.125 * x) - (y * (z * 0.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y * z), $MachinePrecision], -5e-10], N[(t - N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 5e-16], N[(N[(0.125 * x), $MachinePrecision] + t), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] - N[(y * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -5 \cdot 10^{-10}:\\
\;\;\;\;t - 0.5 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{-16}:\\
\;\;\;\;0.125 \cdot x + t\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x - y \cdot \left(z \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 y z) < -5.00000000000000031e-10Initial program 100.0%
associate-+l-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 89.9%
if -5.00000000000000031e-10 < (*.f64 y z) < 5.0000000000000004e-16Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 96.3%
if 5.0000000000000004e-16 < (*.f64 y z) Initial program 100.0%
associate-+l-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 85.4%
*-commutative85.4%
associate-*r*85.4%
Simplified85.4%
Final simplification91.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (* y z) -2.4e-10) (not (<= (* y z) 5800000000.0))) (- t (* 0.5 (* y z))) (+ (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((y * z) <= -2.4e-10) || !((y * z) <= 5800000000.0)) {
tmp = t - (0.5 * (y * z));
} else {
tmp = (0.125 * x) + t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((y * z) <= (-2.4d-10)) .or. (.not. ((y * z) <= 5800000000.0d0))) then
tmp = t - (0.5d0 * (y * z))
else
tmp = (0.125d0 * x) + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((y * z) <= -2.4e-10) || !((y * z) <= 5800000000.0)) {
tmp = t - (0.5 * (y * z));
} else {
tmp = (0.125 * x) + t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y * z) <= -2.4e-10) or not ((y * z) <= 5800000000.0): tmp = t - (0.5 * (y * z)) else: tmp = (0.125 * x) + t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y * z) <= -2.4e-10) || !(Float64(y * z) <= 5800000000.0)) tmp = Float64(t - Float64(0.5 * Float64(y * z))); else tmp = Float64(Float64(0.125 * x) + t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y * z) <= -2.4e-10) || ~(((y * z) <= 5800000000.0))) tmp = t - (0.5 * (y * z)); else tmp = (0.125 * x) + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], -2.4e-10], N[Not[LessEqual[N[(y * z), $MachinePrecision], 5800000000.0]], $MachinePrecision]], N[(t - N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -2.4 \cdot 10^{-10} \lor \neg \left(y \cdot z \leq 5800000000\right):\\
\;\;\;\;t - 0.5 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x + t\\
\end{array}
\end{array}
if (*.f64 y z) < -2.4e-10 or 5.8e9 < (*.f64 y z) Initial program 100.0%
associate-+l-100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 85.6%
if -2.4e-10 < (*.f64 y z) < 5.8e9Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 96.4%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (* y z) -3.9e+26) (not (<= (* y z) 3e+178))) (* -0.5 (* y z)) (+ (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((y * z) <= -3.9e+26) || !((y * z) <= 3e+178)) {
tmp = -0.5 * (y * z);
} else {
tmp = (0.125 * x) + t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((y * z) <= (-3.9d+26)) .or. (.not. ((y * z) <= 3d+178))) then
tmp = (-0.5d0) * (y * z)
else
tmp = (0.125d0 * x) + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((y * z) <= -3.9e+26) || !((y * z) <= 3e+178)) {
tmp = -0.5 * (y * z);
} else {
tmp = (0.125 * x) + t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y * z) <= -3.9e+26) or not ((y * z) <= 3e+178): tmp = -0.5 * (y * z) else: tmp = (0.125 * x) + t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y * z) <= -3.9e+26) || !(Float64(y * z) <= 3e+178)) tmp = Float64(-0.5 * Float64(y * z)); else tmp = Float64(Float64(0.125 * x) + t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y * z) <= -3.9e+26) || ~(((y * z) <= 3e+178))) tmp = -0.5 * (y * z); else tmp = (0.125 * x) + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], -3.9e+26], N[Not[LessEqual[N[(y * z), $MachinePrecision], 3e+178]], $MachinePrecision]], N[(-0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -3.9 \cdot 10^{+26} \lor \neg \left(y \cdot z \leq 3 \cdot 10^{+178}\right):\\
\;\;\;\;-0.5 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x + t\\
\end{array}
\end{array}
if (*.f64 y z) < -3.9e26 or 3.00000000000000016e178 < (*.f64 y z) Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 80.7%
if -3.9e26 < (*.f64 y z) < 3.00000000000000016e178Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 85.9%
Final simplification84.1%
(FPCore (x y z t) :precision binary64 (+ (* 0.125 x) (- t (/ (* y z) 2.0))))
double code(double x, double y, double z, double t) {
return (0.125 * x) + (t - ((y * z) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (0.125d0 * x) + (t - ((y * z) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (0.125 * x) + (t - ((y * z) / 2.0));
}
def code(x, y, z, t): return (0.125 * x) + (t - ((y * z) / 2.0))
function code(x, y, z, t) return Float64(Float64(0.125 * x) + Float64(t - Float64(Float64(y * z) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (0.125 * x) + (t - ((y * z) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(0.125 * x), $MachinePrecision] + N[(t - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.125 \cdot x + \left(t - \frac{y \cdot z}{2}\right)
\end{array}
Initial program 100.0%
associate-+l-100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (- (+ (* 0.125 x) t) (* y (* z 0.5))))
double code(double x, double y, double z, double t) {
return ((0.125 * x) + t) - (y * (z * 0.5));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((0.125d0 * x) + t) - (y * (z * 0.5d0))
end function
public static double code(double x, double y, double z, double t) {
return ((0.125 * x) + t) - (y * (z * 0.5));
}
def code(x, y, z, t): return ((0.125 * x) + t) - (y * (z * 0.5))
function code(x, y, z, t) return Float64(Float64(Float64(0.125 * x) + t) - Float64(y * Float64(z * 0.5))) end
function tmp = code(x, y, z, t) tmp = ((0.125 * x) + t) - (y * (z * 0.5)); end
code[x_, y_, z_, t_] := N[(N[(N[(0.125 * x), $MachinePrecision] + t), $MachinePrecision] - N[(y * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.125 \cdot x + t\right) - y \cdot \left(z \cdot 0.5\right)
\end{array}
Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
+-commutative99.9%
fma-udef99.9%
associate-/l*100.0%
div-inv100.0%
cancel-sign-sub100.0%
div-inv100.0%
metadata-eval100.0%
frac-2neg100.0%
associate-+r-100.0%
div-inv100.0%
associate-*l*100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (<= t -7e+36) t (if (<= t 9.6e+33) (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e+36) {
tmp = t;
} else if (t <= 9.6e+33) {
tmp = 0.125 * x;
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-7d+36)) then
tmp = t
else if (t <= 9.6d+33) then
tmp = 0.125d0 * x
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e+36) {
tmp = t;
} else if (t <= 9.6e+33) {
tmp = 0.125 * x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7e+36: tmp = t elif t <= 9.6e+33: tmp = 0.125 * x else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7e+36) tmp = t; elseif (t <= 9.6e+33) tmp = Float64(0.125 * x); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7e+36) tmp = t; elseif (t <= 9.6e+33) tmp = 0.125 * x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7e+36], t, If[LessEqual[t, 9.6e+33], N[(0.125 * x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+36}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq 9.6 \cdot 10^{+33}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if t < -6.9999999999999996e36 or 9.5999999999999999e33 < t Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 67.2%
if -6.9999999999999996e36 < t < 9.5999999999999999e33Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 40.4%
Final simplification52.5%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-neg100.0%
metadata-eval100.0%
*-commutative100.0%
neg-mul-1100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 35.5%
Final simplification35.5%
(FPCore (x y z t) :precision binary64 (- (+ (/ x 8.0) t) (* (/ z 2.0) y)))
double code(double x, double y, double z, double t) {
return ((x / 8.0) + t) - ((z / 2.0) * y);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x / 8.0d0) + t) - ((z / 2.0d0) * y)
end function
public static double code(double x, double y, double z, double t) {
return ((x / 8.0) + t) - ((z / 2.0) * y);
}
def code(x, y, z, t): return ((x / 8.0) + t) - ((z / 2.0) * y)
function code(x, y, z, t) return Float64(Float64(Float64(x / 8.0) + t) - Float64(Float64(z / 2.0) * y)) end
function tmp = code(x, y, z, t) tmp = ((x / 8.0) + t) - ((z / 2.0) * y); end
code[x_, y_, z_, t_] := N[(N[(N[(x / 8.0), $MachinePrecision] + t), $MachinePrecision] - N[(N[(z / 2.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{8} + t\right) - \frac{z}{2} \cdot y
\end{array}
herbie shell --seed 2023297
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, B"
:precision binary64
:herbie-target
(- (+ (/ x 8.0) t) (* (/ z 2.0) y))
(+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))