
(FPCore (e v) :precision binary64 (/ (* e (sin v)) (+ 1.0 (* e (cos v)))))
double code(double e, double v) {
return (e * sin(v)) / (1.0 + (e * cos(v)));
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = (e * sin(v)) / (1.0d0 + (e * cos(v)))
end function
public static double code(double e, double v) {
return (e * Math.sin(v)) / (1.0 + (e * Math.cos(v)));
}
def code(e, v): return (e * math.sin(v)) / (1.0 + (e * math.cos(v)))
function code(e, v) return Float64(Float64(e * sin(v)) / Float64(1.0 + Float64(e * cos(v)))) end
function tmp = code(e, v) tmp = (e * sin(v)) / (1.0 + (e * cos(v))); end
code[e_, v_] := N[(N[(e * N[Sin[v], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(e * N[Cos[v], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e \cdot \sin v}{1 + e \cdot \cos v}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (e v) :precision binary64 (/ (* e (sin v)) (+ 1.0 (* e (cos v)))))
double code(double e, double v) {
return (e * sin(v)) / (1.0 + (e * cos(v)));
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = (e * sin(v)) / (1.0d0 + (e * cos(v)))
end function
public static double code(double e, double v) {
return (e * Math.sin(v)) / (1.0 + (e * Math.cos(v)));
}
def code(e, v): return (e * math.sin(v)) / (1.0 + (e * math.cos(v)))
function code(e, v) return Float64(Float64(e * sin(v)) / Float64(1.0 + Float64(e * cos(v)))) end
function tmp = code(e, v) tmp = (e * sin(v)) / (1.0 + (e * cos(v))); end
code[e_, v_] := N[(N[(e * N[Sin[v], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(e * N[Cos[v], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e \cdot \sin v}{1 + e \cdot \cos v}
\end{array}
(FPCore (e v) :precision binary64 (* (/ (sin v) (- 1.0 (* (* e e) (+ 0.5 (* 0.5 (cos (* v 2.0))))))) (* e (- 1.0 (* e (cos v))))))
double code(double e, double v) {
return (sin(v) / (1.0 - ((e * e) * (0.5 + (0.5 * cos((v * 2.0))))))) * (e * (1.0 - (e * cos(v))));
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = (sin(v) / (1.0d0 - ((e * e) * (0.5d0 + (0.5d0 * cos((v * 2.0d0))))))) * (e * (1.0d0 - (e * cos(v))))
end function
public static double code(double e, double v) {
return (Math.sin(v) / (1.0 - ((e * e) * (0.5 + (0.5 * Math.cos((v * 2.0))))))) * (e * (1.0 - (e * Math.cos(v))));
}
def code(e, v): return (math.sin(v) / (1.0 - ((e * e) * (0.5 + (0.5 * math.cos((v * 2.0))))))) * (e * (1.0 - (e * math.cos(v))))
function code(e, v) return Float64(Float64(sin(v) / Float64(1.0 - Float64(Float64(e * e) * Float64(0.5 + Float64(0.5 * cos(Float64(v * 2.0))))))) * Float64(e * Float64(1.0 - Float64(e * cos(v))))) end
function tmp = code(e, v) tmp = (sin(v) / (1.0 - ((e * e) * (0.5 + (0.5 * cos((v * 2.0))))))) * (e * (1.0 - (e * cos(v)))); end
code[e_, v_] := N[(N[(N[Sin[v], $MachinePrecision] / N[(1.0 - N[(N[(e * e), $MachinePrecision] * N[(0.5 + N[(0.5 * N[Cos[N[(v * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(e * N[(1.0 - N[(e * N[Cos[v], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin v}{1 - \left(e \cdot e\right) \cdot \left(0.5 + 0.5 \cdot \cos \left(v \cdot 2\right)\right)} \cdot \left(e \cdot \left(1 - e \cdot \cos v\right)\right)
\end{array}
Initial program 99.8%
associate-/l*N/A
*-commutativeN/A
flip-+N/A
associate-/r/N/A
associate-*l*N/A
*-lowering-*.f64N/A
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (e v) :precision binary64 (/ (* (sin v) e) (+ 1.0 (* e (cos v)))))
double code(double e, double v) {
return (sin(v) * e) / (1.0 + (e * cos(v)));
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = (sin(v) * e) / (1.0d0 + (e * cos(v)))
end function
public static double code(double e, double v) {
return (Math.sin(v) * e) / (1.0 + (e * Math.cos(v)));
}
def code(e, v): return (math.sin(v) * e) / (1.0 + (e * math.cos(v)))
function code(e, v) return Float64(Float64(sin(v) * e) / Float64(1.0 + Float64(e * cos(v)))) end
function tmp = code(e, v) tmp = (sin(v) * e) / (1.0 + (e * cos(v))); end
code[e_, v_] := N[(N[(N[Sin[v], $MachinePrecision] * e), $MachinePrecision] / N[(1.0 + N[(e * N[Cos[v], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin v \cdot e}{1 + e \cdot \cos v}
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (e v) :precision binary64 (/ e (/ (+ 1.0 (* e (cos v))) (sin v))))
double code(double e, double v) {
return e / ((1.0 + (e * cos(v))) / sin(v));
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = e / ((1.0d0 + (e * cos(v))) / sin(v))
end function
public static double code(double e, double v) {
return e / ((1.0 + (e * Math.cos(v))) / Math.sin(v));
}
def code(e, v): return e / ((1.0 + (e * math.cos(v))) / math.sin(v))
function code(e, v) return Float64(e / Float64(Float64(1.0 + Float64(e * cos(v))) / sin(v))) end
function tmp = code(e, v) tmp = e / ((1.0 + (e * cos(v))) / sin(v)); end
code[e_, v_] := N[(e / N[(N[(1.0 + N[(e * N[Cos[v], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[v], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e}{\frac{1 + e \cdot \cos v}{\sin v}}
\end{array}
Initial program 99.8%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
(FPCore (e v) :precision binary64 (/ (sin v) (+ (cos v) (/ 1.0 e))))
double code(double e, double v) {
return sin(v) / (cos(v) + (1.0 / e));
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = sin(v) / (cos(v) + (1.0d0 / e))
end function
public static double code(double e, double v) {
return Math.sin(v) / (Math.cos(v) + (1.0 / e));
}
def code(e, v): return math.sin(v) / (math.cos(v) + (1.0 / e))
function code(e, v) return Float64(sin(v) / Float64(cos(v) + Float64(1.0 / e))) end
function tmp = code(e, v) tmp = sin(v) / (cos(v) + (1.0 / e)); end
code[e_, v_] := N[(N[Sin[v], $MachinePrecision] / N[(N[Cos[v], $MachinePrecision] + N[(1.0 / e), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin v}{\cos v + \frac{1}{e}}
\end{array}
Initial program 99.8%
Taylor expanded in v around inf
rgt-mult-inverseN/A
distribute-lft-inN/A
+-commutativeN/A
times-fracN/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-lowering-+.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f6499.6%
Simplified99.6%
Taylor expanded in v around inf
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
cos-lowering-cos.f6499.6%
Simplified99.6%
Final simplification99.6%
(FPCore (e v) :precision binary64 (if (<= v 5e-85) (/ (* v e) (+ 1.0 e)) (* (sin v) e)))
double code(double e, double v) {
double tmp;
if (v <= 5e-85) {
tmp = (v * e) / (1.0 + e);
} else {
tmp = sin(v) * e;
}
return tmp;
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
real(8) :: tmp
if (v <= 5d-85) then
tmp = (v * e) / (1.0d0 + e)
else
tmp = sin(v) * e
end if
code = tmp
end function
public static double code(double e, double v) {
double tmp;
if (v <= 5e-85) {
tmp = (v * e) / (1.0 + e);
} else {
tmp = Math.sin(v) * e;
}
return tmp;
}
def code(e, v): tmp = 0 if v <= 5e-85: tmp = (v * e) / (1.0 + e) else: tmp = math.sin(v) * e return tmp
function code(e, v) tmp = 0.0 if (v <= 5e-85) tmp = Float64(Float64(v * e) / Float64(1.0 + e)); else tmp = Float64(sin(v) * e); end return tmp end
function tmp_2 = code(e, v) tmp = 0.0; if (v <= 5e-85) tmp = (v * e) / (1.0 + e); else tmp = sin(v) * e; end tmp_2 = tmp; end
code[e_, v_] := If[LessEqual[v, 5e-85], N[(N[(v * e), $MachinePrecision] / N[(1.0 + e), $MachinePrecision]), $MachinePrecision], N[(N[Sin[v], $MachinePrecision] * e), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 5 \cdot 10^{-85}:\\
\;\;\;\;\frac{v \cdot e}{1 + e}\\
\mathbf{else}:\\
\;\;\;\;\sin v \cdot e\\
\end{array}
\end{array}
if v < 5.0000000000000002e-85Initial program 99.9%
Taylor expanded in v around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6468.5%
Simplified68.5%
if 5.0000000000000002e-85 < v Initial program 99.7%
Taylor expanded in e around 0
*-lowering-*.f64N/A
sin-lowering-sin.f6498.6%
Simplified98.6%
Final simplification76.8%
(FPCore (e v) :precision binary64 (/ (* (sin v) e) (+ 1.0 e)))
double code(double e, double v) {
return (sin(v) * e) / (1.0 + e);
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = (sin(v) * e) / (1.0d0 + e)
end function
public static double code(double e, double v) {
return (Math.sin(v) * e) / (1.0 + e);
}
def code(e, v): return (math.sin(v) * e) / (1.0 + e)
function code(e, v) return Float64(Float64(sin(v) * e) / Float64(1.0 + e)) end
function tmp = code(e, v) tmp = (sin(v) * e) / (1.0 + e); end
code[e_, v_] := N[(N[(N[Sin[v], $MachinePrecision] * e), $MachinePrecision] / N[(1.0 + e), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin v \cdot e}{1 + e}
\end{array}
Initial program 99.8%
Taylor expanded in v around 0
+-commutativeN/A
+-lowering-+.f6498.9%
Simplified98.9%
Final simplification98.9%
(FPCore (e v) :precision binary64 (* e (/ (sin v) (+ 1.0 e))))
double code(double e, double v) {
return e * (sin(v) / (1.0 + e));
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = e * (sin(v) / (1.0d0 + e))
end function
public static double code(double e, double v) {
return e * (Math.sin(v) / (1.0 + e));
}
def code(e, v): return e * (math.sin(v) / (1.0 + e))
function code(e, v) return Float64(e * Float64(sin(v) / Float64(1.0 + e))) end
function tmp = code(e, v) tmp = e * (sin(v) / (1.0 + e)); end
code[e_, v_] := N[(e * N[(N[Sin[v], $MachinePrecision] / N[(1.0 + e), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e \cdot \frac{\sin v}{1 + e}
\end{array}
Initial program 99.8%
Taylor expanded in v around 0
+-commutativeN/A
+-lowering-+.f6498.9%
Simplified98.9%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
+-lowering-+.f6498.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (e v)
:precision binary64
(let* ((t_0 (- (* 0.16666666666666666 (- -1.0 e)) (* e -0.5)))
(t_1 (+ (* e -0.5) (* (+ 1.0 e) 0.16666666666666666))))
(/
e
(/
(+
(+ 1.0 e)
(*
(* v v)
(+
t_1
(*
(* v v)
(+
(+
(+ (* e 0.041666666666666664) (* -0.16666666666666666 t_0))
(* (+ 1.0 e) -0.008333333333333333))
(*
(* v v)
(+
(* e -0.001388888888888889)
(+
(*
-0.16666666666666666
(+
(- (* -0.16666666666666666 t_1) (* e 0.041666666666666664))
(* -0.008333333333333333 (- -1.0 e))))
(-
(* 0.008333333333333333 t_0)
(+ -0.0001984126984126984 (* e -0.0001984126984126984)))))))))))
v))))
double code(double e, double v) {
double t_0 = (0.16666666666666666 * (-1.0 - e)) - (e * -0.5);
double t_1 = (e * -0.5) + ((1.0 + e) * 0.16666666666666666);
return e / (((1.0 + e) + ((v * v) * (t_1 + ((v * v) * ((((e * 0.041666666666666664) + (-0.16666666666666666 * t_0)) + ((1.0 + e) * -0.008333333333333333)) + ((v * v) * ((e * -0.001388888888888889) + ((-0.16666666666666666 * (((-0.16666666666666666 * t_1) - (e * 0.041666666666666664)) + (-0.008333333333333333 * (-1.0 - e)))) + ((0.008333333333333333 * t_0) - (-0.0001984126984126984 + (e * -0.0001984126984126984))))))))))) / v);
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
real(8) :: t_0
real(8) :: t_1
t_0 = (0.16666666666666666d0 * ((-1.0d0) - e)) - (e * (-0.5d0))
t_1 = (e * (-0.5d0)) + ((1.0d0 + e) * 0.16666666666666666d0)
code = e / (((1.0d0 + e) + ((v * v) * (t_1 + ((v * v) * ((((e * 0.041666666666666664d0) + ((-0.16666666666666666d0) * t_0)) + ((1.0d0 + e) * (-0.008333333333333333d0))) + ((v * v) * ((e * (-0.001388888888888889d0)) + (((-0.16666666666666666d0) * ((((-0.16666666666666666d0) * t_1) - (e * 0.041666666666666664d0)) + ((-0.008333333333333333d0) * ((-1.0d0) - e)))) + ((0.008333333333333333d0 * t_0) - ((-0.0001984126984126984d0) + (e * (-0.0001984126984126984d0)))))))))))) / v)
end function
public static double code(double e, double v) {
double t_0 = (0.16666666666666666 * (-1.0 - e)) - (e * -0.5);
double t_1 = (e * -0.5) + ((1.0 + e) * 0.16666666666666666);
return e / (((1.0 + e) + ((v * v) * (t_1 + ((v * v) * ((((e * 0.041666666666666664) + (-0.16666666666666666 * t_0)) + ((1.0 + e) * -0.008333333333333333)) + ((v * v) * ((e * -0.001388888888888889) + ((-0.16666666666666666 * (((-0.16666666666666666 * t_1) - (e * 0.041666666666666664)) + (-0.008333333333333333 * (-1.0 - e)))) + ((0.008333333333333333 * t_0) - (-0.0001984126984126984 + (e * -0.0001984126984126984))))))))))) / v);
}
def code(e, v): t_0 = (0.16666666666666666 * (-1.0 - e)) - (e * -0.5) t_1 = (e * -0.5) + ((1.0 + e) * 0.16666666666666666) return e / (((1.0 + e) + ((v * v) * (t_1 + ((v * v) * ((((e * 0.041666666666666664) + (-0.16666666666666666 * t_0)) + ((1.0 + e) * -0.008333333333333333)) + ((v * v) * ((e * -0.001388888888888889) + ((-0.16666666666666666 * (((-0.16666666666666666 * t_1) - (e * 0.041666666666666664)) + (-0.008333333333333333 * (-1.0 - e)))) + ((0.008333333333333333 * t_0) - (-0.0001984126984126984 + (e * -0.0001984126984126984))))))))))) / v)
function code(e, v) t_0 = Float64(Float64(0.16666666666666666 * Float64(-1.0 - e)) - Float64(e * -0.5)) t_1 = Float64(Float64(e * -0.5) + Float64(Float64(1.0 + e) * 0.16666666666666666)) return Float64(e / Float64(Float64(Float64(1.0 + e) + Float64(Float64(v * v) * Float64(t_1 + Float64(Float64(v * v) * Float64(Float64(Float64(Float64(e * 0.041666666666666664) + Float64(-0.16666666666666666 * t_0)) + Float64(Float64(1.0 + e) * -0.008333333333333333)) + Float64(Float64(v * v) * Float64(Float64(e * -0.001388888888888889) + Float64(Float64(-0.16666666666666666 * Float64(Float64(Float64(-0.16666666666666666 * t_1) - Float64(e * 0.041666666666666664)) + Float64(-0.008333333333333333 * Float64(-1.0 - e)))) + Float64(Float64(0.008333333333333333 * t_0) - Float64(-0.0001984126984126984 + Float64(e * -0.0001984126984126984))))))))))) / v)) end
function tmp = code(e, v) t_0 = (0.16666666666666666 * (-1.0 - e)) - (e * -0.5); t_1 = (e * -0.5) + ((1.0 + e) * 0.16666666666666666); tmp = e / (((1.0 + e) + ((v * v) * (t_1 + ((v * v) * ((((e * 0.041666666666666664) + (-0.16666666666666666 * t_0)) + ((1.0 + e) * -0.008333333333333333)) + ((v * v) * ((e * -0.001388888888888889) + ((-0.16666666666666666 * (((-0.16666666666666666 * t_1) - (e * 0.041666666666666664)) + (-0.008333333333333333 * (-1.0 - e)))) + ((0.008333333333333333 * t_0) - (-0.0001984126984126984 + (e * -0.0001984126984126984))))))))))) / v); end
code[e_, v_] := Block[{t$95$0 = N[(N[(0.16666666666666666 * N[(-1.0 - e), $MachinePrecision]), $MachinePrecision] - N[(e * -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(e * -0.5), $MachinePrecision] + N[(N[(1.0 + e), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, N[(e / N[(N[(N[(1.0 + e), $MachinePrecision] + N[(N[(v * v), $MachinePrecision] * N[(t$95$1 + N[(N[(v * v), $MachinePrecision] * N[(N[(N[(N[(e * 0.041666666666666664), $MachinePrecision] + N[(-0.16666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + e), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision] + N[(N[(v * v), $MachinePrecision] * N[(N[(e * -0.001388888888888889), $MachinePrecision] + N[(N[(-0.16666666666666666 * N[(N[(N[(-0.16666666666666666 * t$95$1), $MachinePrecision] - N[(e * 0.041666666666666664), $MachinePrecision]), $MachinePrecision] + N[(-0.008333333333333333 * N[(-1.0 - e), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.008333333333333333 * t$95$0), $MachinePrecision] - N[(-0.0001984126984126984 + N[(e * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(-1 - e\right) - e \cdot -0.5\\
t_1 := e \cdot -0.5 + \left(1 + e\right) \cdot 0.16666666666666666\\
\frac{e}{\frac{\left(1 + e\right) + \left(v \cdot v\right) \cdot \left(t\_1 + \left(v \cdot v\right) \cdot \left(\left(\left(e \cdot 0.041666666666666664 + -0.16666666666666666 \cdot t\_0\right) + \left(1 + e\right) \cdot -0.008333333333333333\right) + \left(v \cdot v\right) \cdot \left(e \cdot -0.001388888888888889 + \left(-0.16666666666666666 \cdot \left(\left(-0.16666666666666666 \cdot t\_1 - e \cdot 0.041666666666666664\right) + -0.008333333333333333 \cdot \left(-1 - e\right)\right) + \left(0.008333333333333333 \cdot t\_0 - \left(-0.0001984126984126984 + e \cdot -0.0001984126984126984\right)\right)\right)\right)\right)\right)}{v}}
\end{array}
\end{array}
Initial program 99.8%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
Taylor expanded in v around 0
Simplified57.8%
Final simplification57.8%
(FPCore (e v)
:precision binary64
(/
e
(/
(+
(+ 1.0 e)
(*
(* v v)
(+
(* e -0.5)
(+
(* (+ 1.0 e) 0.16666666666666666)
(*
(* v v)
(+
(+
(* e 0.041666666666666664)
(*
-0.16666666666666666
(- (* 0.16666666666666666 (- -1.0 e)) (* e -0.5))))
(* (+ 1.0 e) -0.008333333333333333)))))))
v)))
double code(double e, double v) {
return e / (((1.0 + e) + ((v * v) * ((e * -0.5) + (((1.0 + e) * 0.16666666666666666) + ((v * v) * (((e * 0.041666666666666664) + (-0.16666666666666666 * ((0.16666666666666666 * (-1.0 - e)) - (e * -0.5)))) + ((1.0 + e) * -0.008333333333333333))))))) / v);
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = e / (((1.0d0 + e) + ((v * v) * ((e * (-0.5d0)) + (((1.0d0 + e) * 0.16666666666666666d0) + ((v * v) * (((e * 0.041666666666666664d0) + ((-0.16666666666666666d0) * ((0.16666666666666666d0 * ((-1.0d0) - e)) - (e * (-0.5d0))))) + ((1.0d0 + e) * (-0.008333333333333333d0)))))))) / v)
end function
public static double code(double e, double v) {
return e / (((1.0 + e) + ((v * v) * ((e * -0.5) + (((1.0 + e) * 0.16666666666666666) + ((v * v) * (((e * 0.041666666666666664) + (-0.16666666666666666 * ((0.16666666666666666 * (-1.0 - e)) - (e * -0.5)))) + ((1.0 + e) * -0.008333333333333333))))))) / v);
}
def code(e, v): return e / (((1.0 + e) + ((v * v) * ((e * -0.5) + (((1.0 + e) * 0.16666666666666666) + ((v * v) * (((e * 0.041666666666666664) + (-0.16666666666666666 * ((0.16666666666666666 * (-1.0 - e)) - (e * -0.5)))) + ((1.0 + e) * -0.008333333333333333))))))) / v)
function code(e, v) return Float64(e / Float64(Float64(Float64(1.0 + e) + Float64(Float64(v * v) * Float64(Float64(e * -0.5) + Float64(Float64(Float64(1.0 + e) * 0.16666666666666666) + Float64(Float64(v * v) * Float64(Float64(Float64(e * 0.041666666666666664) + Float64(-0.16666666666666666 * Float64(Float64(0.16666666666666666 * Float64(-1.0 - e)) - Float64(e * -0.5)))) + Float64(Float64(1.0 + e) * -0.008333333333333333))))))) / v)) end
function tmp = code(e, v) tmp = e / (((1.0 + e) + ((v * v) * ((e * -0.5) + (((1.0 + e) * 0.16666666666666666) + ((v * v) * (((e * 0.041666666666666664) + (-0.16666666666666666 * ((0.16666666666666666 * (-1.0 - e)) - (e * -0.5)))) + ((1.0 + e) * -0.008333333333333333))))))) / v); end
code[e_, v_] := N[(e / N[(N[(N[(1.0 + e), $MachinePrecision] + N[(N[(v * v), $MachinePrecision] * N[(N[(e * -0.5), $MachinePrecision] + N[(N[(N[(1.0 + e), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] + N[(N[(v * v), $MachinePrecision] * N[(N[(N[(e * 0.041666666666666664), $MachinePrecision] + N[(-0.16666666666666666 * N[(N[(0.16666666666666666 * N[(-1.0 - e), $MachinePrecision]), $MachinePrecision] - N[(e * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + e), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e}{\frac{\left(1 + e\right) + \left(v \cdot v\right) \cdot \left(e \cdot -0.5 + \left(\left(1 + e\right) \cdot 0.16666666666666666 + \left(v \cdot v\right) \cdot \left(\left(e \cdot 0.041666666666666664 + -0.16666666666666666 \cdot \left(0.16666666666666666 \cdot \left(-1 - e\right) - e \cdot -0.5\right)\right) + \left(1 + e\right) \cdot -0.008333333333333333\right)\right)\right)}{v}}
\end{array}
Initial program 99.8%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
Taylor expanded in v around 0
/-lowering-/.f64N/A
Simplified57.7%
Final simplification57.7%
(FPCore (e v)
:precision binary64
(*
e
(/
v
(+
(+ 1.0 e)
(*
(* v v)
(+ (* e -0.5) (+ 0.16666666666666666 (* e 0.16666666666666666))))))))
double code(double e, double v) {
return e * (v / ((1.0 + e) + ((v * v) * ((e * -0.5) + (0.16666666666666666 + (e * 0.16666666666666666))))));
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = e * (v / ((1.0d0 + e) + ((v * v) * ((e * (-0.5d0)) + (0.16666666666666666d0 + (e * 0.16666666666666666d0))))))
end function
public static double code(double e, double v) {
return e * (v / ((1.0 + e) + ((v * v) * ((e * -0.5) + (0.16666666666666666 + (e * 0.16666666666666666))))));
}
def code(e, v): return e * (v / ((1.0 + e) + ((v * v) * ((e * -0.5) + (0.16666666666666666 + (e * 0.16666666666666666))))))
function code(e, v) return Float64(e * Float64(v / Float64(Float64(1.0 + e) + Float64(Float64(v * v) * Float64(Float64(e * -0.5) + Float64(0.16666666666666666 + Float64(e * 0.16666666666666666))))))) end
function tmp = code(e, v) tmp = e * (v / ((1.0 + e) + ((v * v) * ((e * -0.5) + (0.16666666666666666 + (e * 0.16666666666666666)))))); end
code[e_, v_] := N[(e * N[(v / N[(N[(1.0 + e), $MachinePrecision] + N[(N[(v * v), $MachinePrecision] * N[(N[(e * -0.5), $MachinePrecision] + N[(0.16666666666666666 + N[(e * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e \cdot \frac{v}{\left(1 + e\right) + \left(v \cdot v\right) \cdot \left(e \cdot -0.5 + \left(0.16666666666666666 + e \cdot 0.16666666666666666\right)\right)}
\end{array}
Initial program 99.8%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
Taylor expanded in v around 0
/-lowering-/.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6457.5%
Simplified57.5%
clear-numN/A
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
Applied egg-rr57.6%
Final simplification57.6%
(FPCore (e v) :precision binary64 (/ e (/ (+ (+ 1.0 e) (* (* v v) (+ (* e -0.5) 0.16666666666666666))) v)))
double code(double e, double v) {
return e / (((1.0 + e) + ((v * v) * ((e * -0.5) + 0.16666666666666666))) / v);
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = e / (((1.0d0 + e) + ((v * v) * ((e * (-0.5d0)) + 0.16666666666666666d0))) / v)
end function
public static double code(double e, double v) {
return e / (((1.0 + e) + ((v * v) * ((e * -0.5) + 0.16666666666666666))) / v);
}
def code(e, v): return e / (((1.0 + e) + ((v * v) * ((e * -0.5) + 0.16666666666666666))) / v)
function code(e, v) return Float64(e / Float64(Float64(Float64(1.0 + e) + Float64(Float64(v * v) * Float64(Float64(e * -0.5) + 0.16666666666666666))) / v)) end
function tmp = code(e, v) tmp = e / (((1.0 + e) + ((v * v) * ((e * -0.5) + 0.16666666666666666))) / v); end
code[e_, v_] := N[(e / N[(N[(N[(1.0 + e), $MachinePrecision] + N[(N[(v * v), $MachinePrecision] * N[(N[(e * -0.5), $MachinePrecision] + 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e}{\frac{\left(1 + e\right) + \left(v \cdot v\right) \cdot \left(e \cdot -0.5 + 0.16666666666666666\right)}{v}}
\end{array}
Initial program 99.8%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
Taylor expanded in v around 0
/-lowering-/.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6457.5%
Simplified57.5%
Taylor expanded in e around 0
Simplified57.5%
Final simplification57.5%
(FPCore (e v) :precision binary64 (/ e (/ (+ (+ 1.0 e) (* (* v v) (* e -0.3333333333333333))) v)))
double code(double e, double v) {
return e / (((1.0 + e) + ((v * v) * (e * -0.3333333333333333))) / v);
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = e / (((1.0d0 + e) + ((v * v) * (e * (-0.3333333333333333d0)))) / v)
end function
public static double code(double e, double v) {
return e / (((1.0 + e) + ((v * v) * (e * -0.3333333333333333))) / v);
}
def code(e, v): return e / (((1.0 + e) + ((v * v) * (e * -0.3333333333333333))) / v)
function code(e, v) return Float64(e / Float64(Float64(Float64(1.0 + e) + Float64(Float64(v * v) * Float64(e * -0.3333333333333333))) / v)) end
function tmp = code(e, v) tmp = e / (((1.0 + e) + ((v * v) * (e * -0.3333333333333333))) / v); end
code[e_, v_] := N[(e / N[(N[(N[(1.0 + e), $MachinePrecision] + N[(N[(v * v), $MachinePrecision] * N[(e * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e}{\frac{\left(1 + e\right) + \left(v \cdot v\right) \cdot \left(e \cdot -0.3333333333333333\right)}{v}}
\end{array}
Initial program 99.8%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
Taylor expanded in v around 0
/-lowering-/.f64N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6457.5%
Simplified57.5%
Taylor expanded in e around inf
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6456.9%
Simplified56.9%
Final simplification56.9%
(FPCore (e v) :precision binary64 (/ (* v e) (+ 1.0 e)))
double code(double e, double v) {
return (v * e) / (1.0 + e);
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = (v * e) / (1.0d0 + e)
end function
public static double code(double e, double v) {
return (v * e) / (1.0 + e);
}
def code(e, v): return (v * e) / (1.0 + e)
function code(e, v) return Float64(Float64(v * e) / Float64(1.0 + e)) end
function tmp = code(e, v) tmp = (v * e) / (1.0 + e); end
code[e_, v_] := N[(N[(v * e), $MachinePrecision] / N[(1.0 + e), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v \cdot e}{1 + e}
\end{array}
Initial program 99.8%
Taylor expanded in v around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6456.2%
Simplified56.2%
Final simplification56.2%
(FPCore (e v) :precision binary64 (/ e (/ (+ 1.0 e) v)))
double code(double e, double v) {
return e / ((1.0 + e) / v);
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = e / ((1.0d0 + e) / v)
end function
public static double code(double e, double v) {
return e / ((1.0 + e) / v);
}
def code(e, v): return e / ((1.0 + e) / v)
function code(e, v) return Float64(e / Float64(Float64(1.0 + e) / v)) end
function tmp = code(e, v) tmp = e / ((1.0 + e) / v); end
code[e_, v_] := N[(e / N[(N[(1.0 + e), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e}{\frac{1 + e}{v}}
\end{array}
Initial program 99.8%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6499.7%
Applied egg-rr99.7%
Taylor expanded in v around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f6456.1%
Simplified56.1%
Final simplification56.1%
(FPCore (e v) :precision binary64 (* e (* v (- 1.0 e))))
double code(double e, double v) {
return e * (v * (1.0 - e));
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = e * (v * (1.0d0 - e))
end function
public static double code(double e, double v) {
return e * (v * (1.0 - e));
}
def code(e, v): return e * (v * (1.0 - e))
function code(e, v) return Float64(e * Float64(v * Float64(1.0 - e))) end
function tmp = code(e, v) tmp = e * (v * (1.0 - e)); end
code[e_, v_] := N[(e * N[(v * N[(1.0 - e), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e \cdot \left(v \cdot \left(1 - e\right)\right)
\end{array}
Initial program 99.8%
Taylor expanded in v around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6456.2%
Simplified56.2%
Taylor expanded in e around 0
+-commutativeN/A
remove-double-negN/A
mul-1-negN/A
sub-negN/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
neg-mul-1N/A
sub-negN/A
*-lowering-*.f64N/A
--lowering--.f6455.1%
Simplified55.1%
(FPCore (e v) :precision binary64 (* v e))
double code(double e, double v) {
return v * e;
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = v * e
end function
public static double code(double e, double v) {
return v * e;
}
def code(e, v): return v * e
function code(e, v) return Float64(v * e) end
function tmp = code(e, v) tmp = v * e; end
code[e_, v_] := N[(v * e), $MachinePrecision]
\begin{array}{l}
\\
v \cdot e
\end{array}
Initial program 99.8%
Taylor expanded in v around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6456.2%
Simplified56.2%
Taylor expanded in e around 0
*-lowering-*.f6454.5%
Simplified54.5%
Final simplification54.5%
(FPCore (e v) :precision binary64 v)
double code(double e, double v) {
return v;
}
real(8) function code(e, v)
real(8), intent (in) :: e
real(8), intent (in) :: v
code = v
end function
public static double code(double e, double v) {
return v;
}
def code(e, v): return v
function code(e, v) return v end
function tmp = code(e, v) tmp = v; end
code[e_, v_] := v
\begin{array}{l}
\\
v
\end{array}
Initial program 99.8%
Taylor expanded in v around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6456.2%
Simplified56.2%
Taylor expanded in e around inf
Simplified4.8%
herbie shell --seed 2024158
(FPCore (e v)
:name "Trigonometry A"
:precision binary64
:pre (and (<= 0.0 e) (<= e 1.0))
(/ (* e (sin v)) (+ 1.0 (* e (cos v)))))