
(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 10 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 (or (<= (* y 4.0) -1e+57) (not (<= (* y 4.0) 1e-131))) (fma x x (* (* y -4.0) (- (* z z) t))) (+ (* x x) (- (* y (* 4.0 t)) (* (* (* y 4.0) z) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((y * 4.0) <= -1e+57) || !((y * 4.0) <= 1e-131)) {
tmp = fma(x, x, ((y * -4.0) * ((z * z) - t)));
} else {
tmp = (x * x) + ((y * (4.0 * t)) - (((y * 4.0) * z) * z));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((Float64(y * 4.0) <= -1e+57) || !(Float64(y * 4.0) <= 1e-131)) tmp = fma(x, x, Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t))); else tmp = Float64(Float64(x * x) + Float64(Float64(y * Float64(4.0 * t)) - Float64(Float64(Float64(y * 4.0) * z) * z))); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y * 4.0), $MachinePrecision], -1e+57], N[Not[LessEqual[N[(y * 4.0), $MachinePrecision], 1e-131]], $MachinePrecision]], N[(x * x + N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(y * 4.0), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 4 \leq -1 \cdot 10^{+57} \lor \neg \left(y \cdot 4 \leq 10^{-131}\right):\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + \left(y \cdot \left(4 \cdot t\right) - \left(\left(y \cdot 4\right) \cdot z\right) \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 y 4) < -1.00000000000000005e57 or 9.9999999999999999e-132 < (*.f64 y 4) Initial program 94.9%
fma-neg99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
distribute-rgt-neg-in99.3%
metadata-eval99.3%
Simplified99.3%
if -1.00000000000000005e57 < (*.f64 y 4) < 9.9999999999999999e-132Initial program 86.1%
sub-neg86.1%
distribute-rgt-in86.1%
fma-def86.1%
Applied egg-rr86.1%
fma-udef86.1%
distribute-lft-neg-out86.1%
unsub-neg86.1%
associate-*l*99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
Applied egg-rr99.9%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z z) t)))
(if (<= (* (* y 4.0) t_1) 2e+190)
(+ (* x x) (* (* y 4.0) (- t (* z z))))
(* (* y -4.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (((y * 4.0) * t_1) <= 2e+190) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (y * -4.0) * 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 = (z * z) - t
if (((y * 4.0d0) * t_1) <= 2d+190) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (y * (-4.0d0)) * t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (((y * 4.0) * t_1) <= 2e+190) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (y * -4.0) * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * z) - t tmp = 0 if ((y * 4.0) * t_1) <= 2e+190: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (y * -4.0) * t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * z) - t) tmp = 0.0 if (Float64(Float64(y * 4.0) * t_1) <= 2e+190) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(y * -4.0) * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * z) - t; tmp = 0.0; if (((y * 4.0) * t_1) <= 2e+190) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (y * -4.0) * t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[N[(N[(y * 4.0), $MachinePrecision] * t$95$1), $MachinePrecision], 2e+190], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * -4.0), $MachinePrecision] * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot z - t\\
\mathbf{if}\;\left(y \cdot 4\right) \cdot t_1 \leq 2 \cdot 10^{+190}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot -4\right) \cdot t_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 4) (-.f64 (*.f64 z z) t)) < 2.0000000000000001e190Initial program 96.6%
if 2.0000000000000001e190 < (*.f64 (*.f64 y 4) (-.f64 (*.f64 z z) t)) Initial program 70.7%
Taylor expanded in x around 0 81.2%
associate-*r*81.2%
unpow281.2%
*-commutative81.2%
*-commutative81.2%
Simplified81.2%
Final simplification93.2%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 6.6e+78)
(- (* x x) (* y (* t -4.0)))
(if (<= (* z z) 1.55e+300)
(- (* x x) (* (* y 4.0) (* z z)))
(* (* y -4.0) (- (* z z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 6.6e+78) {
tmp = (x * x) - (y * (t * -4.0));
} else if ((z * z) <= 1.55e+300) {
tmp = (x * x) - ((y * 4.0) * (z * z));
} else {
tmp = (y * -4.0) * ((z * z) - 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 ((z * z) <= 6.6d+78) then
tmp = (x * x) - (y * (t * (-4.0d0)))
else if ((z * z) <= 1.55d+300) then
tmp = (x * x) - ((y * 4.0d0) * (z * z))
else
tmp = (y * (-4.0d0)) * ((z * z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 6.6e+78) {
tmp = (x * x) - (y * (t * -4.0));
} else if ((z * z) <= 1.55e+300) {
tmp = (x * x) - ((y * 4.0) * (z * z));
} else {
tmp = (y * -4.0) * ((z * z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 6.6e+78: tmp = (x * x) - (y * (t * -4.0)) elif (z * z) <= 1.55e+300: tmp = (x * x) - ((y * 4.0) * (z * z)) else: tmp = (y * -4.0) * ((z * z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 6.6e+78) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); elseif (Float64(z * z) <= 1.55e+300) tmp = Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(z * z))); else tmp = Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 6.6e+78) tmp = (x * x) - (y * (t * -4.0)); elseif ((z * z) <= 1.55e+300) tmp = (x * x) - ((y * 4.0) * (z * z)); else tmp = (y * -4.0) * ((z * z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 6.6e+78], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1.55e+300], N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 6.6 \cdot 10^{+78}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{elif}\;z \cdot z \leq 1.55 \cdot 10^{+300}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 6.6e78Initial program 97.9%
Taylor expanded in z around 0 93.5%
associate-*r*93.5%
Simplified93.5%
if 6.6e78 < (*.f64 z z) < 1.5499999999999999e300Initial program 99.8%
Taylor expanded in z around inf 92.4%
unpow292.4%
Simplified92.4%
if 1.5499999999999999e300 < (*.f64 z z) Initial program 70.1%
Taylor expanded in x around 0 76.0%
associate-*r*76.0%
unpow276.0%
*-commutative76.0%
*-commutative76.0%
Simplified76.0%
Final simplification88.7%
(FPCore (x y z t)
:precision binary64
(if (or (<= (* x x) 2.35e-63)
(and (not (<= (* x x) 6.5e+31)) (<= (* x x) 4.7e+60)))
(* 4.0 (* y t))
(* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * x) <= 2.35e-63) || (!((x * x) <= 6.5e+31) && ((x * x) <= 4.7e+60))) {
tmp = 4.0 * (y * 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 * x) <= 2.35d-63) .or. (.not. ((x * x) <= 6.5d+31)) .and. ((x * x) <= 4.7d+60)) then
tmp = 4.0d0 * (y * 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 * x) <= 2.35e-63) || (!((x * x) <= 6.5e+31) && ((x * x) <= 4.7e+60))) {
tmp = 4.0 * (y * t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x * x) <= 2.35e-63) or (not ((x * x) <= 6.5e+31) and ((x * x) <= 4.7e+60)): tmp = 4.0 * (y * t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x * x) <= 2.35e-63) || (!(Float64(x * x) <= 6.5e+31) && (Float64(x * x) <= 4.7e+60))) tmp = Float64(4.0 * Float64(y * t)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x * x) <= 2.35e-63) || (~(((x * x) <= 6.5e+31)) && ((x * x) <= 4.7e+60))) tmp = 4.0 * (y * t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 2.35e-63], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 6.5e+31]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 4.7e+60]]], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2.35 \cdot 10^{-63} \lor \neg \left(x \cdot x \leq 6.5 \cdot 10^{+31}\right) \land x \cdot x \leq 4.7 \cdot 10^{+60}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 2.35e-63 or 6.5000000000000004e31 < (*.f64 x x) < 4.6999999999999998e60Initial program 91.8%
Taylor expanded in t around inf 46.5%
*-commutative46.5%
Simplified46.5%
if 2.35e-63 < (*.f64 x x) < 6.5000000000000004e31 or 4.6999999999999998e60 < (*.f64 x x) Initial program 90.0%
Taylor expanded in x around inf 71.4%
unpow271.4%
Simplified71.4%
Final simplification60.0%
(FPCore (x y z t)
:precision binary64
(if (<= (* x x) 1.2e-63)
(* y (* 4.0 t))
(if (or (<= (* x x) 8.2e+31) (not (<= (* x x) 4.5e+60)))
(* x x)
(* 4.0 (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1.2e-63) {
tmp = y * (4.0 * t);
} else if (((x * x) <= 8.2e+31) || !((x * x) <= 4.5e+60)) {
tmp = x * x;
} else {
tmp = 4.0 * (y * 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 ((x * x) <= 1.2d-63) then
tmp = y * (4.0d0 * t)
else if (((x * x) <= 8.2d+31) .or. (.not. ((x * x) <= 4.5d+60))) then
tmp = x * x
else
tmp = 4.0d0 * (y * t)
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-63) {
tmp = y * (4.0 * t);
} else if (((x * x) <= 8.2e+31) || !((x * x) <= 4.5e+60)) {
tmp = x * x;
} else {
tmp = 4.0 * (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1.2e-63: tmp = y * (4.0 * t) elif ((x * x) <= 8.2e+31) or not ((x * x) <= 4.5e+60): tmp = x * x else: tmp = 4.0 * (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1.2e-63) tmp = Float64(y * Float64(4.0 * t)); elseif ((Float64(x * x) <= 8.2e+31) || !(Float64(x * x) <= 4.5e+60)) tmp = Float64(x * x); else tmp = Float64(4.0 * Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 1.2e-63) tmp = y * (4.0 * t); elseif (((x * x) <= 8.2e+31) || ~(((x * x) <= 4.5e+60))) tmp = x * x; else tmp = 4.0 * (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.2e-63], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * x), $MachinePrecision], 8.2e+31], N[Not[LessEqual[N[(x * x), $MachinePrecision], 4.5e+60]], $MachinePrecision]], N[(x * x), $MachinePrecision], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.2 \cdot 10^{-63}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{elif}\;x \cdot x \leq 8.2 \cdot 10^{+31} \lor \neg \left(x \cdot x \leq 4.5 \cdot 10^{+60}\right):\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.2e-63Initial program 92.9%
Taylor expanded in t around inf 45.6%
associate-*r*45.6%
*-commutative45.6%
Simplified45.6%
if 1.2e-63 < (*.f64 x x) < 8.2000000000000003e31 or 4.50000000000000013e60 < (*.f64 x x) Initial program 90.0%
Taylor expanded in x around inf 71.4%
unpow271.4%
Simplified71.4%
if 8.2000000000000003e31 < (*.f64 x x) < 4.50000000000000013e60Initial program 79.2%
Taylor expanded in t around inf 57.2%
*-commutative57.2%
Simplified57.2%
Final simplification60.0%
(FPCore (x y z t) :precision binary64 (+ (* x x) (- (* y (* 4.0 t)) (* (* (* y 4.0) z) z))))
double code(double x, double y, double z, double t) {
return (x * x) + ((y * (4.0 * t)) - (((y * 4.0) * z) * z));
}
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 * t)) - (((y * 4.0d0) * z) * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) + ((y * (4.0 * t)) - (((y * 4.0) * z) * z));
}
def code(x, y, z, t): return (x * x) + ((y * (4.0 * t)) - (((y * 4.0) * z) * z))
function code(x, y, z, t) return Float64(Float64(x * x) + Float64(Float64(y * Float64(4.0 * t)) - Float64(Float64(Float64(y * 4.0) * z) * z))) end
function tmp = code(x, y, z, t) tmp = (x * x) + ((y * (4.0 * t)) - (((y * 4.0) * z) * z)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] + N[(N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(y * 4.0), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x + \left(y \cdot \left(4 \cdot t\right) - \left(\left(y \cdot 4\right) \cdot z\right) \cdot z\right)
\end{array}
Initial program 90.8%
sub-neg90.8%
distribute-rgt-in89.7%
fma-def89.7%
Applied egg-rr89.7%
fma-udef89.7%
distribute-lft-neg-out89.7%
unsub-neg89.7%
associate-*l*96.0%
associate-*r*96.0%
*-commutative96.0%
*-commutative96.0%
associate-*r*96.0%
*-commutative96.0%
associate-*l*96.0%
Applied egg-rr96.0%
Final simplification96.0%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 3.8e+222) (* (* y -4.0) (- (* z z) t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 3.8e+222) {
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 * x) <= 3.8d+222) 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 * x) <= 3.8e+222) {
tmp = (y * -4.0) * ((z * z) - t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 3.8e+222: tmp = (y * -4.0) * ((z * z) - t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 3.8e+222) 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 * x) <= 3.8e+222) tmp = (y * -4.0) * ((z * z) - t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 3.8e+222], 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 \cdot x \leq 3.8 \cdot 10^{+222}:\\
\;\;\;\;\left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 3.80000000000000018e222Initial program 93.2%
Taylor expanded in x around 0 76.6%
associate-*r*76.6%
unpow276.6%
*-commutative76.6%
*-commutative76.6%
Simplified76.6%
if 3.80000000000000018e222 < (*.f64 x x) Initial program 86.2%
Taylor expanded in x around inf 86.4%
unpow286.4%
Simplified86.4%
Final simplification79.9%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 4.8e+78) (* x x) (* (* z z) (* y -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4.8e+78) {
tmp = x * x;
} else {
tmp = (z * z) * (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 ((z * z) <= 4.8d+78) then
tmp = x * x
else
tmp = (z * z) * (y * (-4.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4.8e+78) {
tmp = x * x;
} else {
tmp = (z * z) * (y * -4.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 4.8e+78: tmp = x * x else: tmp = (z * z) * (y * -4.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4.8e+78) tmp = Float64(x * x); else tmp = Float64(Float64(z * z) * Float64(y * -4.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 4.8e+78) tmp = x * x; else tmp = (z * z) * (y * -4.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 4.8e+78], N[(x * x), $MachinePrecision], N[(N[(z * z), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4.8 \cdot 10^{+78}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \left(y \cdot -4\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.7999999999999997e78Initial program 97.9%
Taylor expanded in x around inf 55.9%
unpow255.9%
Simplified55.9%
if 4.7999999999999997e78 < (*.f64 z z) Initial program 81.3%
Taylor expanded in z around inf 71.4%
*-commutative71.4%
unpow271.4%
*-commutative71.4%
associate-*l*71.4%
Simplified71.4%
Final simplification62.5%
(FPCore (x y z t) :precision binary64 (if (<= z 3.2e+39) (- (* x x) (* y (* t -4.0))) (* (* y -4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.2e+39) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (y * -4.0) * ((z * z) - 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 (z <= 3.2d+39) then
tmp = (x * x) - (y * (t * (-4.0d0)))
else
tmp = (y * (-4.0d0)) * ((z * z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.2e+39) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (y * -4.0) * ((z * z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 3.2e+39: tmp = (x * x) - (y * (t * -4.0)) else: tmp = (y * -4.0) * ((z * z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 3.2e+39) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 3.2e+39) tmp = (x * x) - (y * (t * -4.0)); else tmp = (y * -4.0) * ((z * z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 3.2e+39], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.2 \cdot 10^{+39}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\\
\end{array}
\end{array}
if z < 3.19999999999999993e39Initial program 92.3%
Taylor expanded in z around 0 75.1%
associate-*r*75.1%
Simplified75.1%
if 3.19999999999999993e39 < z Initial program 85.5%
Taylor expanded in x around 0 74.6%
associate-*r*74.6%
unpow274.6%
*-commutative74.6%
*-commutative74.6%
Simplified74.6%
Final simplification75.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 90.8%
Taylor expanded in x around inf 42.2%
unpow242.2%
Simplified42.2%
Final simplification42.2%
(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 2023277
(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))))