
(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 7 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 (+ (- (* 0.125 x) (* (/ y 2.0) z)) t))
double code(double x, double y, double z, double t) {
return ((0.125 * x) - ((y / 2.0) * z)) + 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 = ((0.125d0 * x) - ((y / 2.0d0) * z)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((0.125 * x) - ((y / 2.0) * z)) + t;
}
def code(x, y, z, t): return ((0.125 * x) - ((y / 2.0) * z)) + t
function code(x, y, z, t) return Float64(Float64(Float64(0.125 * x) - Float64(Float64(y / 2.0) * z)) + t) end
function tmp = code(x, y, z, t) tmp = ((0.125 * x) - ((y / 2.0) * z)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(0.125 * x), $MachinePrecision] - N[(N[(y / 2.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(0.125 \cdot x - \frac{y}{2} \cdot z\right) + t
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* y z) -0.5)))
(if (<= (* y z) -2.5e+127)
t_1
(if (<= (* y z) -6.8e-84)
(* 0.125 x)
(if (<= (* y z) -1.36e-266)
t
(if (<= (* y z) 0.0) (* 0.125 x) (if (<= (* y z) 1.1e-29) t t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) * -0.5;
double tmp;
if ((y * z) <= -2.5e+127) {
tmp = t_1;
} else if ((y * z) <= -6.8e-84) {
tmp = 0.125 * x;
} else if ((y * z) <= -1.36e-266) {
tmp = t;
} else if ((y * z) <= 0.0) {
tmp = 0.125 * x;
} else if ((y * z) <= 1.1e-29) {
tmp = t;
} 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 = (y * z) * (-0.5d0)
if ((y * z) <= (-2.5d+127)) then
tmp = t_1
else if ((y * z) <= (-6.8d-84)) then
tmp = 0.125d0 * x
else if ((y * z) <= (-1.36d-266)) then
tmp = t
else if ((y * z) <= 0.0d0) then
tmp = 0.125d0 * x
else if ((y * z) <= 1.1d-29) then
tmp = t
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 = (y * z) * -0.5;
double tmp;
if ((y * z) <= -2.5e+127) {
tmp = t_1;
} else if ((y * z) <= -6.8e-84) {
tmp = 0.125 * x;
} else if ((y * z) <= -1.36e-266) {
tmp = t;
} else if ((y * z) <= 0.0) {
tmp = 0.125 * x;
} else if ((y * z) <= 1.1e-29) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) * -0.5 tmp = 0 if (y * z) <= -2.5e+127: tmp = t_1 elif (y * z) <= -6.8e-84: tmp = 0.125 * x elif (y * z) <= -1.36e-266: tmp = t elif (y * z) <= 0.0: tmp = 0.125 * x elif (y * z) <= 1.1e-29: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) * -0.5) tmp = 0.0 if (Float64(y * z) <= -2.5e+127) tmp = t_1; elseif (Float64(y * z) <= -6.8e-84) tmp = Float64(0.125 * x); elseif (Float64(y * z) <= -1.36e-266) tmp = t; elseif (Float64(y * z) <= 0.0) tmp = Float64(0.125 * x); elseif (Float64(y * z) <= 1.1e-29) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * z) * -0.5; tmp = 0.0; if ((y * z) <= -2.5e+127) tmp = t_1; elseif ((y * z) <= -6.8e-84) tmp = 0.125 * x; elseif ((y * z) <= -1.36e-266) tmp = t; elseif ((y * z) <= 0.0) tmp = 0.125 * x; elseif ((y * z) <= 1.1e-29) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[N[(y * z), $MachinePrecision], -2.5e+127], t$95$1, If[LessEqual[N[(y * z), $MachinePrecision], -6.8e-84], N[(0.125 * x), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], -1.36e-266], t, If[LessEqual[N[(y * z), $MachinePrecision], 0.0], N[(0.125 * x), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 1.1e-29], t, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y \cdot z\right) \cdot -0.5\\
\mathbf{if}\;y \cdot z \leq -2.5 \cdot 10^{+127}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \cdot z \leq -6.8 \cdot 10^{-84}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;y \cdot z \leq -1.36 \cdot 10^{-266}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \cdot z \leq 0:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;y \cdot z \leq 1.1 \cdot 10^{-29}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 y z) < -2.5000000000000002e127 or 1.09999999999999995e-29 < (*.f64 y z) Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around inf 73.5%
*-commutative73.5%
Simplified73.5%
if -2.5000000000000002e127 < (*.f64 y z) < -6.80000000000000042e-84 or -1.36000000000000008e-266 < (*.f64 y z) < -0.0Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around inf 55.9%
if -6.80000000000000042e-84 < (*.f64 y z) < -1.36000000000000008e-266 or -0.0 < (*.f64 y z) < 1.09999999999999995e-29Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around inf 58.0%
Final simplification63.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (* y z) -1.75e+127) (not (<= (* y z) 1.7e+87))) (- t (* 0.5 (* y z))) (+ (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((y * z) <= -1.75e+127) || !((y * z) <= 1.7e+87)) {
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) <= (-1.75d+127)) .or. (.not. ((y * z) <= 1.7d+87))) 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) <= -1.75e+127) || !((y * z) <= 1.7e+87)) {
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) <= -1.75e+127) or not ((y * z) <= 1.7e+87): 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) <= -1.75e+127) || !(Float64(y * z) <= 1.7e+87)) 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) <= -1.75e+127) || ~(((y * z) <= 1.7e+87))) 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], -1.75e+127], N[Not[LessEqual[N[(y * z), $MachinePrecision], 1.7e+87]], $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 -1.75 \cdot 10^{+127} \lor \neg \left(y \cdot z \leq 1.7 \cdot 10^{+87}\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) < -1.74999999999999989e127 or 1.7000000000000001e87 < (*.f64 y z) Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 92.5%
if -1.74999999999999989e127 < (*.f64 y z) < 1.7000000000000001e87Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 85.8%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (* y z) -2.5e+158) (not (<= (* y z) 1.05e+128))) (* (* y z) -0.5) (+ (* 0.125 x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((y * z) <= -2.5e+158) || !((y * z) <= 1.05e+128)) {
tmp = (y * z) * -0.5;
} 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.5d+158)) .or. (.not. ((y * z) <= 1.05d+128))) then
tmp = (y * z) * (-0.5d0)
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.5e+158) || !((y * z) <= 1.05e+128)) {
tmp = (y * z) * -0.5;
} else {
tmp = (0.125 * x) + t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y * z) <= -2.5e+158) or not ((y * z) <= 1.05e+128): tmp = (y * z) * -0.5 else: tmp = (0.125 * x) + t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y * z) <= -2.5e+158) || !(Float64(y * z) <= 1.05e+128)) tmp = Float64(Float64(y * z) * -0.5); 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.5e+158) || ~(((y * z) <= 1.05e+128))) tmp = (y * z) * -0.5; else tmp = (0.125 * x) + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], -2.5e+158], N[Not[LessEqual[N[(y * z), $MachinePrecision], 1.05e+128]], $MachinePrecision]], N[(N[(y * z), $MachinePrecision] * -0.5), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -2.5 \cdot 10^{+158} \lor \neg \left(y \cdot z \leq 1.05 \cdot 10^{+128}\right):\\
\;\;\;\;\left(y \cdot z\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x + t\\
\end{array}
\end{array}
if (*.f64 y z) < -2.4999999999999998e158 or 1.05e128 < (*.f64 y z) Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around inf 90.5%
*-commutative90.5%
Simplified90.5%
if -2.4999999999999998e158 < (*.f64 y z) < 1.05e128Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 83.5%
Final simplification85.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* 0.5 (* y z)))) (if (or (<= t -0.011) (not (<= t 2.7e+92))) (- t t_1) (- (* 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 ((t <= -0.011) || !(t <= 2.7e+92)) {
tmp = t - t_1;
} else {
tmp = (0.125 * x) - 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 ((t <= (-0.011d0)) .or. (.not. (t <= 2.7d+92))) then
tmp = t - t_1
else
tmp = (0.125d0 * x) - 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 ((t <= -0.011) || !(t <= 2.7e+92)) {
tmp = t - t_1;
} else {
tmp = (0.125 * x) - t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * (y * z) tmp = 0 if (t <= -0.011) or not (t <= 2.7e+92): tmp = t - t_1 else: tmp = (0.125 * x) - t_1 return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(y * z)) tmp = 0.0 if ((t <= -0.011) || !(t <= 2.7e+92)) tmp = Float64(t - t_1); else tmp = Float64(Float64(0.125 * x) - t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * (y * z); tmp = 0.0; if ((t <= -0.011) || ~((t <= 2.7e+92))) tmp = t - t_1; else tmp = (0.125 * x) - 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[Or[LessEqual[t, -0.011], N[Not[LessEqual[t, 2.7e+92]], $MachinePrecision]], N[(t - t$95$1), $MachinePrecision], N[(N[(0.125 * x), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t \leq -0.011 \lor \neg \left(t \leq 2.7 \cdot 10^{+92}\right):\\
\;\;\;\;t - t_1\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x - t_1\\
\end{array}
\end{array}
if t < -0.010999999999999999 or 2.6999999999999999e92 < t Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 89.3%
if -0.010999999999999999 < t < 2.6999999999999999e92Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around 0 91.9%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (<= x -3.3e+103) (* 0.125 x) (if (<= x 8.8e+95) t (* 0.125 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.3e+103) {
tmp = 0.125 * x;
} else if (x <= 8.8e+95) {
tmp = t;
} else {
tmp = 0.125 * x;
}
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 (x <= (-3.3d+103)) then
tmp = 0.125d0 * x
else if (x <= 8.8d+95) then
tmp = t
else
tmp = 0.125d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.3e+103) {
tmp = 0.125 * x;
} else if (x <= 8.8e+95) {
tmp = t;
} else {
tmp = 0.125 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.3e+103: tmp = 0.125 * x elif x <= 8.8e+95: tmp = t else: tmp = 0.125 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.3e+103) tmp = Float64(0.125 * x); elseif (x <= 8.8e+95) tmp = t; else tmp = Float64(0.125 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.3e+103) tmp = 0.125 * x; elseif (x <= 8.8e+95) tmp = t; else tmp = 0.125 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.3e+103], N[(0.125 * x), $MachinePrecision], If[LessEqual[x, 8.8e+95], t, N[(0.125 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{+103}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+95}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x\\
\end{array}
\end{array}
if x < -3.30000000000000009e103 or 8.7999999999999996e95 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around inf 67.6%
if -3.30000000000000009e103 < x < 8.7999999999999996e95Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around inf 47.7%
Final simplification55.2%
(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%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around inf 34.1%
Final simplification34.1%
(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 2023229
(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))