
(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) 1e+302) (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) <= 1e+302) {
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) <= 1e+302) 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], 1e+302], 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 10^{+302}:\\
\;\;\;\;\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) < 1.0000000000000001e302Initial program 98.3%
fma-neg98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
distribute-rgt-neg-in98.8%
metadata-eval98.8%
Simplified98.8%
if 1.0000000000000001e302 < (*.f64 z z) Initial program 62.4%
Taylor expanded in z around inf 65.2%
unpow265.2%
*-commutative65.2%
associate-*l*82.2%
Simplified82.2%
Final simplification94.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* -4.0 (* z (* z y)))))
(if (<= (* x x) 8e-293)
t_1
(if (<= (* x x) 4.9e-167)
(* t (* y 4.0))
(if (<= (* x x) 5.2e+118) 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) <= 8e-293) {
tmp = t_1;
} else if ((x * x) <= 4.9e-167) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 5.2e+118) {
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) <= 8d-293) then
tmp = t_1
else if ((x * x) <= 4.9d-167) then
tmp = t * (y * 4.0d0)
else if ((x * x) <= 5.2d+118) 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) <= 8e-293) {
tmp = t_1;
} else if ((x * x) <= 4.9e-167) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 5.2e+118) {
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) <= 8e-293: tmp = t_1 elif (x * x) <= 4.9e-167: tmp = t * (y * 4.0) elif (x * x) <= 5.2e+118: 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) <= 8e-293) tmp = t_1; elseif (Float64(x * x) <= 4.9e-167) tmp = Float64(t * Float64(y * 4.0)); elseif (Float64(x * x) <= 5.2e+118) 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) <= 8e-293) tmp = t_1; elseif ((x * x) <= 4.9e-167) tmp = t * (y * 4.0); elseif ((x * x) <= 5.2e+118) 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], 8e-293], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 4.9e-167], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 5.2e+118], 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 8 \cdot 10^{-293}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 4.9 \cdot 10^{-167}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{elif}\;x \cdot x \leq 5.2 \cdot 10^{+118}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 8.0000000000000004e-293 or 4.90000000000000003e-167 < (*.f64 x x) < 5.20000000000000032e118Initial program 86.4%
Taylor expanded in z around inf 42.8%
unpow242.8%
*-commutative42.8%
associate-*l*56.3%
Simplified56.3%
if 8.0000000000000004e-293 < (*.f64 x x) < 4.90000000000000003e-167Initial program 96.7%
Taylor expanded in t around inf 61.7%
associate-*r*61.7%
Simplified61.7%
if 5.20000000000000032e118 < (*.f64 x x) Initial program 88.2%
Taylor expanded in x around inf 88.0%
unpow288.0%
Simplified88.0%
Final simplification69.6%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 4e-6)
(- (* x x) (* t (* y -4.0)))
(if (<= (* z z) 1e+302)
(- (* 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) <= 4e-6) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 1e+302) {
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) <= 4d-6) then
tmp = (x * x) - (t * (y * (-4.0d0)))
else if ((z * z) <= 1d+302) 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) <= 4e-6) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 1e+302) {
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) <= 4e-6: tmp = (x * x) - (t * (y * -4.0)) elif (z * z) <= 1e+302: 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) <= 4e-6) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); elseif (Float64(z * z) <= 1e+302) 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) <= 4e-6) tmp = (x * x) - (t * (y * -4.0)); elseif ((z * z) <= 1e+302) 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], 4e-6], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+302], 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 4 \cdot 10^{-6}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+302}:\\
\;\;\;\;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) < 3.99999999999999982e-6Initial program 98.3%
Taylor expanded in z around 0 92.9%
associate-*r*92.9%
Simplified92.9%
if 3.99999999999999982e-6 < (*.f64 z z) < 1.0000000000000001e302Initial program 98.3%
Taylor expanded in z around inf 87.5%
unpow287.5%
Simplified87.5%
if 1.0000000000000001e302 < (*.f64 z z) Initial program 62.4%
Taylor expanded in z around inf 65.2%
unpow265.2%
*-commutative65.2%
associate-*l*82.2%
Simplified82.2%
Final simplification88.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (* y 4.0))))
(if (<= (* x x) 1.65e-81)
t_1
(if (<= (* x x) 7.2e-47)
(* -4.0 (* (* z z) y))
(if (<= (* x x) 2.35e+98) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (y * 4.0);
double tmp;
if ((x * x) <= 1.65e-81) {
tmp = t_1;
} else if ((x * x) <= 7.2e-47) {
tmp = -4.0 * ((z * z) * y);
} else if ((x * x) <= 2.35e+98) {
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 = t * (y * 4.0d0)
if ((x * x) <= 1.65d-81) then
tmp = t_1
else if ((x * x) <= 7.2d-47) then
tmp = (-4.0d0) * ((z * z) * y)
else if ((x * x) <= 2.35d+98) 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 = t * (y * 4.0);
double tmp;
if ((x * x) <= 1.65e-81) {
tmp = t_1;
} else if ((x * x) <= 7.2e-47) {
tmp = -4.0 * ((z * z) * y);
} else if ((x * x) <= 2.35e+98) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (y * 4.0) tmp = 0 if (x * x) <= 1.65e-81: tmp = t_1 elif (x * x) <= 7.2e-47: tmp = -4.0 * ((z * z) * y) elif (x * x) <= 2.35e+98: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(y * 4.0)) tmp = 0.0 if (Float64(x * x) <= 1.65e-81) tmp = t_1; elseif (Float64(x * x) <= 7.2e-47) tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); elseif (Float64(x * x) <= 2.35e+98) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (y * 4.0); tmp = 0.0; if ((x * x) <= 1.65e-81) tmp = t_1; elseif ((x * x) <= 7.2e-47) tmp = -4.0 * ((z * z) * y); elseif ((x * x) <= 2.35e+98) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 1.65e-81], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 7.2e-47], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2.35e+98], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;x \cdot x \leq 1.65 \cdot 10^{-81}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 7.2 \cdot 10^{-47}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{elif}\;x \cdot x \leq 2.35 \cdot 10^{+98}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.64999999999999994e-81 or 7.19999999999999982e-47 < (*.f64 x x) < 2.34999999999999985e98Initial program 88.3%
Taylor expanded in t around inf 50.3%
associate-*r*50.3%
Simplified50.3%
if 1.64999999999999994e-81 < (*.f64 x x) < 7.19999999999999982e-47Initial program 99.8%
Taylor expanded in z around inf 75.5%
unpow275.5%
Simplified75.5%
if 2.34999999999999985e98 < (*.f64 x x) Initial program 87.4%
Taylor expanded in x around inf 87.2%
unpow287.2%
Simplified87.2%
Final simplification66.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+302) (+ (* 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) <= 1e+302) {
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) <= 1d+302) 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) <= 1e+302) {
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) <= 1e+302: 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) <= 1e+302) 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) <= 1e+302) 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], 1e+302], 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 10^{+302}:\\
\;\;\;\;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) < 1.0000000000000001e302Initial program 98.3%
if 1.0000000000000001e302 < (*.f64 z z) Initial program 62.4%
Taylor expanded in z around inf 65.2%
unpow265.2%
*-commutative65.2%
associate-*l*82.2%
Simplified82.2%
Final simplification93.8%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 2.75e+109) (* (- (* z z) t) (* y -4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2.75e+109) {
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.75d+109) 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.75e+109) {
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.75e+109: 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.75e+109) 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.75e+109) 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.75e+109], 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.75 \cdot 10^{+109}:\\
\;\;\;\;\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.7499999999999999e109Initial program 88.4%
Taylor expanded in x around 0 79.6%
*-commutative79.6%
*-commutative79.6%
unpow279.6%
*-commutative79.6%
associate-*l*79.6%
Simplified79.6%
if 2.7499999999999999e109 < (*.f64 x x) Initial program 88.2%
Taylor expanded in x around inf 88.0%
unpow288.0%
Simplified88.0%
Final simplification82.9%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 8e+87) (* (- (* z z) t) (* y -4.0)) (- (* x x) (* t (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 8e+87) {
tmp = ((z * z) - t) * (y * -4.0);
} else {
tmp = (x * x) - (t * (y * -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 ((x * x) <= 8d+87) then
tmp = ((z * z) - t) * (y * (-4.0d0))
else
tmp = (x * x) - (t * (y * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 8e+87) {
tmp = ((z * z) - t) * (y * -4.0);
} else {
tmp = (x * x) - (t * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 8e+87: tmp = ((z * z) - t) * (y * -4.0) else: tmp = (x * x) - (t * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 8e+87) tmp = Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0)); else tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 8e+87) tmp = ((z * z) - t) * (y * -4.0); else tmp = (x * x) - (t * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 8e+87], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 8 \cdot 10^{+87}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 7.9999999999999997e87Initial program 89.3%
Taylor expanded in x around 0 80.1%
*-commutative80.1%
*-commutative80.1%
unpow280.1%
*-commutative80.1%
associate-*l*80.1%
Simplified80.1%
if 7.9999999999999997e87 < (*.f64 x x) Initial program 87.0%
Taylor expanded in z around 0 90.4%
associate-*r*90.4%
Simplified90.4%
Final simplification84.4%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 6.1e+97) (* t (* y 4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 6.1e+97) {
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) <= 6.1d+97) 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) <= 6.1e+97) {
tmp = t * (y * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 6.1e+97: tmp = t * (y * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 6.1e+97) 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) <= 6.1e+97) 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], 6.1e+97], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 6.1 \cdot 10^{+97}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 6.1e97Initial program 88.9%
Taylor expanded in t around inf 48.4%
associate-*r*48.4%
Simplified48.4%
if 6.1e97 < (*.f64 x x) Initial program 87.4%
Taylor expanded in x around inf 87.2%
unpow287.2%
Simplified87.2%
Final simplification64.0%
(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 88.3%
Taylor expanded in x around inf 42.3%
unpow242.3%
Simplified42.3%
Final simplification42.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 2023244
(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))))