
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * 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 = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * 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 = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 4e+256) (fma x x (* (* y -4.0) (- (* z z) t))) (* z (* y (* z -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4e+256) {
tmp = fma(x, x, ((y * -4.0) * ((z * z) - t)));
} else {
tmp = z * (y * (z * -4.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4e+256) tmp = fma(x, x, Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t))); else tmp = Float64(z * Float64(y * Float64(z * -4.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e+256], N[(x * x + N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+256}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.0000000000000001e256Initial program 98.8%
fma-neg100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
if 4.0000000000000001e256 < (*.f64 z z) Initial program 68.4%
sub-neg68.4%
distribute-rgt-in62.4%
Applied egg-rr62.4%
Taylor expanded in z around inf 74.5%
unpow274.5%
*-commutative74.5%
associate-*l*74.5%
*-commutative74.5%
associate-*r*74.5%
associate-*l*91.0%
Simplified91.0%
Final simplification97.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x x) (* 4.0 (* (* z z) y))))
(t_2 (* (* y -4.0) (- (* z z) t))))
(if (<= (* x x) 4.3e-157)
t_2
(if (<= (* x x) 3.6e-63)
t_1
(if (<= (* x x) 1.4e+22)
t_2
(if (<= (* x x) 2.75e+307) t_1 (* x x)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * x) - (4.0 * ((z * z) * y));
double t_2 = (y * -4.0) * ((z * z) - t);
double tmp;
if ((x * x) <= 4.3e-157) {
tmp = t_2;
} else if ((x * x) <= 3.6e-63) {
tmp = t_1;
} else if ((x * x) <= 1.4e+22) {
tmp = t_2;
} else if ((x * x) <= 2.75e+307) {
tmp = t_1;
} else {
tmp = x * 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * x) - (4.0d0 * ((z * z) * y))
t_2 = (y * (-4.0d0)) * ((z * z) - t)
if ((x * x) <= 4.3d-157) then
tmp = t_2
else if ((x * x) <= 3.6d-63) then
tmp = t_1
else if ((x * x) <= 1.4d+22) then
tmp = t_2
else if ((x * x) <= 2.75d+307) then
tmp = t_1
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * x) - (4.0 * ((z * z) * y));
double t_2 = (y * -4.0) * ((z * z) - t);
double tmp;
if ((x * x) <= 4.3e-157) {
tmp = t_2;
} else if ((x * x) <= 3.6e-63) {
tmp = t_1;
} else if ((x * x) <= 1.4e+22) {
tmp = t_2;
} else if ((x * x) <= 2.75e+307) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * x) - (4.0 * ((z * z) * y)) t_2 = (y * -4.0) * ((z * z) - t) tmp = 0 if (x * x) <= 4.3e-157: tmp = t_2 elif (x * x) <= 3.6e-63: tmp = t_1 elif (x * x) <= 1.4e+22: tmp = t_2 elif (x * x) <= 2.75e+307: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * x) - Float64(4.0 * Float64(Float64(z * z) * y))) t_2 = Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t)) tmp = 0.0 if (Float64(x * x) <= 4.3e-157) tmp = t_2; elseif (Float64(x * x) <= 3.6e-63) tmp = t_1; elseif (Float64(x * x) <= 1.4e+22) tmp = t_2; elseif (Float64(x * x) <= 2.75e+307) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * x) - (4.0 * ((z * z) * y)); t_2 = (y * -4.0) * ((z * z) - t); tmp = 0.0; if ((x * x) <= 4.3e-157) tmp = t_2; elseif ((x * x) <= 3.6e-63) tmp = t_1; elseif ((x * x) <= 1.4e+22) tmp = t_2; elseif ((x * x) <= 2.75e+307) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] - N[(4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 4.3e-157], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 3.6e-63], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 1.4e+22], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 2.75e+307], t$95$1, N[(x * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot x - 4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
t_2 := \left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\\
\mathbf{if}\;x \cdot x \leq 4.3 \cdot 10^{-157}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 3.6 \cdot 10^{-63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 1.4 \cdot 10^{+22}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 2.75 \cdot 10^{+307}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 4.2999999999999998e-157 or 3.60000000000000008e-63 < (*.f64 x x) < 1.4e22Initial program 91.9%
Taylor expanded in x around 0 90.3%
associate-*r*90.3%
unpow290.3%
*-commutative90.3%
*-commutative90.3%
Simplified90.3%
if 4.2999999999999998e-157 < (*.f64 x x) < 3.60000000000000008e-63 or 1.4e22 < (*.f64 x x) < 2.74999999999999993e307Initial program 90.0%
Taylor expanded in z around inf 74.5%
unpow274.5%
Simplified74.5%
if 2.74999999999999993e307 < (*.f64 x x) Initial program 82.8%
Taylor expanded in x around inf 89.1%
unpow289.1%
Simplified89.1%
Final simplification85.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* (* z z) -4.0))) (t_2 (* y (* t 4.0))))
(if (<= (* x x) 8.4e-305)
t_2
(if (<= (* x x) 3.3e-234)
t_1
(if (<= (* x x) 3.5e-180)
t_2
(if (<= (* x x) 1.4e+139) t_1 (* x x)))))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z * z) * -4.0);
double t_2 = y * (t * 4.0);
double tmp;
if ((x * x) <= 8.4e-305) {
tmp = t_2;
} else if ((x * x) <= 3.3e-234) {
tmp = t_1;
} else if ((x * x) <= 3.5e-180) {
tmp = t_2;
} else if ((x * x) <= 1.4e+139) {
tmp = t_1;
} else {
tmp = x * 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = y * ((z * z) * (-4.0d0))
t_2 = y * (t * 4.0d0)
if ((x * x) <= 8.4d-305) then
tmp = t_2
else if ((x * x) <= 3.3d-234) then
tmp = t_1
else if ((x * x) <= 3.5d-180) then
tmp = t_2
else if ((x * x) <= 1.4d+139) then
tmp = t_1
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * ((z * z) * -4.0);
double t_2 = y * (t * 4.0);
double tmp;
if ((x * x) <= 8.4e-305) {
tmp = t_2;
} else if ((x * x) <= 3.3e-234) {
tmp = t_1;
} else if ((x * x) <= 3.5e-180) {
tmp = t_2;
} else if ((x * x) <= 1.4e+139) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z * z) * -4.0) t_2 = y * (t * 4.0) tmp = 0 if (x * x) <= 8.4e-305: tmp = t_2 elif (x * x) <= 3.3e-234: tmp = t_1 elif (x * x) <= 3.5e-180: tmp = t_2 elif (x * x) <= 1.4e+139: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z * z) * -4.0)) t_2 = Float64(y * Float64(t * 4.0)) tmp = 0.0 if (Float64(x * x) <= 8.4e-305) tmp = t_2; elseif (Float64(x * x) <= 3.3e-234) tmp = t_1; elseif (Float64(x * x) <= 3.5e-180) tmp = t_2; elseif (Float64(x * x) <= 1.4e+139) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z * z) * -4.0); t_2 = y * (t * 4.0); tmp = 0.0; if ((x * x) <= 8.4e-305) tmp = t_2; elseif ((x * x) <= 3.3e-234) tmp = t_1; elseif ((x * x) <= 3.5e-180) tmp = t_2; elseif ((x * x) <= 1.4e+139) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z * z), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 8.4e-305], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 3.3e-234], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 3.5e-180], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 1.4e+139], t$95$1, N[(x * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\\
t_2 := y \cdot \left(t \cdot 4\right)\\
\mathbf{if}\;x \cdot x \leq 8.4 \cdot 10^{-305}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 3.3 \cdot 10^{-234}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 3.5 \cdot 10^{-180}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 1.4 \cdot 10^{+139}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 8.3999999999999999e-305 or 3.30000000000000014e-234 < (*.f64 x x) < 3.5000000000000001e-180Initial program 91.6%
Taylor expanded in t around inf 64.2%
associate-*r*64.2%
*-commutative64.2%
Simplified64.2%
if 8.3999999999999999e-305 < (*.f64 x x) < 3.30000000000000014e-234 or 3.5000000000000001e-180 < (*.f64 x x) < 1.3999999999999999e139Initial program 90.9%
Taylor expanded in z around inf 53.6%
*-commutative53.6%
unpow253.6%
associate-*l*53.6%
Simplified53.6%
if 1.3999999999999999e139 < (*.f64 x x) Initial program 85.4%
Taylor expanded in x around inf 74.8%
unpow274.8%
Simplified74.8%
Final simplification64.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* t 4.0))))
(if (<= (* z z) 1e-174)
t_1
(if (<= (* z z) 20000.0)
(* x x)
(if (<= (* z z) 5e+82) t_1 (* z (* y (* z -4.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t * 4.0);
double tmp;
if ((z * z) <= 1e-174) {
tmp = t_1;
} else if ((z * z) <= 20000.0) {
tmp = x * x;
} else if ((z * z) <= 5e+82) {
tmp = t_1;
} else {
tmp = z * (y * (z * -4.0));
}
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 * (t * 4.0d0)
if ((z * z) <= 1d-174) then
tmp = t_1
else if ((z * z) <= 20000.0d0) then
tmp = x * x
else if ((z * z) <= 5d+82) then
tmp = t_1
else
tmp = z * (y * (z * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t * 4.0);
double tmp;
if ((z * z) <= 1e-174) {
tmp = t_1;
} else if ((z * z) <= 20000.0) {
tmp = x * x;
} else if ((z * z) <= 5e+82) {
tmp = t_1;
} else {
tmp = z * (y * (z * -4.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t * 4.0) tmp = 0 if (z * z) <= 1e-174: tmp = t_1 elif (z * z) <= 20000.0: tmp = x * x elif (z * z) <= 5e+82: tmp = t_1 else: tmp = z * (y * (z * -4.0)) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t * 4.0)) tmp = 0.0 if (Float64(z * z) <= 1e-174) tmp = t_1; elseif (Float64(z * z) <= 20000.0) tmp = Float64(x * x); elseif (Float64(z * z) <= 5e+82) tmp = t_1; else tmp = Float64(z * Float64(y * Float64(z * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t * 4.0); tmp = 0.0; if ((z * z) <= 1e-174) tmp = t_1; elseif ((z * z) <= 20000.0) tmp = x * x; elseif ((z * z) <= 5e+82) tmp = t_1; else tmp = z * (y * (z * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 1e-174], t$95$1, If[LessEqual[N[(z * z), $MachinePrecision], 20000.0], N[(x * x), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+82], t$95$1, N[(z * N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t \cdot 4\right)\\
\mathbf{if}\;z \cdot z \leq 10^{-174}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot z \leq 20000:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+82}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1e-174 or 2e4 < (*.f64 z z) < 5.00000000000000015e82Initial program 99.1%
Taylor expanded in t around inf 55.4%
associate-*r*55.4%
*-commutative55.4%
Simplified55.4%
if 1e-174 < (*.f64 z z) < 2e4Initial program 99.9%
Taylor expanded in x around inf 50.3%
unpow250.3%
Simplified50.3%
if 5.00000000000000015e82 < (*.f64 z z) Initial program 76.2%
sub-neg76.2%
distribute-rgt-in71.8%
Applied egg-rr71.8%
Taylor expanded in z around inf 72.4%
unpow272.4%
*-commutative72.4%
associate-*l*72.4%
*-commutative72.4%
associate-*r*72.4%
associate-*l*84.3%
Simplified84.3%
Final simplification67.5%
(FPCore (x y z t)
:precision binary64
(if (or (<= (* x x) 4.5e-157)
(and (not (<= (* x x) 1.35e-59)) (<= (* x x) 2.6e+24)))
(* y (* t 4.0))
(* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * x) <= 4.5e-157) || (!((x * x) <= 1.35e-59) && ((x * x) <= 2.6e+24))) {
tmp = y * (t * 4.0);
} else {
tmp = x * 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 * x) <= 4.5d-157) .or. (.not. ((x * x) <= 1.35d-59)) .and. ((x * x) <= 2.6d+24)) then
tmp = y * (t * 4.0d0)
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x * x) <= 4.5e-157) || (!((x * x) <= 1.35e-59) && ((x * x) <= 2.6e+24))) {
tmp = y * (t * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x * x) <= 4.5e-157) or (not ((x * x) <= 1.35e-59) and ((x * x) <= 2.6e+24)): tmp = y * (t * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x * x) <= 4.5e-157) || (!(Float64(x * x) <= 1.35e-59) && (Float64(x * x) <= 2.6e+24))) tmp = Float64(y * Float64(t * 4.0)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x * x) <= 4.5e-157) || (~(((x * x) <= 1.35e-59)) && ((x * x) <= 2.6e+24))) tmp = y * (t * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 4.5e-157], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 1.35e-59]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 2.6e+24]]], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4.5 \cdot 10^{-157} \lor \neg \left(x \cdot x \leq 1.35 \cdot 10^{-59}\right) \land x \cdot x \leq 2.6 \cdot 10^{+24}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 4.49999999999999999e-157 or 1.3499999999999999e-59 < (*.f64 x x) < 2.5999999999999998e24Initial program 91.8%
Taylor expanded in t around inf 55.8%
associate-*r*55.8%
*-commutative55.8%
Simplified55.8%
if 4.49999999999999999e-157 < (*.f64 x x) < 1.3499999999999999e-59 or 2.5999999999999998e24 < (*.f64 x x) Initial program 86.9%
Taylor expanded in x around inf 60.2%
unpow260.2%
Simplified60.2%
Final simplification58.2%
(FPCore (x y z t) :precision binary64 (if (<= z 1.9e+184) (+ (* x x) (* 4.0 (- (* t y) (* z (* z y))))) (* z (* y (* z -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.9e+184) {
tmp = (x * x) + (4.0 * ((t * y) - (z * (z * y))));
} else {
tmp = z * (y * (z * -4.0));
}
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 (z <= 1.9d+184) then
tmp = (x * x) + (4.0d0 * ((t * y) - (z * (z * y))))
else
tmp = z * (y * (z * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.9e+184) {
tmp = (x * x) + (4.0 * ((t * y) - (z * (z * y))));
} else {
tmp = z * (y * (z * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.9e+184: tmp = (x * x) + (4.0 * ((t * y) - (z * (z * y)))) else: tmp = z * (y * (z * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.9e+184) tmp = Float64(Float64(x * x) + Float64(4.0 * Float64(Float64(t * y) - Float64(z * Float64(z * y))))); else tmp = Float64(z * Float64(y * Float64(z * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.9e+184) tmp = (x * x) + (4.0 * ((t * y) - (z * (z * y)))); else tmp = z * (y * (z * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.9e+184], N[(N[(x * x), $MachinePrecision] + N[(4.0 * N[(N[(t * y), $MachinePrecision] - N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.9 \cdot 10^{+184}:\\
\;\;\;\;x \cdot x + 4 \cdot \left(t \cdot y - z \cdot \left(z \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\end{array}
\end{array}
if z < 1.9000000000000001e184Initial program 91.4%
sub-neg91.4%
distribute-rgt-in89.6%
Applied egg-rr89.6%
distribute-rgt-out91.4%
sub-neg91.4%
add-sqr-sqrt43.2%
sqrt-unprod61.5%
sqr-neg61.5%
sqrt-unprod27.9%
add-sqr-sqrt58.6%
distribute-rgt-out--57.3%
associate-*r*57.3%
*-commutative57.3%
associate-*r*57.3%
distribute-rgt-out--57.3%
*-commutative57.3%
associate-*l*62.5%
*-commutative62.5%
add-sqr-sqrt28.7%
sqrt-unprod64.3%
sqr-neg64.3%
sqrt-unprod44.8%
add-sqr-sqrt95.0%
Applied egg-rr95.0%
if 1.9000000000000001e184 < z Initial program 72.5%
sub-neg72.5%
distribute-rgt-in66.0%
Applied egg-rr66.0%
Taylor expanded in z around inf 82.2%
unpow282.2%
*-commutative82.2%
associate-*l*82.2%
*-commutative82.2%
associate-*r*82.2%
associate-*l*96.9%
Simplified96.9%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (<= z 6.4e+122) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (* z (* y (* z -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6.4e+122) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = z * (y * (z * -4.0));
}
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 (z <= 6.4d+122) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = z * (y * (z * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6.4e+122) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = z * (y * (z * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 6.4e+122: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = z * (y * (z * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 6.4e+122) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(z * Float64(y * Float64(z * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 6.4e+122) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = z * (y * (z * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 6.4e+122], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.4 \cdot 10^{+122}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\end{array}
\end{array}
if z < 6.40000000000000024e122Initial program 91.9%
if 6.40000000000000024e122 < z Initial program 74.4%
sub-neg74.4%
distribute-rgt-in69.5%
Applied egg-rr69.5%
Taylor expanded in z around inf 81.9%
unpow281.9%
*-commutative81.9%
associate-*l*81.9%
*-commutative81.9%
associate-*r*81.9%
associate-*l*95.3%
Simplified95.3%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (if (<= x 7.8e+154) (* (* y -4.0) (- (* z z) t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 7.8e+154) {
tmp = (y * -4.0) * ((z * z) - t);
} else {
tmp = x * 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 <= 7.8d+154) then
tmp = (y * (-4.0d0)) * ((z * z) - t)
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 7.8e+154) {
tmp = (y * -4.0) * ((z * z) - t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 7.8e+154: tmp = (y * -4.0) * ((z * z) - t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 7.8e+154) tmp = Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 7.8e+154) tmp = (y * -4.0) * ((z * z) - t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 7.8e+154], N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.8 \cdot 10^{+154}:\\
\;\;\;\;\left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 7.8000000000000006e154Initial program 89.1%
Taylor expanded in x around 0 71.1%
associate-*r*71.1%
unpow271.1%
*-commutative71.1%
*-commutative71.1%
Simplified71.1%
if 7.8000000000000006e154 < x Initial program 89.2%
Taylor expanded in x around inf 94.6%
unpow294.6%
Simplified94.6%
Final simplification74.5%
(FPCore (x y z t) :precision binary64 (* x x))
double code(double x, double y, double z, double t) {
return x * x;
}
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 * x
end function
public static double code(double x, double y, double z, double t) {
return x * x;
}
def code(x, y, z, t): return x * x
function code(x, y, z, t) return Float64(x * x) end
function tmp = code(x, y, z, t) tmp = x * x; end
code[x_, y_, z_, t_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x
\end{array}
Initial program 89.1%
Taylor expanded in x around inf 35.4%
unpow235.4%
Simplified35.4%
Final simplification35.4%
(FPCore (x y z t) :precision binary64 (- (* x x) (* 4.0 (* y (- (* z z) t)))))
double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((z * 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 = (x * x) - (4.0d0 * (y * ((z * z) - t)))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((z * z) - t)));
}
def code(x, y, z, t): return (x * x) - (4.0 * (y * ((z * z) - t)))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(4.0 * Float64(y * Float64(Float64(z * z) - t)))) end
function tmp = code(x, y, z, t) tmp = (x * x) - (4.0 * (y * ((z * z) - t))); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(4.0 * N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)
\end{array}
herbie shell --seed 2023290
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:herbie-target
(- (* x x) (* 4.0 (* y (- (* z z) t))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))