
(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) 5e+306) (fma x x (* (- (* z z) t) (* y -4.0))) (* -4.0 (* z (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+306) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+306) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+306], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999993e306Initial program 98.3%
fma-neg98.3%
*-commutative98.3%
distribute-rgt-neg-in98.3%
distribute-rgt-neg-in98.3%
metadata-eval98.3%
Simplified98.3%
if 4.99999999999999993e306 < (*.f64 z z) Initial program 71.7%
Taylor expanded in z around inf 77.3%
unpow277.3%
*-commutative77.3%
associate-*l*91.7%
Simplified91.7%
Final simplification96.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* -4.0 (* (* z z) y))))
(if (<= (* x x) 5e-311)
t_1
(if (<= (* x x) 1.05e-178)
(* t (* y 4.0))
(if (<= (* x x) 1.9e+109) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = -4.0 * ((z * z) * y);
double tmp;
if ((x * x) <= 5e-311) {
tmp = t_1;
} else if ((x * x) <= 1.05e-178) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 1.9e+109) {
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) :: tmp
t_1 = (-4.0d0) * ((z * z) * y)
if ((x * x) <= 5d-311) then
tmp = t_1
else if ((x * x) <= 1.05d-178) then
tmp = t * (y * 4.0d0)
else if ((x * x) <= 1.9d+109) 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 = -4.0 * ((z * z) * y);
double tmp;
if ((x * x) <= 5e-311) {
tmp = t_1;
} else if ((x * x) <= 1.05e-178) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 1.9e+109) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = -4.0 * ((z * z) * y) tmp = 0 if (x * x) <= 5e-311: tmp = t_1 elif (x * x) <= 1.05e-178: tmp = t * (y * 4.0) elif (x * x) <= 1.9e+109: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(-4.0 * Float64(Float64(z * z) * y)) tmp = 0.0 if (Float64(x * x) <= 5e-311) tmp = t_1; elseif (Float64(x * x) <= 1.05e-178) tmp = Float64(t * Float64(y * 4.0)); elseif (Float64(x * x) <= 1.9e+109) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -4.0 * ((z * z) * y); tmp = 0.0; if ((x * x) <= 5e-311) tmp = t_1; elseif ((x * x) <= 1.05e-178) tmp = t * (y * 4.0); elseif ((x * x) <= 1.9e+109) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-311], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 1.05e-178], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 1.9e+109], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-311}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 1.05 \cdot 10^{-178}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{elif}\;x \cdot x \leq 1.9 \cdot 10^{+109}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 5.00000000000023e-311 or 1.05e-178 < (*.f64 x x) < 1.90000000000000019e109Initial program 91.1%
Taylor expanded in z around inf 54.3%
unpow254.3%
Simplified54.3%
if 5.00000000000023e-311 < (*.f64 x x) < 1.05e-178Initial program 96.9%
Taylor expanded in t around inf 58.1%
associate-*r*58.1%
Simplified58.1%
if 1.90000000000000019e109 < (*.f64 x x) Initial program 89.3%
Taylor expanded in x around inf 78.1%
unpow278.1%
Simplified78.1%
Final simplification65.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* -4.0 (* z (* z y)))))
(if (<= (* x x) 5e-311)
t_1
(if (<= (* x x) 2.45e-178)
(* t (* y 4.0))
(if (<= (* x x) 8.5e+108) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = -4.0 * (z * (z * y));
double tmp;
if ((x * x) <= 5e-311) {
tmp = t_1;
} else if ((x * x) <= 2.45e-178) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 8.5e+108) {
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) :: tmp
t_1 = (-4.0d0) * (z * (z * y))
if ((x * x) <= 5d-311) then
tmp = t_1
else if ((x * x) <= 2.45d-178) then
tmp = t * (y * 4.0d0)
else if ((x * x) <= 8.5d+108) 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 = -4.0 * (z * (z * y));
double tmp;
if ((x * x) <= 5e-311) {
tmp = t_1;
} else if ((x * x) <= 2.45e-178) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 8.5e+108) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = -4.0 * (z * (z * y)) tmp = 0 if (x * x) <= 5e-311: tmp = t_1 elif (x * x) <= 2.45e-178: tmp = t * (y * 4.0) elif (x * x) <= 8.5e+108: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(-4.0 * Float64(z * Float64(z * y))) tmp = 0.0 if (Float64(x * x) <= 5e-311) tmp = t_1; elseif (Float64(x * x) <= 2.45e-178) tmp = Float64(t * Float64(y * 4.0)); elseif (Float64(x * x) <= 8.5e+108) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -4.0 * (z * (z * y)); tmp = 0.0; if ((x * x) <= 5e-311) tmp = t_1; elseif ((x * x) <= 2.45e-178) tmp = t * (y * 4.0); elseif ((x * x) <= 8.5e+108) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-311], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 2.45e-178], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 8.5e+108], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-311}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 2.45 \cdot 10^{-178}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{elif}\;x \cdot x \leq 8.5 \cdot 10^{+108}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 5.00000000000023e-311 or 2.4500000000000001e-178 < (*.f64 x x) < 8.50000000000000016e108Initial program 91.1%
Taylor expanded in z around inf 54.3%
unpow254.3%
*-commutative54.3%
associate-*l*63.1%
Simplified63.1%
if 5.00000000000023e-311 < (*.f64 x x) < 2.4500000000000001e-178Initial program 96.9%
Taylor expanded in t around inf 58.1%
associate-*r*58.1%
Simplified58.1%
if 8.50000000000000016e108 < (*.f64 x x) Initial program 89.3%
Taylor expanded in x around inf 78.1%
unpow278.1%
Simplified78.1%
Final simplification69.6%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 5e+50)
(- (* x x) (* t (* y -4.0)))
(if (<= (* z z) 5e+306)
(- (* x x) (* (* z z) (* y 4.0)))
(* -4.0 (* z (* z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+50) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 5e+306) {
tmp = (x * x) - ((z * z) * (y * 4.0));
} else {
tmp = -4.0 * (z * (z * y));
}
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 * z) <= 5d+50) then
tmp = (x * x) - (t * (y * (-4.0d0)))
else if ((z * z) <= 5d+306) then
tmp = (x * x) - ((z * z) * (y * 4.0d0))
else
tmp = (-4.0d0) * (z * (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+50) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 5e+306) {
tmp = (x * x) - ((z * z) * (y * 4.0));
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+50: tmp = (x * x) - (t * (y * -4.0)) elif (z * z) <= 5e+306: tmp = (x * x) - ((z * z) * (y * 4.0)) else: tmp = -4.0 * (z * (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+50) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); elseif (Float64(z * z) <= 5e+306) tmp = Float64(Float64(x * x) - Float64(Float64(z * z) * Float64(y * 4.0))); else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e+50) tmp = (x * x) - (t * (y * -4.0)); elseif ((z * z) <= 5e+306) tmp = (x * x) - ((z * z) * (y * 4.0)); else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+50], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+306], N[(N[(x * x), $MachinePrecision] - N[(N[(z * z), $MachinePrecision] * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+50}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+306}:\\
\;\;\;\;x \cdot x - \left(z \cdot z\right) \cdot \left(y \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5e50Initial program 98.4%
Taylor expanded in z around 0 94.3%
associate-*r*94.3%
Simplified94.3%
if 5e50 < (*.f64 z z) < 4.99999999999999993e306Initial program 98.0%
Taylor expanded in z around inf 96.3%
unpow296.3%
Simplified96.3%
if 4.99999999999999993e306 < (*.f64 z z) Initial program 71.7%
Taylor expanded in z around inf 77.3%
unpow277.3%
*-commutative77.3%
associate-*l*91.7%
Simplified91.7%
Final simplification94.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+306) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (* -4.0 (* z (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+306) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = -4.0 * (z * (z * y));
}
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 * z) <= 5d+306) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (-4.0d0) * (z * (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+306) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+306: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = -4.0 * (z * (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+306) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e+306) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+306], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+306}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999993e306Initial program 98.3%
if 4.99999999999999993e306 < (*.f64 z z) Initial program 71.7%
Taylor expanded in z around inf 77.3%
unpow277.3%
*-commutative77.3%
associate-*l*91.7%
Simplified91.7%
Final simplification96.5%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 2.7e+110) (* (- (* z z) t) (* y -4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2.7e+110) {
tmp = ((z * z) - t) * (y * -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) <= 2.7d+110) then
tmp = ((z * z) - t) * (y * (-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) <= 2.7e+110) {
tmp = ((z * z) - t) * (y * -4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 2.7e+110: tmp = ((z * z) - t) * (y * -4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 2.7e+110) tmp = Float64(Float64(Float64(z * z) - t) * Float64(y * -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) <= 2.7e+110) tmp = ((z * z) - t) * (y * -4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 2.7e+110], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2.7 \cdot 10^{+110}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 2.7000000000000001e110Initial program 92.5%
Taylor expanded in x around 0 82.9%
*-commutative82.9%
*-commutative82.9%
unpow282.9%
*-commutative82.9%
associate-*l*82.9%
Simplified82.9%
if 2.7000000000000001e110 < (*.f64 x x) Initial program 89.1%
Taylor expanded in x around inf 78.6%
unpow278.6%
Simplified78.6%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+240) (- (* x x) (* t (* y -4.0))) (* -4.0 (* z (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+240) {
tmp = (x * x) - (t * (y * -4.0));
} else {
tmp = -4.0 * (z * (z * y));
}
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 * z) <= 2d+240) then
tmp = (x * x) - (t * (y * (-4.0d0)))
else
tmp = (-4.0d0) * (z * (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+240) {
tmp = (x * x) - (t * (y * -4.0));
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e+240: tmp = (x * x) - (t * (y * -4.0)) else: tmp = -4.0 * (z * (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+240) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 2e+240) tmp = (x * x) - (t * (y * -4.0)); else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+240], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+240}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.00000000000000003e240Initial program 98.8%
Taylor expanded in z around 0 85.5%
associate-*r*85.5%
Simplified85.5%
if 2.00000000000000003e240 < (*.f64 z z) Initial program 75.1%
Taylor expanded in z around inf 78.6%
unpow278.6%
*-commutative78.6%
associate-*l*90.7%
Simplified90.7%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1.2e+44) (* t (* y 4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1.2e+44) {
tmp = t * (y * 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) <= 1.2d+44) then
tmp = t * (y * 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) <= 1.2e+44) {
tmp = t * (y * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1.2e+44: tmp = t * (y * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1.2e+44) tmp = Float64(t * Float64(y * 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) <= 1.2e+44) tmp = t * (y * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.2e+44], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.2 \cdot 10^{+44}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.20000000000000007e44Initial program 91.6%
Taylor expanded in t around inf 43.0%
associate-*r*43.0%
Simplified43.0%
if 1.20000000000000007e44 < (*.f64 x x) Initial program 90.3%
Taylor expanded in x around inf 73.0%
unpow273.0%
Simplified73.0%
Final simplification58.6%
(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 90.9%
Taylor expanded in x around inf 43.3%
unpow243.3%
Simplified43.3%
Final simplification43.3%
(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 2023268
(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))))