
(FPCore (x y) :precision binary64 (exp (* (* x y) y)))
double code(double x, double y) {
return exp(((x * y) * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = exp(((x * y) * y))
end function
public static double code(double x, double y) {
return Math.exp(((x * y) * y));
}
def code(x, y): return math.exp(((x * y) * y))
function code(x, y) return exp(Float64(Float64(x * y) * y)) end
function tmp = code(x, y) tmp = exp(((x * y) * y)); end
code[x_, y_] := N[Exp[N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(x \cdot y\right) \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (exp (* (* x y) y)))
double code(double x, double y) {
return exp(((x * y) * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = exp(((x * y) * y))
end function
public static double code(double x, double y) {
return Math.exp(((x * y) * y));
}
def code(x, y): return math.exp(((x * y) * y))
function code(x, y) return exp(Float64(Float64(x * y) * y)) end
function tmp = code(x, y) tmp = exp(((x * y) * y)); end
code[x_, y_] := N[Exp[N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(x \cdot y\right) \cdot y}
\end{array}
(FPCore (x y) :precision binary64 (exp (* y (* x y))))
double code(double x, double y) {
return exp((y * (x * y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = exp((y * (x * y)))
end function
public static double code(double x, double y) {
return Math.exp((y * (x * y)));
}
def code(x, y): return math.exp((y * (x * y)))
function code(x, y) return exp(Float64(y * Float64(x * y))) end
function tmp = code(x, y) tmp = exp((y * (x * y))); end
code[x_, y_] := N[Exp[N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{y \cdot \left(x \cdot y\right)}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= (* y (* x y)) -20000000.0)
(/
1.0
(-
1.0
(*
x
(+
(* y y)
(*
x
(*
(* y y)
(* y (* y (+ 0.5 (* y (* (* x y) 0.16666666666666666)))))))))))
(+
1.0
(*
(* x (* y y))
(+ 1.0 (* x (* x (* 0.16666666666666666 (* y (* y (* y y)))))))))))
double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 - (x * ((y * y) + (x * ((y * y) * (y * (y * (0.5 + (y * ((x * y) * 0.16666666666666666))))))))));
} else {
tmp = 1.0 + ((x * (y * y)) * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y))))))));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y * (x * y)) <= (-20000000.0d0)) then
tmp = 1.0d0 / (1.0d0 - (x * ((y * y) + (x * ((y * y) * (y * (y * (0.5d0 + (y * ((x * y) * 0.16666666666666666d0))))))))))
else
tmp = 1.0d0 + ((x * (y * y)) * (1.0d0 + (x * (x * (0.16666666666666666d0 * (y * (y * (y * y))))))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 - (x * ((y * y) + (x * ((y * y) * (y * (y * (0.5 + (y * ((x * y) * 0.16666666666666666))))))))));
} else {
tmp = 1.0 + ((x * (y * y)) * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y))))))));
}
return tmp;
}
def code(x, y): tmp = 0 if (y * (x * y)) <= -20000000.0: tmp = 1.0 / (1.0 - (x * ((y * y) + (x * ((y * y) * (y * (y * (0.5 + (y * ((x * y) * 0.16666666666666666)))))))))) else: tmp = 1.0 + ((x * (y * y)) * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y)))))))) return tmp
function code(x, y) tmp = 0.0 if (Float64(y * Float64(x * y)) <= -20000000.0) tmp = Float64(1.0 / Float64(1.0 - Float64(x * Float64(Float64(y * y) + Float64(x * Float64(Float64(y * y) * Float64(y * Float64(y * Float64(0.5 + Float64(y * Float64(Float64(x * y) * 0.16666666666666666))))))))))); else tmp = Float64(1.0 + Float64(Float64(x * Float64(y * y)) * Float64(1.0 + Float64(x * Float64(x * Float64(0.16666666666666666 * Float64(y * Float64(y * Float64(y * y))))))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y * (x * y)) <= -20000000.0) tmp = 1.0 / (1.0 - (x * ((y * y) + (x * ((y * y) * (y * (y * (0.5 + (y * ((x * y) * 0.16666666666666666)))))))))); else tmp = 1.0 + ((x * (y * y)) * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y)))))))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision], -20000000.0], N[(1.0 / N[(1.0 - N[(x * N[(N[(y * y), $MachinePrecision] + N[(x * N[(N[(y * y), $MachinePrecision] * N[(y * N[(y * N[(0.5 + N[(y * N[(N[(x * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * N[(x * N[(0.16666666666666666 * N[(y * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(x \cdot y\right) \leq -20000000:\\
\;\;\;\;\frac{1}{1 - x \cdot \left(y \cdot y + x \cdot \left(\left(y \cdot y\right) \cdot \left(y \cdot \left(y \cdot \left(0.5 + y \cdot \left(\left(x \cdot y\right) \cdot 0.16666666666666666\right)\right)\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot \left(y \cdot y\right)\right) \cdot \left(1 + x \cdot \left(x \cdot \left(0.16666666666666666 \cdot \left(y \cdot \left(y \cdot \left(y \cdot y\right)\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x y) y) < -2e7Initial program 100.0%
Taylor expanded in x around 0
Simplified1.7%
flip-+N/A
/-lowering-/.f64N/A
Applied egg-rr0.3%
Taylor expanded in x around 0
Simplified89.5%
distribute-rgt-inN/A
*-lft-identityN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
Applied egg-rr95.5%
if -2e7 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
Simplified96.0%
Taylor expanded in x around inf
*-commutativeN/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6497.9%
Simplified97.9%
Final simplification97.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (* y y))))
(if (<= (* y (* x y)) -20000000.0)
(/
1.0
(+
1.0
(*
x
(*
(* y y)
(- -1.0 (* t_0 (+ 0.5 (* x (* (* y y) 0.16666666666666666)))))))))
(+
1.0
(*
t_0
(+ 1.0 (* x (* x (* 0.16666666666666666 (* y (* y (* y y))))))))))))
double code(double x, double y) {
double t_0 = x * (y * y);
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 + (x * ((y * y) * (-1.0 - (t_0 * (0.5 + (x * ((y * y) * 0.16666666666666666))))))));
} else {
tmp = 1.0 + (t_0 * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y))))))));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x * (y * y)
if ((y * (x * y)) <= (-20000000.0d0)) then
tmp = 1.0d0 / (1.0d0 + (x * ((y * y) * ((-1.0d0) - (t_0 * (0.5d0 + (x * ((y * y) * 0.16666666666666666d0))))))))
else
tmp = 1.0d0 + (t_0 * (1.0d0 + (x * (x * (0.16666666666666666d0 * (y * (y * (y * y))))))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (y * y);
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 + (x * ((y * y) * (-1.0 - (t_0 * (0.5 + (x * ((y * y) * 0.16666666666666666))))))));
} else {
tmp = 1.0 + (t_0 * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y))))))));
}
return tmp;
}
def code(x, y): t_0 = x * (y * y) tmp = 0 if (y * (x * y)) <= -20000000.0: tmp = 1.0 / (1.0 + (x * ((y * y) * (-1.0 - (t_0 * (0.5 + (x * ((y * y) * 0.16666666666666666)))))))) else: tmp = 1.0 + (t_0 * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y)))))))) return tmp
function code(x, y) t_0 = Float64(x * Float64(y * y)) tmp = 0.0 if (Float64(y * Float64(x * y)) <= -20000000.0) tmp = Float64(1.0 / Float64(1.0 + Float64(x * Float64(Float64(y * y) * Float64(-1.0 - Float64(t_0 * Float64(0.5 + Float64(x * Float64(Float64(y * y) * 0.16666666666666666))))))))); else tmp = Float64(1.0 + Float64(t_0 * Float64(1.0 + Float64(x * Float64(x * Float64(0.16666666666666666 * Float64(y * Float64(y * Float64(y * y))))))))); end return tmp end
function tmp_2 = code(x, y) t_0 = x * (y * y); tmp = 0.0; if ((y * (x * y)) <= -20000000.0) tmp = 1.0 / (1.0 + (x * ((y * y) * (-1.0 - (t_0 * (0.5 + (x * ((y * y) * 0.16666666666666666)))))))); else tmp = 1.0 + (t_0 * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y)))))))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision], -20000000.0], N[(1.0 / N[(1.0 + N[(x * N[(N[(y * y), $MachinePrecision] * N[(-1.0 - N[(t$95$0 * N[(0.5 + N[(x * N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(t$95$0 * N[(1.0 + N[(x * N[(x * N[(0.16666666666666666 * N[(y * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \cdot \left(x \cdot y\right) \leq -20000000:\\
\;\;\;\;\frac{1}{1 + x \cdot \left(\left(y \cdot y\right) \cdot \left(-1 - t\_0 \cdot \left(0.5 + x \cdot \left(\left(y \cdot y\right) \cdot 0.16666666666666666\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + t\_0 \cdot \left(1 + x \cdot \left(x \cdot \left(0.16666666666666666 \cdot \left(y \cdot \left(y \cdot \left(y \cdot y\right)\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x y) y) < -2e7Initial program 100.0%
Taylor expanded in x around 0
Simplified1.7%
flip-+N/A
/-lowering-/.f64N/A
Applied egg-rr0.3%
Taylor expanded in x around 0
Simplified89.5%
if -2e7 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
Simplified96.0%
Taylor expanded in x around inf
*-commutativeN/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6497.9%
Simplified97.9%
Final simplification95.8%
(FPCore (x y)
:precision binary64
(if (<= (* y (* x y)) -20000000.0)
(/ 1.0 (+ 1.0 (* (* y y) (- (* y (* y (* -0.5 (* x x)))) x))))
(+
1.0
(*
(* x (* y y))
(+ 1.0 (* x (* x (* 0.16666666666666666 (* y (* y (* y y)))))))))))
double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 + ((y * y) * ((y * (y * (-0.5 * (x * x)))) - x)));
} else {
tmp = 1.0 + ((x * (y * y)) * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y))))))));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y * (x * y)) <= (-20000000.0d0)) then
tmp = 1.0d0 / (1.0d0 + ((y * y) * ((y * (y * ((-0.5d0) * (x * x)))) - x)))
else
tmp = 1.0d0 + ((x * (y * y)) * (1.0d0 + (x * (x * (0.16666666666666666d0 * (y * (y * (y * y))))))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 + ((y * y) * ((y * (y * (-0.5 * (x * x)))) - x)));
} else {
tmp = 1.0 + ((x * (y * y)) * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y))))))));
}
return tmp;
}
def code(x, y): tmp = 0 if (y * (x * y)) <= -20000000.0: tmp = 1.0 / (1.0 + ((y * y) * ((y * (y * (-0.5 * (x * x)))) - x))) else: tmp = 1.0 + ((x * (y * y)) * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y)))))))) return tmp
function code(x, y) tmp = 0.0 if (Float64(y * Float64(x * y)) <= -20000000.0) tmp = Float64(1.0 / Float64(1.0 + Float64(Float64(y * y) * Float64(Float64(y * Float64(y * Float64(-0.5 * Float64(x * x)))) - x)))); else tmp = Float64(1.0 + Float64(Float64(x * Float64(y * y)) * Float64(1.0 + Float64(x * Float64(x * Float64(0.16666666666666666 * Float64(y * Float64(y * Float64(y * y))))))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y * (x * y)) <= -20000000.0) tmp = 1.0 / (1.0 + ((y * y) * ((y * (y * (-0.5 * (x * x)))) - x))); else tmp = 1.0 + ((x * (y * y)) * (1.0 + (x * (x * (0.16666666666666666 * (y * (y * (y * y)))))))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision], -20000000.0], N[(1.0 / N[(1.0 + N[(N[(y * y), $MachinePrecision] * N[(N[(y * N[(y * N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * N[(x * N[(0.16666666666666666 * N[(y * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(x \cdot y\right) \leq -20000000:\\
\;\;\;\;\frac{1}{1 + \left(y \cdot y\right) \cdot \left(y \cdot \left(y \cdot \left(-0.5 \cdot \left(x \cdot x\right)\right)\right) - x\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot \left(y \cdot y\right)\right) \cdot \left(1 + x \cdot \left(x \cdot \left(0.16666666666666666 \cdot \left(y \cdot \left(y \cdot \left(y \cdot y\right)\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x y) y) < -2e7Initial program 100.0%
Taylor expanded in x around 0
Simplified1.7%
flip-+N/A
/-lowering-/.f64N/A
Applied egg-rr0.3%
Taylor expanded in x around 0
Simplified89.5%
Taylor expanded in y around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6480.7%
Simplified80.7%
if -2e7 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
Simplified96.0%
Taylor expanded in x around inf
*-commutativeN/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6497.9%
Simplified97.9%
Final simplification93.6%
(FPCore (x y) :precision binary64 (if (<= (* y (* x y)) 0.002) (/ 1.0 (+ 1.0 (* x (* y (* y (- -1.0 (* x (* (* y y) 0.5)))))))) (* x (* x (* 0.5 (* y (* y (* y y))))))))
double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= 0.002) {
tmp = 1.0 / (1.0 + (x * (y * (y * (-1.0 - (x * ((y * y) * 0.5)))))));
} else {
tmp = x * (x * (0.5 * (y * (y * (y * y)))));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y * (x * y)) <= 0.002d0) then
tmp = 1.0d0 / (1.0d0 + (x * (y * (y * ((-1.0d0) - (x * ((y * y) * 0.5d0)))))))
else
tmp = x * (x * (0.5d0 * (y * (y * (y * y)))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= 0.002) {
tmp = 1.0 / (1.0 + (x * (y * (y * (-1.0 - (x * ((y * y) * 0.5)))))));
} else {
tmp = x * (x * (0.5 * (y * (y * (y * y)))));
}
return tmp;
}
def code(x, y): tmp = 0 if (y * (x * y)) <= 0.002: tmp = 1.0 / (1.0 + (x * (y * (y * (-1.0 - (x * ((y * y) * 0.5))))))) else: tmp = x * (x * (0.5 * (y * (y * (y * y))))) return tmp
function code(x, y) tmp = 0.0 if (Float64(y * Float64(x * y)) <= 0.002) tmp = Float64(1.0 / Float64(1.0 + Float64(x * Float64(y * Float64(y * Float64(-1.0 - Float64(x * Float64(Float64(y * y) * 0.5)))))))); else tmp = Float64(x * Float64(x * Float64(0.5 * Float64(y * Float64(y * Float64(y * y)))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y * (x * y)) <= 0.002) tmp = 1.0 / (1.0 + (x * (y * (y * (-1.0 - (x * ((y * y) * 0.5))))))); else tmp = x * (x * (0.5 * (y * (y * (y * y))))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision], 0.002], N[(1.0 / N[(1.0 + N[(x * N[(y * N[(y * N[(-1.0 - N[(x * N[(N[(y * y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(x * N[(0.5 * N[(y * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(x \cdot y\right) \leq 0.002:\\
\;\;\;\;\frac{1}{1 + x \cdot \left(y \cdot \left(y \cdot \left(-1 - x \cdot \left(\left(y \cdot y\right) \cdot 0.5\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \left(0.5 \cdot \left(y \cdot \left(y \cdot \left(y \cdot y\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x y) y) < 2e-3Initial program 100.0%
Taylor expanded in x around 0
Simplified69.1%
flip-+N/A
/-lowering-/.f64N/A
Applied egg-rr68.6%
Taylor expanded in x around 0
Simplified96.1%
Taylor expanded in y around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6492.9%
Simplified92.9%
if 2e-3 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-inN/A
Simplified81.8%
Taylor expanded in x around inf
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
unpow2N/A
unpow3N/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
unpow2N/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
Simplified90.9%
Final simplification92.5%
(FPCore (x y) :precision binary64 (if (<= (* y (* x y)) -20000000.0) (/ 1.0 (+ 1.0 (* (* y y) (- (* y (* y (* -0.5 (* x x)))) x)))) (+ 1.0 (* y (* (* x y) (+ 1.0 (* x (* y (/ y 2.0)))))))))
double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 + ((y * y) * ((y * (y * (-0.5 * (x * x)))) - x)));
} else {
tmp = 1.0 + (y * ((x * y) * (1.0 + (x * (y * (y / 2.0))))));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y * (x * y)) <= (-20000000.0d0)) then
tmp = 1.0d0 / (1.0d0 + ((y * y) * ((y * (y * ((-0.5d0) * (x * x)))) - x)))
else
tmp = 1.0d0 + (y * ((x * y) * (1.0d0 + (x * (y * (y / 2.0d0))))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 + ((y * y) * ((y * (y * (-0.5 * (x * x)))) - x)));
} else {
tmp = 1.0 + (y * ((x * y) * (1.0 + (x * (y * (y / 2.0))))));
}
return tmp;
}
def code(x, y): tmp = 0 if (y * (x * y)) <= -20000000.0: tmp = 1.0 / (1.0 + ((y * y) * ((y * (y * (-0.5 * (x * x)))) - x))) else: tmp = 1.0 + (y * ((x * y) * (1.0 + (x * (y * (y / 2.0)))))) return tmp
function code(x, y) tmp = 0.0 if (Float64(y * Float64(x * y)) <= -20000000.0) tmp = Float64(1.0 / Float64(1.0 + Float64(Float64(y * y) * Float64(Float64(y * Float64(y * Float64(-0.5 * Float64(x * x)))) - x)))); else tmp = Float64(1.0 + Float64(y * Float64(Float64(x * y) * Float64(1.0 + Float64(x * Float64(y * Float64(y / 2.0))))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y * (x * y)) <= -20000000.0) tmp = 1.0 / (1.0 + ((y * y) * ((y * (y * (-0.5 * (x * x)))) - x))); else tmp = 1.0 + (y * ((x * y) * (1.0 + (x * (y * (y / 2.0)))))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision], -20000000.0], N[(1.0 / N[(1.0 + N[(N[(y * y), $MachinePrecision] * N[(N[(y * N[(y * N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(x * y), $MachinePrecision] * N[(1.0 + N[(x * N[(y * N[(y / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(x \cdot y\right) \leq -20000000:\\
\;\;\;\;\frac{1}{1 + \left(y \cdot y\right) \cdot \left(y \cdot \left(y \cdot \left(-0.5 \cdot \left(x \cdot x\right)\right)\right) - x\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \left(\left(x \cdot y\right) \cdot \left(1 + x \cdot \left(y \cdot \frac{y}{2}\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x y) y) < -2e7Initial program 100.0%
Taylor expanded in x around 0
Simplified1.7%
flip-+N/A
/-lowering-/.f64N/A
Applied egg-rr0.3%
Taylor expanded in x around 0
Simplified89.5%
Taylor expanded in y around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6480.7%
Simplified80.7%
if -2e7 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-inN/A
Simplified94.8%
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
associate-*l*N/A
metadata-evalN/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6495.3%
Applied egg-rr95.3%
Final simplification91.6%
(FPCore (x y) :precision binary64 (if (<= (* y (* x y)) 0.002) (/ 1.0 (- 1.0 (* x (* y y)))) (* x (* x (* 0.5 (* y (* y (* y y))))))))
double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= 0.002) {
tmp = 1.0 / (1.0 - (x * (y * y)));
} else {
tmp = x * (x * (0.5 * (y * (y * (y * y)))));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y * (x * y)) <= 0.002d0) then
tmp = 1.0d0 / (1.0d0 - (x * (y * y)))
else
tmp = x * (x * (0.5d0 * (y * (y * (y * y)))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= 0.002) {
tmp = 1.0 / (1.0 - (x * (y * y)));
} else {
tmp = x * (x * (0.5 * (y * (y * (y * y)))));
}
return tmp;
}
def code(x, y): tmp = 0 if (y * (x * y)) <= 0.002: tmp = 1.0 / (1.0 - (x * (y * y))) else: tmp = x * (x * (0.5 * (y * (y * (y * y))))) return tmp
function code(x, y) tmp = 0.0 if (Float64(y * Float64(x * y)) <= 0.002) tmp = Float64(1.0 / Float64(1.0 - Float64(x * Float64(y * y)))); else tmp = Float64(x * Float64(x * Float64(0.5 * Float64(y * Float64(y * Float64(y * y)))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y * (x * y)) <= 0.002) tmp = 1.0 / (1.0 - (x * (y * y))); else tmp = x * (x * (0.5 * (y * (y * (y * y))))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision], 0.002], N[(1.0 / N[(1.0 - N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(x * N[(0.5 * N[(y * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(x \cdot y\right) \leq 0.002:\\
\;\;\;\;\frac{1}{1 - x \cdot \left(y \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \left(0.5 \cdot \left(y \cdot \left(y \cdot \left(y \cdot y\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x y) y) < 2e-3Initial program 100.0%
Taylor expanded in x around 0
Simplified69.1%
flip-+N/A
/-lowering-/.f64N/A
Applied egg-rr68.6%
Taylor expanded in x around 0
Simplified96.1%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6486.4%
Simplified86.4%
if 2e-3 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-inN/A
Simplified81.8%
Taylor expanded in x around inf
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
unpow2N/A
unpow3N/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
unpow2N/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
Simplified90.9%
Final simplification87.4%
(FPCore (x y) :precision binary64 (let* ((t_0 (* x (* y y)))) (if (<= (* y (* x y)) -20000000.0) (/ 1.0 (- 1.0 t_0)) (+ 1.0 t_0))))
double code(double x, double y) {
double t_0 = x * (y * y);
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 - t_0);
} else {
tmp = 1.0 + t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x * (y * y)
if ((y * (x * y)) <= (-20000000.0d0)) then
tmp = 1.0d0 / (1.0d0 - t_0)
else
tmp = 1.0d0 + t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (y * y);
double tmp;
if ((y * (x * y)) <= -20000000.0) {
tmp = 1.0 / (1.0 - t_0);
} else {
tmp = 1.0 + t_0;
}
return tmp;
}
def code(x, y): t_0 = x * (y * y) tmp = 0 if (y * (x * y)) <= -20000000.0: tmp = 1.0 / (1.0 - t_0) else: tmp = 1.0 + t_0 return tmp
function code(x, y) t_0 = Float64(x * Float64(y * y)) tmp = 0.0 if (Float64(y * Float64(x * y)) <= -20000000.0) tmp = Float64(1.0 / Float64(1.0 - t_0)); else tmp = Float64(1.0 + t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = x * (y * y); tmp = 0.0; if ((y * (x * y)) <= -20000000.0) tmp = 1.0 / (1.0 - t_0); else tmp = 1.0 + t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision], -20000000.0], N[(1.0 / N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 + t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \cdot \left(x \cdot y\right) \leq -20000000:\\
\;\;\;\;\frac{1}{1 - t\_0}\\
\mathbf{else}:\\
\;\;\;\;1 + t\_0\\
\end{array}
\end{array}
if (*.f64 (*.f64 x y) y) < -2e7Initial program 100.0%
Taylor expanded in x around 0
Simplified1.7%
flip-+N/A
/-lowering-/.f64N/A
Applied egg-rr0.3%
Taylor expanded in x around 0
Simplified89.5%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6458.5%
Simplified58.5%
if -2e7 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6490.5%
Simplified90.5%
Final simplification82.5%
(FPCore (x y) :precision binary64 (if (<= (* y (* x y)) 0.002) 1.0 (* x (* y y))))
double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= 0.002) {
tmp = 1.0;
} else {
tmp = x * (y * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y * (x * y)) <= 0.002d0) then
tmp = 1.0d0
else
tmp = x * (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y * (x * y)) <= 0.002) {
tmp = 1.0;
} else {
tmp = x * (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y * (x * y)) <= 0.002: tmp = 1.0 else: tmp = x * (y * y) return tmp
function code(x, y) tmp = 0.0 if (Float64(y * Float64(x * y)) <= 0.002) tmp = 1.0; else tmp = Float64(x * Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y * (x * y)) <= 0.002) tmp = 1.0; else tmp = x * (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision], 0.002], 1.0, N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(x \cdot y\right) \leq 0.002:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x y) y) < 2e-3Initial program 100.0%
Applied egg-rr68.7%
if 2e-3 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.2%
Simplified67.2%
Taylor expanded in x around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.2%
Simplified67.2%
Final simplification68.4%
(FPCore (x y) :precision binary64 (+ 1.0 (* x (* y y))))
double code(double x, double y) {
return 1.0 + (x * (y * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + (x * (y * y))
end function
public static double code(double x, double y) {
return 1.0 + (x * (y * y));
}
def code(x, y): return 1.0 + (x * (y * y))
function code(x, y) return Float64(1.0 + Float64(x * Float64(y * y))) end
function tmp = code(x, y) tmp = 1.0 + (x * (y * y)); end
code[x_, y_] := N[(1.0 + N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + x \cdot \left(y \cdot y\right)
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6468.4%
Simplified68.4%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Applied egg-rr55.4%
herbie shell --seed 2024191
(FPCore (x y)
:name "Data.Random.Distribution.Normal:normalF from random-fu-0.2.6.2"
:precision binary64
(exp (* (* x y) y)))