
(FPCore (x) :precision binary64 (let* ((t_0 (sin (* x 0.5)))) (/ (* (* (/ 8.0 3.0) t_0) t_0) (sin x))))
double code(double x) {
double t_0 = sin((x * 0.5));
return (((8.0 / 3.0) * t_0) * t_0) / sin(x);
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sin((x * 0.5d0))
code = (((8.0d0 / 3.0d0) * t_0) * t_0) / sin(x)
end function
public static double code(double x) {
double t_0 = Math.sin((x * 0.5));
return (((8.0 / 3.0) * t_0) * t_0) / Math.sin(x);
}
def code(x): t_0 = math.sin((x * 0.5)) return (((8.0 / 3.0) * t_0) * t_0) / math.sin(x)
function code(x) t_0 = sin(Float64(x * 0.5)) return Float64(Float64(Float64(Float64(8.0 / 3.0) * t_0) * t_0) / sin(x)) end
function tmp = code(x) t_0 = sin((x * 0.5)); tmp = (((8.0 / 3.0) * t_0) * t_0) / sin(x); end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (let* ((t_0 (sin (* x 0.5)))) (/ (* (* (/ 8.0 3.0) t_0) t_0) (sin x))))
double code(double x) {
double t_0 = sin((x * 0.5));
return (((8.0 / 3.0) * t_0) * t_0) / sin(x);
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sin((x * 0.5d0))
code = (((8.0d0 / 3.0d0) * t_0) * t_0) / sin(x)
end function
public static double code(double x) {
double t_0 = Math.sin((x * 0.5));
return (((8.0 / 3.0) * t_0) * t_0) / Math.sin(x);
}
def code(x): t_0 = math.sin((x * 0.5)) return (((8.0 / 3.0) * t_0) * t_0) / math.sin(x)
function code(x) t_0 = sin(Float64(x * 0.5)) return Float64(Float64(Float64(Float64(8.0 / 3.0) * t_0) * t_0) / sin(x)) end
function tmp = code(x) t_0 = sin((x * 0.5)); tmp = (((8.0 / 3.0) * t_0) * t_0) / sin(x); end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x}
\end{array}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(let* ((t_0 (sin (* x_m 0.5))))
(*
x_s
(if (<= x_m 0.0005)
(/
t_0
(fma
(fma
(fma -1.6276041666666666e-5 (* x_m x_m) 0.001953125)
(* x_m x_m)
-0.09375)
(* x_m x_m)
0.75))
(/ (/ (pow t_0 2.0) (sin x_m)) 0.375)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double t_0 = sin((x_m * 0.5));
double tmp;
if (x_m <= 0.0005) {
tmp = t_0 / fma(fma(fma(-1.6276041666666666e-5, (x_m * x_m), 0.001953125), (x_m * x_m), -0.09375), (x_m * x_m), 0.75);
} else {
tmp = (pow(t_0, 2.0) / sin(x_m)) / 0.375;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) t_0 = sin(Float64(x_m * 0.5)) tmp = 0.0 if (x_m <= 0.0005) tmp = Float64(t_0 / fma(fma(fma(-1.6276041666666666e-5, Float64(x_m * x_m), 0.001953125), Float64(x_m * x_m), -0.09375), Float64(x_m * x_m), 0.75)); else tmp = Float64(Float64((t_0 ^ 2.0) / sin(x_m)) / 0.375); end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := Block[{t$95$0 = N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(x$95$s * If[LessEqual[x$95$m, 0.0005], N[(t$95$0 / N[(N[(N[(-1.6276041666666666e-5 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.001953125), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + -0.09375), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.75), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] / N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision] / 0.375), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \sin \left(x\_m \cdot 0.5\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 0.0005:\\
\;\;\;\;\frac{t\_0}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-1.6276041666666666 \cdot 10^{-5}, x\_m \cdot x\_m, 0.001953125\right), x\_m \cdot x\_m, -0.09375\right), x\_m \cdot x\_m, 0.75\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{t\_0}^{2}}{\sin x\_m}}{0.375}\\
\end{array}
\end{array}
\end{array}
if x < 5.0000000000000001e-4Initial program 69.2%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.2
Applied rewrites65.2%
if 5.0000000000000001e-4 < x Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-/.f64N/A
metadata-eval98.8
Applied rewrites98.8%
metadata-evalN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
lower-/.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
Applied rewrites99.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.3%
Final simplification72.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(let* ((t_0 (sin (* x_m 0.5))))
(*
x_s
(if (<= (/ (* (* (/ 8.0 3.0) t_0) t_0) (sin x_m)) 1e-5)
(/ t_0 0.75)
(* (* (sqrt (fma (cos x_m) -0.5 0.5)) 2.6666666666666665) 0.5)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double t_0 = sin((x_m * 0.5));
double tmp;
if (((((8.0 / 3.0) * t_0) * t_0) / sin(x_m)) <= 1e-5) {
tmp = t_0 / 0.75;
} else {
tmp = (sqrt(fma(cos(x_m), -0.5, 0.5)) * 2.6666666666666665) * 0.5;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) t_0 = sin(Float64(x_m * 0.5)) tmp = 0.0 if (Float64(Float64(Float64(Float64(8.0 / 3.0) * t_0) * t_0) / sin(x_m)) <= 1e-5) tmp = Float64(t_0 / 0.75); else tmp = Float64(Float64(sqrt(fma(cos(x_m), -0.5, 0.5)) * 2.6666666666666665) * 0.5); end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := Block[{t$95$0 = N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(x$95$s * If[LessEqual[N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision], 1e-5], N[(t$95$0 / 0.75), $MachinePrecision], N[(N[(N[Sqrt[N[(N[Cos[x$95$m], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]], $MachinePrecision] * 2.6666666666666665), $MachinePrecision] * 0.5), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \sin \left(x\_m \cdot 0.5\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x\_m} \leq 10^{-5}:\\
\;\;\;\;\frac{t\_0}{0.75}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\mathsf{fma}\left(\cos x\_m, -0.5, 0.5\right)} \cdot 2.6666666666666665\right) \cdot 0.5\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (*.f64 (/.f64 #s(literal 8 binary64) #s(literal 3 binary64)) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 x)) < 1.00000000000000008e-5Initial program 67.1%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in x around 0
Applied rewrites70.6%
if 1.00000000000000008e-5 < (/.f64 (*.f64 (*.f64 (/.f64 #s(literal 8 binary64) #s(literal 3 binary64)) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 x)) Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6498.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
lift-/.f64N/A
metadata-eval98.9
Applied rewrites98.9%
Taylor expanded in x around 0
Applied rewrites11.6%
unpow1N/A
sqr-powN/A
fabs-sqr-revN/A
sqr-powN/A
unpow1N/A
rem-sqrt-square-revN/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
remove-double-negN/A
lower-sqrt.f64N/A
lift-cos.f64N/A
cancel-sub-sign-invN/A
Applied rewrites22.2%
Final simplification57.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(let* ((t_0 (sin (* x_m 0.5))))
(*
x_s
(if (<= (/ (* (* (/ 8.0 3.0) t_0) t_0) (sin x_m)) 0.0004)
(/ t_0 0.75)
(* (* (fabs t_0) 2.6666666666666665) 0.5)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double t_0 = sin((x_m * 0.5));
double tmp;
if (((((8.0 / 3.0) * t_0) * t_0) / sin(x_m)) <= 0.0004) {
tmp = t_0 / 0.75;
} else {
tmp = (fabs(t_0) * 2.6666666666666665) * 0.5;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8) :: t_0
real(8) :: tmp
t_0 = sin((x_m * 0.5d0))
if (((((8.0d0 / 3.0d0) * t_0) * t_0) / sin(x_m)) <= 0.0004d0) then
tmp = t_0 / 0.75d0
else
tmp = (abs(t_0) * 2.6666666666666665d0) * 0.5d0
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
double t_0 = Math.sin((x_m * 0.5));
double tmp;
if (((((8.0 / 3.0) * t_0) * t_0) / Math.sin(x_m)) <= 0.0004) {
tmp = t_0 / 0.75;
} else {
tmp = (Math.abs(t_0) * 2.6666666666666665) * 0.5;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): t_0 = math.sin((x_m * 0.5)) tmp = 0 if ((((8.0 / 3.0) * t_0) * t_0) / math.sin(x_m)) <= 0.0004: tmp = t_0 / 0.75 else: tmp = (math.fabs(t_0) * 2.6666666666666665) * 0.5 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) t_0 = sin(Float64(x_m * 0.5)) tmp = 0.0 if (Float64(Float64(Float64(Float64(8.0 / 3.0) * t_0) * t_0) / sin(x_m)) <= 0.0004) tmp = Float64(t_0 / 0.75); else tmp = Float64(Float64(abs(t_0) * 2.6666666666666665) * 0.5); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m) t_0 = sin((x_m * 0.5)); tmp = 0.0; if (((((8.0 / 3.0) * t_0) * t_0) / sin(x_m)) <= 0.0004) tmp = t_0 / 0.75; else tmp = (abs(t_0) * 2.6666666666666665) * 0.5; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := Block[{t$95$0 = N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(x$95$s * If[LessEqual[N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision], 0.0004], N[(t$95$0 / 0.75), $MachinePrecision], N[(N[(N[Abs[t$95$0], $MachinePrecision] * 2.6666666666666665), $MachinePrecision] * 0.5), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \sin \left(x\_m \cdot 0.5\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x\_m} \leq 0.0004:\\
\;\;\;\;\frac{t\_0}{0.75}\\
\mathbf{else}:\\
\;\;\;\;\left(\left|t\_0\right| \cdot 2.6666666666666665\right) \cdot 0.5\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (*.f64 (/.f64 #s(literal 8 binary64) #s(literal 3 binary64)) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 x)) < 4.00000000000000019e-4Initial program 67.3%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in x around 0
Applied rewrites70.5%
if 4.00000000000000019e-4 < (/.f64 (*.f64 (*.f64 (/.f64 #s(literal 8 binary64) #s(literal 3 binary64)) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 (*.f64 x #s(literal 1/2 binary64)))) (sin.f64 x)) Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6498.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
lift-/.f64N/A
metadata-eval98.9
Applied rewrites98.9%
Taylor expanded in x around 0
Applied rewrites10.9%
unpow1N/A
sqr-powN/A
fabs-sqr-revN/A
sqr-powN/A
unpow1N/A
lower-fabs.f6421.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.7
Applied rewrites21.7%
Final simplification57.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m) :precision binary64 (let* ((t_0 (sin (* x_m 0.5)))) (* x_s (* (/ t_0 0.375) (/ t_0 (sin x_m))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double t_0 = sin((x_m * 0.5));
return x_s * ((t_0 / 0.375) * (t_0 / sin(x_m)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8) :: t_0
t_0 = sin((x_m * 0.5d0))
code = x_s * ((t_0 / 0.375d0) * (t_0 / sin(x_m)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
double t_0 = Math.sin((x_m * 0.5));
return x_s * ((t_0 / 0.375) * (t_0 / Math.sin(x_m)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): t_0 = math.sin((x_m * 0.5)) return x_s * ((t_0 / 0.375) * (t_0 / math.sin(x_m)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) t_0 = sin(Float64(x_m * 0.5)) return Float64(x_s * Float64(Float64(t_0 / 0.375) * Float64(t_0 / sin(x_m)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m) t_0 = sin((x_m * 0.5)); tmp = x_s * ((t_0 / 0.375) * (t_0 / sin(x_m))); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := Block[{t$95$0 = N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(x$95$s * N[(N[(t$95$0 / 0.375), $MachinePrecision] * N[(t$95$0 / N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \sin \left(x\_m \cdot 0.5\right)\\
x\_s \cdot \left(\frac{t\_0}{0.375} \cdot \frac{t\_0}{\sin x\_m}\right)
\end{array}
\end{array}
Initial program 75.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-/.f64N/A
metadata-eval99.1
Applied rewrites99.1%
metadata-evalN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
lower-/.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification99.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m) :precision binary64 (let* ((t_0 (sin (* x_m 0.5)))) (* x_s (* (* 2.6666666666666665 (/ t_0 (sin x_m))) t_0))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double t_0 = sin((x_m * 0.5));
return x_s * ((2.6666666666666665 * (t_0 / sin(x_m))) * t_0);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8) :: t_0
t_0 = sin((x_m * 0.5d0))
code = x_s * ((2.6666666666666665d0 * (t_0 / sin(x_m))) * t_0)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
double t_0 = Math.sin((x_m * 0.5));
return x_s * ((2.6666666666666665 * (t_0 / Math.sin(x_m))) * t_0);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): t_0 = math.sin((x_m * 0.5)) return x_s * ((2.6666666666666665 * (t_0 / math.sin(x_m))) * t_0)
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) t_0 = sin(Float64(x_m * 0.5)) return Float64(x_s * Float64(Float64(2.6666666666666665 * Float64(t_0 / sin(x_m))) * t_0)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m) t_0 = sin((x_m * 0.5)); tmp = x_s * ((2.6666666666666665 * (t_0 / sin(x_m))) * t_0); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := Block[{t$95$0 = N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(x$95$s * N[(N[(2.6666666666666665 * N[(t$95$0 / N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \sin \left(x\_m \cdot 0.5\right)\\
x\_s \cdot \left(\left(2.6666666666666665 \cdot \frac{t\_0}{\sin x\_m}\right) \cdot t\_0\right)
\end{array}
\end{array}
Initial program 75.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-/.f64N/A
metadata-eval99.1
Applied rewrites99.1%
metadata-evalN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
lower-/.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval99.2
Applied rewrites99.2%
Final simplification99.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m) :precision binary64 (let* ((t_0 (sin (* x_m 0.5)))) (* x_s (* (* (/ 2.6666666666666665 (sin x_m)) t_0) t_0))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double t_0 = sin((x_m * 0.5));
return x_s * (((2.6666666666666665 / sin(x_m)) * t_0) * t_0);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8) :: t_0
t_0 = sin((x_m * 0.5d0))
code = x_s * (((2.6666666666666665d0 / sin(x_m)) * t_0) * t_0)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
double t_0 = Math.sin((x_m * 0.5));
return x_s * (((2.6666666666666665 / Math.sin(x_m)) * t_0) * t_0);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): t_0 = math.sin((x_m * 0.5)) return x_s * (((2.6666666666666665 / math.sin(x_m)) * t_0) * t_0)
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) t_0 = sin(Float64(x_m * 0.5)) return Float64(x_s * Float64(Float64(Float64(2.6666666666666665 / sin(x_m)) * t_0) * t_0)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m) t_0 = sin((x_m * 0.5)); tmp = x_s * (((2.6666666666666665 / sin(x_m)) * t_0) * t_0); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := Block[{t$95$0 = N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(x$95$s * N[(N[(N[(2.6666666666666665 / N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \sin \left(x\_m \cdot 0.5\right)\\
x\_s \cdot \left(\left(\frac{2.6666666666666665}{\sin x\_m} \cdot t\_0\right) \cdot t\_0\right)
\end{array}
\end{array}
Initial program 75.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.2
lift-/.f64N/A
metadata-eval99.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.2
Applied rewrites99.2%
Final simplification99.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(if (<= x_m 4e-19)
(/ (* 0.25 x_m) 0.375)
(/ (pow (sin (* x_m 0.5)) 2.0) (* 0.375 (sin x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double tmp;
if (x_m <= 4e-19) {
tmp = (0.25 * x_m) / 0.375;
} else {
tmp = pow(sin((x_m * 0.5)), 2.0) / (0.375 * sin(x_m));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8) :: tmp
if (x_m <= 4d-19) then
tmp = (0.25d0 * x_m) / 0.375d0
else
tmp = (sin((x_m * 0.5d0)) ** 2.0d0) / (0.375d0 * sin(x_m))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
double tmp;
if (x_m <= 4e-19) {
tmp = (0.25 * x_m) / 0.375;
} else {
tmp = Math.pow(Math.sin((x_m * 0.5)), 2.0) / (0.375 * Math.sin(x_m));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): tmp = 0 if x_m <= 4e-19: tmp = (0.25 * x_m) / 0.375 else: tmp = math.pow(math.sin((x_m * 0.5)), 2.0) / (0.375 * math.sin(x_m)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) tmp = 0.0 if (x_m <= 4e-19) tmp = Float64(Float64(0.25 * x_m) / 0.375); else tmp = Float64((sin(Float64(x_m * 0.5)) ^ 2.0) / Float64(0.375 * sin(x_m))); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m) tmp = 0.0; if (x_m <= 4e-19) tmp = (0.25 * x_m) / 0.375; else tmp = (sin((x_m * 0.5)) ^ 2.0) / (0.375 * sin(x_m)); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * If[LessEqual[x$95$m, 4e-19], N[(N[(0.25 * x$95$m), $MachinePrecision] / 0.375), $MachinePrecision], N[(N[Power[N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[(0.375 * N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 4 \cdot 10^{-19}:\\
\;\;\;\;\frac{0.25 \cdot x\_m}{0.375}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\sin \left(x\_m \cdot 0.5\right)}^{2}}{0.375 \cdot \sin x\_m}\\
\end{array}
\end{array}
if x < 3.9999999999999999e-19Initial program 68.7%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites40.8%
Taylor expanded in x around 0
lower-*.f6464.2
Applied rewrites64.2%
if 3.9999999999999999e-19 < x Initial program 99.2%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
pow2N/A
lower-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-invN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
Applied rewrites99.2%
Final simplification72.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(if (<= x_m 5e-10)
(/ (* 0.25 x_m) 0.375)
(* (pow (sin (* x_m 0.5)) 2.0) (/ 2.6666666666666665 (sin x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double tmp;
if (x_m <= 5e-10) {
tmp = (0.25 * x_m) / 0.375;
} else {
tmp = pow(sin((x_m * 0.5)), 2.0) * (2.6666666666666665 / sin(x_m));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8) :: tmp
if (x_m <= 5d-10) then
tmp = (0.25d0 * x_m) / 0.375d0
else
tmp = (sin((x_m * 0.5d0)) ** 2.0d0) * (2.6666666666666665d0 / sin(x_m))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
double tmp;
if (x_m <= 5e-10) {
tmp = (0.25 * x_m) / 0.375;
} else {
tmp = Math.pow(Math.sin((x_m * 0.5)), 2.0) * (2.6666666666666665 / Math.sin(x_m));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): tmp = 0 if x_m <= 5e-10: tmp = (0.25 * x_m) / 0.375 else: tmp = math.pow(math.sin((x_m * 0.5)), 2.0) * (2.6666666666666665 / math.sin(x_m)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) tmp = 0.0 if (x_m <= 5e-10) tmp = Float64(Float64(0.25 * x_m) / 0.375); else tmp = Float64((sin(Float64(x_m * 0.5)) ^ 2.0) * Float64(2.6666666666666665 / sin(x_m))); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m) tmp = 0.0; if (x_m <= 5e-10) tmp = (0.25 * x_m) / 0.375; else tmp = (sin((x_m * 0.5)) ^ 2.0) * (2.6666666666666665 / sin(x_m)); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * If[LessEqual[x$95$m, 5e-10], N[(N[(0.25 * x$95$m), $MachinePrecision] / 0.375), $MachinePrecision], N[(N[Power[N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[(2.6666666666666665 / N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{0.25 \cdot x\_m}{0.375}\\
\mathbf{else}:\\
\;\;\;\;{\sin \left(x\_m \cdot 0.5\right)}^{2} \cdot \frac{2.6666666666666665}{\sin x\_m}\\
\end{array}
\end{array}
if x < 5.00000000000000031e-10Initial program 68.9%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites40.6%
Taylor expanded in x around 0
lower-*.f6464.3
Applied rewrites64.3%
if 5.00000000000000031e-10 < x Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lower-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.3
lift-/.f64N/A
metadata-eval99.3
Applied rewrites99.3%
Final simplification72.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(if (<= x_m 2e-15)
(/ (* 0.25 x_m) 0.375)
(* (/ (pow (sin (* x_m 0.5)) 2.0) (sin x_m)) 2.6666666666666665))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double tmp;
if (x_m <= 2e-15) {
tmp = (0.25 * x_m) / 0.375;
} else {
tmp = (pow(sin((x_m * 0.5)), 2.0) / sin(x_m)) * 2.6666666666666665;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8) :: tmp
if (x_m <= 2d-15) then
tmp = (0.25d0 * x_m) / 0.375d0
else
tmp = ((sin((x_m * 0.5d0)) ** 2.0d0) / sin(x_m)) * 2.6666666666666665d0
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
double tmp;
if (x_m <= 2e-15) {
tmp = (0.25 * x_m) / 0.375;
} else {
tmp = (Math.pow(Math.sin((x_m * 0.5)), 2.0) / Math.sin(x_m)) * 2.6666666666666665;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): tmp = 0 if x_m <= 2e-15: tmp = (0.25 * x_m) / 0.375 else: tmp = (math.pow(math.sin((x_m * 0.5)), 2.0) / math.sin(x_m)) * 2.6666666666666665 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) tmp = 0.0 if (x_m <= 2e-15) tmp = Float64(Float64(0.25 * x_m) / 0.375); else tmp = Float64(Float64((sin(Float64(x_m * 0.5)) ^ 2.0) / sin(x_m)) * 2.6666666666666665); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m) tmp = 0.0; if (x_m <= 2e-15) tmp = (0.25 * x_m) / 0.375; else tmp = ((sin((x_m * 0.5)) ^ 2.0) / sin(x_m)) * 2.6666666666666665; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * If[LessEqual[x$95$m, 2e-15], N[(N[(0.25 * x$95$m), $MachinePrecision] / 0.375), $MachinePrecision], N[(N[(N[Power[N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision] * 2.6666666666666665), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 2 \cdot 10^{-15}:\\
\;\;\;\;\frac{0.25 \cdot x\_m}{0.375}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\sin \left(x\_m \cdot 0.5\right)}^{2}}{\sin x\_m} \cdot 2.6666666666666665\\
\end{array}
\end{array}
if x < 2.0000000000000002e-15Initial program 68.7%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites40.8%
Taylor expanded in x around 0
lower-*.f6464.2
Applied rewrites64.2%
if 2.0000000000000002e-15 < x Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lower-pow.f6499.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.2
lift-/.f64N/A
metadata-eval99.2
Applied rewrites99.2%
Final simplification72.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(if (<= x_m 0.124)
(/
(sin (* x_m 0.5))
(fma
(fma
(fma -1.6276041666666666e-5 (* x_m x_m) 0.001953125)
(* x_m x_m)
-0.09375)
(* x_m x_m)
0.75))
(/ 1.0 (* (/ 0.375 (fma -0.5 (cos x_m) 0.5)) (sin x_m))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double tmp;
if (x_m <= 0.124) {
tmp = sin((x_m * 0.5)) / fma(fma(fma(-1.6276041666666666e-5, (x_m * x_m), 0.001953125), (x_m * x_m), -0.09375), (x_m * x_m), 0.75);
} else {
tmp = 1.0 / ((0.375 / fma(-0.5, cos(x_m), 0.5)) * sin(x_m));
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) tmp = 0.0 if (x_m <= 0.124) tmp = Float64(sin(Float64(x_m * 0.5)) / fma(fma(fma(-1.6276041666666666e-5, Float64(x_m * x_m), 0.001953125), Float64(x_m * x_m), -0.09375), Float64(x_m * x_m), 0.75)); else tmp = Float64(1.0 / Float64(Float64(0.375 / fma(-0.5, cos(x_m), 0.5)) * sin(x_m))); end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * If[LessEqual[x$95$m, 0.124], N[(N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(-1.6276041666666666e-5 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.001953125), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + -0.09375), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.75), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(0.375 / N[(-0.5 * N[Cos[x$95$m], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] * N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 0.124:\\
\;\;\;\;\frac{\sin \left(x\_m \cdot 0.5\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-1.6276041666666666 \cdot 10^{-5}, x\_m \cdot x\_m, 0.001953125\right), x\_m \cdot x\_m, -0.09375\right), x\_m \cdot x\_m, 0.75\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{0.375}{\mathsf{fma}\left(-0.5, \cos x\_m, 0.5\right)} \cdot \sin x\_m}\\
\end{array}
\end{array}
if x < 0.124Initial program 69.2%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.2
Applied rewrites65.2%
if 0.124 < x Initial program 99.2%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.0%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites98.6%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6498.8
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f6498.8
Applied rewrites98.8%
Final simplification72.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(if (<= x_m 0.124)
(/
(sin (* x_m 0.5))
(fma
(fma
(fma -1.6276041666666666e-5 (* x_m x_m) 0.001953125)
(* x_m x_m)
-0.09375)
(* x_m x_m)
0.75))
(/
1.0
(/ (sin x_m) (fma -1.3333333333333333 (cos x_m) 1.3333333333333333))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double tmp;
if (x_m <= 0.124) {
tmp = sin((x_m * 0.5)) / fma(fma(fma(-1.6276041666666666e-5, (x_m * x_m), 0.001953125), (x_m * x_m), -0.09375), (x_m * x_m), 0.75);
} else {
tmp = 1.0 / (sin(x_m) / fma(-1.3333333333333333, cos(x_m), 1.3333333333333333));
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) tmp = 0.0 if (x_m <= 0.124) tmp = Float64(sin(Float64(x_m * 0.5)) / fma(fma(fma(-1.6276041666666666e-5, Float64(x_m * x_m), 0.001953125), Float64(x_m * x_m), -0.09375), Float64(x_m * x_m), 0.75)); else tmp = Float64(1.0 / Float64(sin(x_m) / fma(-1.3333333333333333, cos(x_m), 1.3333333333333333))); end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * If[LessEqual[x$95$m, 0.124], N[(N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(-1.6276041666666666e-5 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.001953125), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + -0.09375), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.75), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sin[x$95$m], $MachinePrecision] / N[(-1.3333333333333333 * N[Cos[x$95$m], $MachinePrecision] + 1.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 0.124:\\
\;\;\;\;\frac{\sin \left(x\_m \cdot 0.5\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-1.6276041666666666 \cdot 10^{-5}, x\_m \cdot x\_m, 0.001953125\right), x\_m \cdot x\_m, -0.09375\right), x\_m \cdot x\_m, 0.75\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sin x\_m}{\mathsf{fma}\left(-1.3333333333333333, \cos x\_m, 1.3333333333333333\right)}}\\
\end{array}
\end{array}
if x < 0.124Initial program 69.2%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.2
Applied rewrites65.2%
if 0.124 < x Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-/.f64N/A
metadata-eval98.8
Applied rewrites98.8%
metadata-evalN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
lower-/.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
Applied rewrites99.1%
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval99.1
Applied rewrites99.1%
Applied rewrites98.8%
Final simplification72.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(if (<= x_m 0.124)
(/
(sin (* x_m 0.5))
(fma
(fma
(fma -1.6276041666666666e-5 (* x_m x_m) 0.001953125)
(* x_m x_m)
-0.09375)
(* x_m x_m)
0.75))
(/ (fma (cos x_m) -1.3333333333333333 1.3333333333333333) (sin x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
double tmp;
if (x_m <= 0.124) {
tmp = sin((x_m * 0.5)) / fma(fma(fma(-1.6276041666666666e-5, (x_m * x_m), 0.001953125), (x_m * x_m), -0.09375), (x_m * x_m), 0.75);
} else {
tmp = fma(cos(x_m), -1.3333333333333333, 1.3333333333333333) / sin(x_m);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) tmp = 0.0 if (x_m <= 0.124) tmp = Float64(sin(Float64(x_m * 0.5)) / fma(fma(fma(-1.6276041666666666e-5, Float64(x_m * x_m), 0.001953125), Float64(x_m * x_m), -0.09375), Float64(x_m * x_m), 0.75)); else tmp = Float64(fma(cos(x_m), -1.3333333333333333, 1.3333333333333333) / sin(x_m)); end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * If[LessEqual[x$95$m, 0.124], N[(N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(-1.6276041666666666e-5 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.001953125), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + -0.09375), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.75), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[x$95$m], $MachinePrecision] * -1.3333333333333333 + 1.3333333333333333), $MachinePrecision] / N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 0.124:\\
\;\;\;\;\frac{\sin \left(x\_m \cdot 0.5\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-1.6276041666666666 \cdot 10^{-5}, x\_m \cdot x\_m, 0.001953125\right), x\_m \cdot x\_m, -0.09375\right), x\_m \cdot x\_m, 0.75\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\cos x\_m, -1.3333333333333333, 1.3333333333333333\right)}{\sin x\_m}\\
\end{array}
\end{array}
if x < 0.124Initial program 69.2%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.2
Applied rewrites65.2%
if 0.124 < x Initial program 99.2%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.0%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites98.6%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-eval98.6
Applied rewrites98.6%
lift-*.f64N/A
lift-fma.f64N/A
flip3-+N/A
associate-*l/N/A
*-commutativeN/A
associate-*r/N/A
flip3-+N/A
distribute-lft-inN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites98.7%
Final simplification72.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(if (<= x_m 9.5)
(/
(*
(fma
(fma
(fma 0.00021081349206349207 (* x_m x_m) 0.0020833333333333333)
(* x_m x_m)
0.020833333333333332)
(* x_m x_m)
0.25)
x_m)
0.375)
(* (* (sin (fma -0.5 x_m (PI))) 2.6666666666666665) 0.5))))\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 9.5:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.00021081349206349207, x\_m \cdot x\_m, 0.0020833333333333333\right), x\_m \cdot x\_m, 0.020833333333333332\right), x\_m \cdot x\_m, 0.25\right) \cdot x\_m}{0.375}\\
\mathbf{else}:\\
\;\;\;\;\left(\sin \left(\mathsf{fma}\left(-0.5, x\_m, \mathsf{PI}\left(\right)\right)\right) \cdot 2.6666666666666665\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 9.5Initial program 69.5%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites41.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.7
Applied rewrites64.7%
if 9.5 < x Initial program 99.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-/.f64N/A
metadata-eval98.8
Applied rewrites98.8%
Taylor expanded in x around 0
Applied rewrites11.0%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
sin-+PI-revN/A
lower-sin.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-PI.f6411.3
Applied rewrites11.3%
Final simplification53.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m) :precision binary64 (* x_s (/ (sin (* x_m 0.5)) 0.75)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
return x_s * (sin((x_m * 0.5)) / 0.75);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
code = x_s * (sin((x_m * 0.5d0)) / 0.75d0)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
return x_s * (Math.sin((x_m * 0.5)) / 0.75);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): return x_s * (math.sin((x_m * 0.5)) / 0.75)
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) return Float64(x_s * Float64(sin(Float64(x_m * 0.5)) / 0.75)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m) tmp = x_s * (sin((x_m * 0.5)) / 0.75); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * N[(N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision] / 0.75), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \frac{\sin \left(x\_m \cdot 0.5\right)}{0.75}
\end{array}
Initial program 75.6%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites54.9%
Final simplification54.9%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m) :precision binary64 (* x_s (* 1.3333333333333333 (sin (* x_m 0.5)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
return x_s * (1.3333333333333333 * sin((x_m * 0.5)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
code = x_s * (1.3333333333333333d0 * sin((x_m * 0.5d0)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
return x_s * (1.3333333333333333 * Math.sin((x_m * 0.5)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): return x_s * (1.3333333333333333 * math.sin((x_m * 0.5)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) return Float64(x_s * Float64(1.3333333333333333 * sin(Float64(x_m * 0.5)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m) tmp = x_s * (1.3333333333333333 * sin((x_m * 0.5))); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * N[(1.3333333333333333 * N[Sin[N[(x$95$m * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(1.3333333333333333 \cdot \sin \left(x\_m \cdot 0.5\right)\right)
\end{array}
Initial program 75.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-/.f64N/A
metadata-eval99.1
Applied rewrites99.1%
metadata-evalN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
lower-/.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval99.2
Applied rewrites99.2%
Taylor expanded in x around 0
Applied rewrites54.7%
Final simplification54.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(/
(*
(fma
(fma
(fma 0.00021081349206349207 (* x_m x_m) 0.0020833333333333333)
(* x_m x_m)
0.020833333333333332)
(* x_m x_m)
0.25)
x_m)
0.375)))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
return x_s * ((fma(fma(fma(0.00021081349206349207, (x_m * x_m), 0.0020833333333333333), (x_m * x_m), 0.020833333333333332), (x_m * x_m), 0.25) * x_m) / 0.375);
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) return Float64(x_s * Float64(Float64(fma(fma(fma(0.00021081349206349207, Float64(x_m * x_m), 0.0020833333333333333), Float64(x_m * x_m), 0.020833333333333332), Float64(x_m * x_m), 0.25) * x_m) / 0.375)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * N[(N[(N[(N[(N[(0.00021081349206349207 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.0020833333333333333), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.020833333333333332), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.25), $MachinePrecision] * x$95$m), $MachinePrecision] / 0.375), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.00021081349206349207, x\_m \cdot x\_m, 0.0020833333333333333\right), x\_m \cdot x\_m, 0.020833333333333332\right), x\_m \cdot x\_m, 0.25\right) \cdot x\_m}{0.375}
\end{array}
Initial program 75.6%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites53.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.8
Applied rewrites51.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(/
(*
(fma
(fma 0.0020833333333333333 (* x_m x_m) 0.020833333333333332)
(* x_m x_m)
0.25)
x_m)
0.375)))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
return x_s * ((fma(fma(0.0020833333333333333, (x_m * x_m), 0.020833333333333332), (x_m * x_m), 0.25) * x_m) / 0.375);
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) return Float64(x_s * Float64(Float64(fma(fma(0.0020833333333333333, Float64(x_m * x_m), 0.020833333333333332), Float64(x_m * x_m), 0.25) * x_m) / 0.375)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * N[(N[(N[(N[(0.0020833333333333333 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.020833333333333332), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.25), $MachinePrecision] * x$95$m), $MachinePrecision] / 0.375), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0020833333333333333, x\_m \cdot x\_m, 0.020833333333333332\right), x\_m \cdot x\_m, 0.25\right) \cdot x\_m}{0.375}
\end{array}
Initial program 75.6%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites53.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.7
Applied rewrites51.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m)
:precision binary64
(*
x_s
(*
(fma
(fma
(fma 0.0005621693121693122 (* x_m x_m) 0.005555555555555556)
(* x_m x_m)
0.05555555555555555)
(* x_m x_m)
0.6666666666666666)
x_m)))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
return x_s * (fma(fma(fma(0.0005621693121693122, (x_m * x_m), 0.005555555555555556), (x_m * x_m), 0.05555555555555555), (x_m * x_m), 0.6666666666666666) * x_m);
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) return Float64(x_s * Float64(fma(fma(fma(0.0005621693121693122, Float64(x_m * x_m), 0.005555555555555556), Float64(x_m * x_m), 0.05555555555555555), Float64(x_m * x_m), 0.6666666666666666) * x_m)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * N[(N[(N[(N[(0.0005621693121693122 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.005555555555555556), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.05555555555555555), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0005621693121693122, x\_m \cdot x\_m, 0.005555555555555556\right), x\_m \cdot x\_m, 0.05555555555555555\right), x\_m \cdot x\_m, 0.6666666666666666\right) \cdot x\_m\right)
\end{array}
Initial program 75.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.5
Applied rewrites51.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m) :precision binary64 (* x_s (/ (* 0.25 x_m) 0.375)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
return x_s * ((0.25 * x_m) / 0.375);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
code = x_s * ((0.25d0 * x_m) / 0.375d0)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
return x_s * ((0.25 * x_m) / 0.375);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): return x_s * ((0.25 * x_m) / 0.375)
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) return Float64(x_s * Float64(Float64(0.25 * x_m) / 0.375)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m) tmp = x_s * ((0.25 * x_m) / 0.375); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * N[(N[(0.25 * x$95$m), $MachinePrecision] / 0.375), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \frac{0.25 \cdot x\_m}{0.375}
\end{array}
Initial program 75.6%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
clear-num-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites53.2%
Taylor expanded in x around 0
lower-*.f6451.5
Applied rewrites51.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m) :precision binary64 (* x_s (* (fma (* x_m x_m) 0.05555555555555555 0.6666666666666666) x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
return x_s * (fma((x_m * x_m), 0.05555555555555555, 0.6666666666666666) * x_m);
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) return Float64(x_s * Float64(fma(Float64(x_m * x_m), 0.05555555555555555, 0.6666666666666666) * x_m)) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.05555555555555555 + 0.6666666666666666), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.05555555555555555, 0.6666666666666666\right) \cdot x\_m\right)
\end{array}
Initial program 75.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.3
Applied rewrites51.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m) :precision binary64 (* x_s (* 0.6666666666666666 x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m) {
return x_s * (0.6666666666666666 * x_m);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
code = x_s * (0.6666666666666666d0 * x_m)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m) {
return x_s * (0.6666666666666666 * x_m);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m): return x_s * (0.6666666666666666 * x_m)
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m) return Float64(x_s * Float64(0.6666666666666666 * x_m)) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m) tmp = x_s * (0.6666666666666666 * x_m); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_] := N[(x$95$s * N[(0.6666666666666666 * x$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(0.6666666666666666 \cdot x\_m\right)
\end{array}
Initial program 75.6%
Taylor expanded in x around 0
lower-*.f6451.2
Applied rewrites51.2%
(FPCore (x) :precision binary64 (let* ((t_0 (sin (* x 0.5)))) (/ (/ (* 8.0 t_0) 3.0) (/ (sin x) t_0))))
double code(double x) {
double t_0 = sin((x * 0.5));
return ((8.0 * t_0) / 3.0) / (sin(x) / t_0);
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sin((x * 0.5d0))
code = ((8.0d0 * t_0) / 3.0d0) / (sin(x) / t_0)
end function
public static double code(double x) {
double t_0 = Math.sin((x * 0.5));
return ((8.0 * t_0) / 3.0) / (Math.sin(x) / t_0);
}
def code(x): t_0 = math.sin((x * 0.5)) return ((8.0 * t_0) / 3.0) / (math.sin(x) / t_0)
function code(x) t_0 = sin(Float64(x * 0.5)) return Float64(Float64(Float64(8.0 * t_0) / 3.0) / Float64(sin(x) / t_0)) end
function tmp = code(x) t_0 = sin((x * 0.5)); tmp = ((8.0 * t_0) / 3.0) / (sin(x) / t_0); end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(8.0 * t$95$0), $MachinePrecision] / 3.0), $MachinePrecision] / N[(N[Sin[x], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\frac{\frac{8 \cdot t\_0}{3}}{\frac{\sin x}{t\_0}}
\end{array}
\end{array}
herbie shell --seed 2024298
(FPCore (x)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, A"
:precision binary64
:alt
(! :herbie-platform default (/ (/ (* 8 (sin (* x 1/2))) 3) (/ (sin x) (sin (* x 1/2)))))
(/ (* (* (/ 8.0 3.0) (sin (* x 0.5))) (sin (* x 0.5))) (sin x)))