
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(let* ((t_0 (/ (sinh y) y)) (t_1 (* (sin x_m) t_0)))
(*
x_s
(if (<= t_1 (- INFINITY))
(*
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(fma
(fma (* y y) 0.008333333333333333 0.16666666666666666)
(* y y)
1.0))
(if (<= t_1 1.0)
(*
(sin x_m)
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0))
(* x_m t_0))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double t_0 = sinh(y) / y;
double t_1 = sin(x_m) * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m) * fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0);
} else if (t_1 <= 1.0) {
tmp = sin(x_m) * fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0);
} else {
tmp = x_m * t_0;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) t_0 = Float64(sinh(y) / y) t_1 = Float64(sin(x_m) * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m) * fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0)); elseif (t_1 <= 1.0) tmp = Float64(sin(x_m) * fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0)); else tmp = Float64(x_m * t_0); 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_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[x$95$m], $MachinePrecision] * t$95$0), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.0], N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 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 := \frac{\sinh y}{y}\\
t_1 := \sin x\_m \cdot t\_0\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;\sin x\_m \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.5
Applied rewrites73.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.5
Applied rewrites63.5%
if -inf.0 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < 1Initial program 99.9%
Taylor expanded in y around 0
+-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-*.f64100.0
Applied rewrites100.0%
if 1 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites78.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(let* ((t_0
(fma
(fma (* y y) 0.008333333333333333 0.16666666666666666)
(* y y)
1.0))
(t_1 (/ (sinh y) y))
(t_2 (* (sin x_m) t_1)))
(*
x_s
(if (<= t_2 (- INFINITY))
(* (* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m) t_0)
(if (<= t_2 1.0) (* (sin x_m) t_0) (* x_m t_1))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double t_0 = fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0);
double t_1 = sinh(y) / y;
double t_2 = sin(x_m) * t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m) * t_0;
} else if (t_2 <= 1.0) {
tmp = sin(x_m) * t_0;
} else {
tmp = x_m * t_1;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) t_0 = fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0) t_1 = Float64(sinh(y) / y) t_2 = Float64(sin(x_m) * t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m) * t_0); elseif (t_2 <= 1.0) tmp = Float64(sin(x_m) * t_0); else tmp = Float64(x_m * t_1); 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_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[x$95$m], $MachinePrecision] * t$95$1), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$2, 1.0], N[(N[Sin[x$95$m], $MachinePrecision] * t$95$0), $MachinePrecision], N[(x$95$m * t$95$1), $MachinePrecision]]]), $MachinePrecision]]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)\\
t_1 := \frac{\sinh y}{y}\\
t_2 := \sin x\_m \cdot t\_1\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot t\_0\\
\mathbf{elif}\;t\_2 \leq 1:\\
\;\;\;\;\sin x\_m \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.5
Applied rewrites73.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.5
Applied rewrites63.5%
if -inf.0 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < 1Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.8
Applied rewrites99.8%
if 1 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites78.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(let* ((t_0 (/ (sinh y) y)) (t_1 (* (sin x_m) t_0)))
(*
x_s
(if (<= t_1 (- INFINITY))
(*
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(fma
(fma (* y y) 0.008333333333333333 0.16666666666666666)
(* y y)
1.0))
(if (<= t_1 1.0)
(* (sin x_m) (fma (* y y) 0.16666666666666666 1.0))
(* x_m t_0))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double t_0 = sinh(y) / y;
double t_1 = sin(x_m) * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m) * fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0);
} else if (t_1 <= 1.0) {
tmp = sin(x_m) * fma((y * y), 0.16666666666666666, 1.0);
} else {
tmp = x_m * t_0;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) t_0 = Float64(sinh(y) / y) t_1 = Float64(sin(x_m) * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m) * fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0)); elseif (t_1 <= 1.0) tmp = Float64(sin(x_m) * fma(Float64(y * y), 0.16666666666666666, 1.0)); else tmp = Float64(x_m * t_0); 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_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[x$95$m], $MachinePrecision] * t$95$0), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.0], N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 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 := \frac{\sinh y}{y}\\
t_1 := \sin x\_m \cdot t\_0\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;\sin x\_m \cdot \mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.5
Applied rewrites73.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.5
Applied rewrites63.5%
if -inf.0 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < 1Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
if 1 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites78.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(let* ((t_0 (/ (sinh y) y)) (t_1 (* (sin x_m) t_0)))
(*
x_s
(if (<= t_1 (- INFINITY))
(*
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(fma
(fma (* y y) 0.008333333333333333 0.16666666666666666)
(* y y)
1.0))
(if (<= t_1 1.0) (sin x_m) (* x_m t_0))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double t_0 = sinh(y) / y;
double t_1 = sin(x_m) * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m) * fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0);
} else if (t_1 <= 1.0) {
tmp = sin(x_m);
} else {
tmp = x_m * t_0;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) t_0 = Float64(sinh(y) / y) t_1 = Float64(sin(x_m) * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m) * fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0)); elseif (t_1 <= 1.0) tmp = sin(x_m); else tmp = Float64(x_m * t_0); 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_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[x$95$m], $MachinePrecision] * t$95$0), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.0], N[Sin[x$95$m], $MachinePrecision], N[(x$95$m * 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 := \frac{\sinh y}{y}\\
t_1 := \sin x\_m \cdot t\_0\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;\sin x\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.5
Applied rewrites73.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.5
Applied rewrites63.5%
if -inf.0 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < 1Initial program 99.9%
Taylor expanded in y around 0
lift-sin.f6498.8
Applied rewrites98.8%
if 1 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites78.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(let* ((t_0 (* (sin x_m) (/ (sinh y) y))))
(*
x_s
(if (<= t_0 (- INFINITY))
(*
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(fma
(fma (* y y) 0.008333333333333333 0.16666666666666666)
(* y y)
1.0))
(if (<= t_0 1.0)
(sin x_m)
(*
(*
(fma
(fma (* x_m x_m) 0.008333333333333333 -0.16666666666666666)
(* x_m x_m)
1.0)
x_m)
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double t_0 = sin(x_m) * (sinh(y) / y);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m) * fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0);
} else if (t_0 <= 1.0) {
tmp = sin(x_m);
} else {
tmp = (fma(fma((x_m * x_m), 0.008333333333333333, -0.16666666666666666), (x_m * x_m), 1.0) * x_m) * fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) t_0 = Float64(sin(x_m) * Float64(sinh(y) / y)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m) * fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0)); elseif (t_0 <= 1.0) tmp = sin(x_m); else tmp = Float64(Float64(fma(fma(Float64(x_m * x_m), 0.008333333333333333, -0.16666666666666666), Float64(x_m * x_m), 1.0) * x_m) * fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0)); 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_, y_] := Block[{t$95$0 = N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[x$95$m], $MachinePrecision], N[(N[(N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $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 x\_m \cdot \frac{\sinh y}{y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin x\_m\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.008333333333333333, -0.16666666666666666\right), x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\end{array}
\end{array}
\end{array}
if (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.5
Applied rewrites73.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.5
Applied rewrites63.5%
if -inf.0 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < 1Initial program 99.9%
Taylor expanded in y around 0
lift-sin.f6498.8
Applied rewrites98.8%
if 1 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in y around 0
+-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-*.f6479.1
Applied rewrites79.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6468.8
Applied rewrites68.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(*
x_s
(if (<= (* (sin x_m) (/ (sinh y) y)) -0.04)
(*
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(fma (fma (* y y) 0.008333333333333333 0.16666666666666666) (* y y) 1.0))
(*
(*
(fma
(fma (* x_m x_m) 0.008333333333333333 -0.16666666666666666)
(* x_m x_m)
1.0)
x_m)
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double tmp;
if ((sin(x_m) * (sinh(y) / y)) <= -0.04) {
tmp = (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m) * fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0);
} else {
tmp = (fma(fma((x_m * x_m), 0.008333333333333333, -0.16666666666666666), (x_m * x_m), 1.0) * x_m) * fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) tmp = 0.0 if (Float64(sin(x_m) * Float64(sinh(y) / y)) <= -0.04) tmp = Float64(Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m) * fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0)); else tmp = Float64(Float64(fma(fma(Float64(x_m * x_m), 0.008333333333333333, -0.16666666666666666), Float64(x_m * x_m), 1.0) * x_m) * fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0)); 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_, y_] := N[(x$95$s * If[LessEqual[N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], -0.04], N[(N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $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}\;\sin x\_m \cdot \frac{\sinh y}{y} \leq -0.04:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.008333333333333333, -0.16666666666666666\right), x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\end{array}
\end{array}
if (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < -0.0400000000000000008Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.1
Applied rewrites81.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6446.2
Applied rewrites46.2%
if -0.0400000000000000008 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in y around 0
+-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-*.f6490.7
Applied rewrites90.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.9
Applied rewrites64.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(*
x_s
(if (<= (* (sin x_m) (/ (sinh y) y)) 0.001)
(*
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(fma (fma (* y y) 0.008333333333333333 0.16666666666666666) (* y y) 1.0))
(*
x_m
(fma
(fma
(* (fma (* y y) 0.0001984126984126984 0.008333333333333333) y)
y
0.16666666666666666)
(* y y)
1.0)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double tmp;
if ((sin(x_m) * (sinh(y) / y)) <= 0.001) {
tmp = (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m) * fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0);
} else {
tmp = x_m * fma(fma((fma((y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), (y * y), 1.0);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) tmp = 0.0 if (Float64(sin(x_m) * Float64(sinh(y) / y)) <= 0.001) tmp = Float64(Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m) * fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0)); else tmp = Float64(x_m * fma(fma(Float64(fma(Float64(y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), Float64(y * y), 1.0)); 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_, y_] := N[(x$95$s * If[LessEqual[N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 0.001], N[(N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $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}\;\sin x\_m \cdot \frac{\sinh y}{y} \leq 0.001:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.0001984126984126984, 0.008333333333333333\right) \cdot y, y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\end{array}
\end{array}
if (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < 1e-3Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6488.3
Applied rewrites88.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6466.2
Applied rewrites66.2%
if 1e-3 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in y around 0
+-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-*.f6485.9
Applied rewrites85.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6445.4
Applied rewrites45.4%
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6445.4
Applied rewrites45.4%
Taylor expanded in x around 0
Applied rewrites47.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(*
x_s
(if (<= (* (sin x_m) (/ (sinh y) y)) 0.001)
(*
(fma
(fma
(fma -0.0001984126984126984 (* x_m x_m) 0.008333333333333333)
(* x_m x_m)
-0.16666666666666666)
(* x_m x_m)
1.0)
x_m)
(*
x_m
(fma
(fma
(* (fma (* y y) 0.0001984126984126984 0.008333333333333333) y)
y
0.16666666666666666)
(* y y)
1.0)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double tmp;
if ((sin(x_m) * (sinh(y) / y)) <= 0.001) {
tmp = fma(fma(fma(-0.0001984126984126984, (x_m * x_m), 0.008333333333333333), (x_m * x_m), -0.16666666666666666), (x_m * x_m), 1.0) * x_m;
} else {
tmp = x_m * fma(fma((fma((y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), (y * y), 1.0);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) tmp = 0.0 if (Float64(sin(x_m) * Float64(sinh(y) / y)) <= 0.001) tmp = Float64(fma(fma(fma(-0.0001984126984126984, Float64(x_m * x_m), 0.008333333333333333), Float64(x_m * x_m), -0.16666666666666666), Float64(x_m * x_m), 1.0) * x_m); else tmp = Float64(x_m * fma(fma(Float64(fma(Float64(y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), Float64(y * y), 1.0)); 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_, y_] := N[(x$95$s * If[LessEqual[N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 0.001], N[(N[(N[(N[(-0.0001984126984126984 * N[(x$95$m * x$95$m), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision], N[(x$95$m * N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $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}\;\sin x\_m \cdot \frac{\sinh y}{y} \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, x\_m \cdot x\_m, 0.008333333333333333\right), x\_m \cdot x\_m, -0.16666666666666666\right), x\_m \cdot x\_m, 1\right) \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.0001984126984126984, 0.008333333333333333\right) \cdot y, y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\end{array}
\end{array}
if (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < 1e-3Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6456.9
Applied rewrites56.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites50.2%
if 1e-3 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in y around 0
+-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-*.f6485.9
Applied rewrites85.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6445.4
Applied rewrites45.4%
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6445.4
Applied rewrites45.4%
Taylor expanded in x around 0
Applied rewrites47.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(*
x_s
(if (<= (sin x_m) -0.04)
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(if (<= (sin x_m) 2e-5)
(* x_m (fma (* y y) 0.16666666666666666 1.0))
(*
(fma
(fma x_m (* x_m 0.008333333333333333) -0.16666666666666666)
(* x_m x_m)
1.0)
x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double tmp;
if (sin(x_m) <= -0.04) {
tmp = fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m;
} else if (sin(x_m) <= 2e-5) {
tmp = x_m * fma((y * y), 0.16666666666666666, 1.0);
} else {
tmp = fma(fma(x_m, (x_m * 0.008333333333333333), -0.16666666666666666), (x_m * x_m), 1.0) * x_m;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) tmp = 0.0 if (sin(x_m) <= -0.04) tmp = Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m); elseif (sin(x_m) <= 2e-5) tmp = Float64(x_m * fma(Float64(y * y), 0.16666666666666666, 1.0)); else tmp = Float64(fma(fma(x_m, Float64(x_m * 0.008333333333333333), -0.16666666666666666), Float64(x_m * x_m), 1.0) * 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_, y_] := N[(x$95$s * If[LessEqual[N[Sin[x$95$m], $MachinePrecision], -0.04], N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision], If[LessEqual[N[Sin[x$95$m], $MachinePrecision], 2e-5], N[(x$95$m * N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$95$m * N[(x$95$m * 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $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 \begin{array}{l}
\mathbf{if}\;\sin x\_m \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\\
\mathbf{elif}\;\sin x\_m \leq 2 \cdot 10^{-5}:\\
\;\;\;\;x\_m \cdot \mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x\_m, x\_m \cdot 0.008333333333333333, -0.16666666666666666\right), x\_m \cdot x\_m, 1\right) \cdot x\_m\\
\end{array}
\end{array}
if (sin.f64 x) < -0.0400000000000000008Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6445.4
Applied rewrites45.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.1
Applied rewrites27.1%
if -0.0400000000000000008 < (sin.f64 x) < 2.00000000000000016e-5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6472.9
Applied rewrites72.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.9
Applied rewrites72.9%
Taylor expanded in x around 0
Applied rewrites72.1%
if 2.00000000000000016e-5 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6451.5
Applied rewrites51.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6426.2
Applied rewrites26.2%
lift-*.f64N/A
lift-fma.f64N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(*
x_s
(if (<= (sin x_m) -0.04)
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(if (<= (sin x_m) 0.002)
(* x_m (fma (* y y) 0.16666666666666666 1.0))
(* (fma (* x_m (* x_m 0.008333333333333333)) (* x_m x_m) 1.0) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double tmp;
if (sin(x_m) <= -0.04) {
tmp = fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m;
} else if (sin(x_m) <= 0.002) {
tmp = x_m * fma((y * y), 0.16666666666666666, 1.0);
} else {
tmp = fma((x_m * (x_m * 0.008333333333333333)), (x_m * x_m), 1.0) * x_m;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) tmp = 0.0 if (sin(x_m) <= -0.04) tmp = Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m); elseif (sin(x_m) <= 0.002) tmp = Float64(x_m * fma(Float64(y * y), 0.16666666666666666, 1.0)); else tmp = Float64(fma(Float64(x_m * Float64(x_m * 0.008333333333333333)), Float64(x_m * x_m), 1.0) * 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_, y_] := N[(x$95$s * If[LessEqual[N[Sin[x$95$m], $MachinePrecision], -0.04], N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision], If[LessEqual[N[Sin[x$95$m], $MachinePrecision], 0.002], N[(x$95$m * N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$95$m * N[(x$95$m * 0.008333333333333333), $MachinePrecision]), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $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 \begin{array}{l}
\mathbf{if}\;\sin x\_m \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\\
\mathbf{elif}\;\sin x\_m \leq 0.002:\\
\;\;\;\;x\_m \cdot \mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot \left(x\_m \cdot 0.008333333333333333\right), x\_m \cdot x\_m, 1\right) \cdot x\_m\\
\end{array}
\end{array}
if (sin.f64 x) < -0.0400000000000000008Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6445.4
Applied rewrites45.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.1
Applied rewrites27.1%
if -0.0400000000000000008 < (sin.f64 x) < 2e-3Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6473.3
Applied rewrites73.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.3
Applied rewrites73.3%
Taylor expanded in x around 0
Applied rewrites72.0%
if 2e-3 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6450.2
Applied rewrites50.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6424.1
Applied rewrites24.1%
Taylor expanded in x around inf
pow2N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6424.1
Applied rewrites24.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6424.1
Applied rewrites24.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(*
x_s
(if (<= (* (sin x_m) (/ (sinh y) y)) 0.001)
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(* x_m (fma (* y y) 0.16666666666666666 1.0)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double tmp;
if ((sin(x_m) * (sinh(y) / y)) <= 0.001) {
tmp = fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m;
} else {
tmp = x_m * fma((y * y), 0.16666666666666666, 1.0);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) tmp = 0.0 if (Float64(sin(x_m) * Float64(sinh(y) / y)) <= 0.001) tmp = Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m); else tmp = Float64(x_m * fma(Float64(y * y), 0.16666666666666666, 1.0)); 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_, y_] := N[(x$95$s * If[LessEqual[N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 0.001], N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision], N[(x$95$m * N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $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}\;\sin x\_m \cdot \frac{\sinh y}{y} \leq 0.001:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)\\
\end{array}
\end{array}
if (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) < 1e-3Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6456.9
Applied rewrites56.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6448.9
Applied rewrites48.9%
if 1e-3 < (*.f64 (sin.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6467.6
Applied rewrites67.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6434.7
Applied rewrites34.7%
Taylor expanded in x around 0
Applied rewrites30.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y) :precision binary64 (* x_s (* (sin x_m) (/ (sinh y) y))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
return x_s * (sin(x_m) * (sinh(y) / y));
}
x\_m = private
x\_s = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_s, x_m, y)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
code = x_s * (sin(x_m) * (sinh(y) / y))
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 y) {
return x_s * (Math.sin(x_m) * (Math.sinh(y) / y));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y): return x_s * (math.sin(x_m) * (math.sinh(y) / y))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) return Float64(x_s * Float64(sin(x_m) * Float64(sinh(y) / y))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y) tmp = x_s * (sin(x_m) * (sinh(y) / y)); 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_, y_] := N[(x$95$s * N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(\sin x\_m \cdot \frac{\sinh y}{y}\right)
\end{array}
Initial program 100.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(*
x_s
(if (<= (sin x_m) 1e-7)
(*
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(fma
(fma
(* (fma (* y y) 0.0001984126984126984 0.008333333333333333) y)
y
0.16666666666666666)
(* y y)
1.0))
(*
(*
(fma
(fma (* x_m x_m) 0.008333333333333333 -0.16666666666666666)
(* x_m x_m)
1.0)
x_m)
(fma (* (* y y) 0.008333333333333333) (* y y) 1.0)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double tmp;
if (sin(x_m) <= 1e-7) {
tmp = (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m) * fma(fma((fma((y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), (y * y), 1.0);
} else {
tmp = (fma(fma((x_m * x_m), 0.008333333333333333, -0.16666666666666666), (x_m * x_m), 1.0) * x_m) * fma(((y * y) * 0.008333333333333333), (y * y), 1.0);
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) tmp = 0.0 if (sin(x_m) <= 1e-7) tmp = Float64(Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m) * fma(fma(Float64(fma(Float64(y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), Float64(y * y), 1.0)); else tmp = Float64(Float64(fma(fma(Float64(x_m * x_m), 0.008333333333333333, -0.16666666666666666), Float64(x_m * x_m), 1.0) * x_m) * fma(Float64(Float64(y * y) * 0.008333333333333333), Float64(y * y), 1.0)); 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_, y_] := N[(x$95$s * If[LessEqual[N[Sin[x$95$m], $MachinePrecision], 1e-7], N[(N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $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}\;\sin x\_m \leq 10^{-7}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.0001984126984126984, 0.008333333333333333\right) \cdot y, y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.008333333333333333, -0.16666666666666666\right), x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(\left(y \cdot y\right) \cdot 0.008333333333333333, y \cdot y, 1\right)\\
\end{array}
\end{array}
if (sin.f64 x) < 9.9999999999999995e-8Initial program 100.0%
Taylor expanded in y around 0
+-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-*.f6490.0
Applied rewrites90.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.9
Applied rewrites69.9%
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6469.9
Applied rewrites69.9%
if 9.9999999999999995e-8 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6485.6
Applied rewrites85.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6430.8
Applied rewrites30.8%
Taylor expanded in y around inf
pow2N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6430.8
Applied rewrites30.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y)
:precision binary64
(*
x_s
(if (<= (sin x_m) 2e-5)
(*
(* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)
(fma (* y y) 0.16666666666666666 1.0))
(*
(fma
(fma x_m (* x_m 0.008333333333333333) -0.16666666666666666)
(* x_m x_m)
1.0)
x_m))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double tmp;
if (sin(x_m) <= 2e-5) {
tmp = (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m) * fma((y * y), 0.16666666666666666, 1.0);
} else {
tmp = fma(fma(x_m, (x_m * 0.008333333333333333), -0.16666666666666666), (x_m * x_m), 1.0) * x_m;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) tmp = 0.0 if (sin(x_m) <= 2e-5) tmp = Float64(Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * x_m) * fma(Float64(y * y), 0.16666666666666666, 1.0)); else tmp = Float64(fma(fma(x_m, Float64(x_m * 0.008333333333333333), -0.16666666666666666), Float64(x_m * x_m), 1.0) * 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_, y_] := N[(x$95$s * If[LessEqual[N[Sin[x$95$m], $MachinePrecision], 2e-5], N[(N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * x$95$m), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$95$m * N[(x$95$m * 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $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 \begin{array}{l}
\mathbf{if}\;\sin x\_m \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right) \cdot \mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x\_m, x\_m \cdot 0.008333333333333333, -0.16666666666666666\right), x\_m \cdot x\_m, 1\right) \cdot x\_m\\
\end{array}
\end{array}
if (sin.f64 x) < 2.00000000000000016e-5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.8
Applied rewrites74.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
if 2.00000000000000016e-5 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6451.5
Applied rewrites51.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6426.2
Applied rewrites26.2%
lift-*.f64N/A
lift-fma.f64N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y) :precision binary64 (* x_s (if (<= (sin x_m) -0.04) (* (* (* -0.16666666666666666 x_m) x_m) x_m) x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
double tmp;
if (sin(x_m) <= -0.04) {
tmp = ((-0.16666666666666666 * x_m) * x_m) * x_m;
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = private
x\_s = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_s, x_m, y)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8) :: tmp
if (sin(x_m) <= (-0.04d0)) then
tmp = (((-0.16666666666666666d0) * x_m) * x_m) * x_m
else
tmp = 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 y) {
double tmp;
if (Math.sin(x_m) <= -0.04) {
tmp = ((-0.16666666666666666 * x_m) * x_m) * x_m;
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y): tmp = 0 if math.sin(x_m) <= -0.04: tmp = ((-0.16666666666666666 * x_m) * x_m) * x_m else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) tmp = 0.0 if (sin(x_m) <= -0.04) tmp = Float64(Float64(Float64(-0.16666666666666666 * x_m) * x_m) * x_m); else tmp = 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, y) tmp = 0.0; if (sin(x_m) <= -0.04) tmp = ((-0.16666666666666666 * x_m) * x_m) * x_m; else tmp = 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_, y_] := N[(x$95$s * If[LessEqual[N[Sin[x$95$m], $MachinePrecision], -0.04], N[(N[(N[(-0.16666666666666666 * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision], x$95$m]), $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}\;\sin x\_m \leq -0.04:\\
\;\;\;\;\left(\left(-0.16666666666666666 \cdot x\_m\right) \cdot x\_m\right) \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if (sin.f64 x) < -0.0400000000000000008Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6445.4
Applied rewrites45.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.1
Applied rewrites27.1%
Taylor expanded in x around inf
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6427.1
Applied rewrites27.1%
if -0.0400000000000000008 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6447.4
Applied rewrites47.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.6%
Taylor expanded in x around 0
Applied rewrites30.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y) :precision binary64 (* x_s (* (fma -0.16666666666666666 (* x_m x_m) 1.0) x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
return x_s * (fma(-0.16666666666666666, (x_m * x_m), 1.0) * x_m);
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) return Float64(x_s * Float64(fma(-0.16666666666666666, Float64(x_m * x_m), 1.0) * 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_, y_] := N[(x$95$s * N[(N[(-0.16666666666666666 * N[(x$95$m * x$95$m), $MachinePrecision] + 1.0), $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(-0.16666666666666666, x\_m \cdot x\_m, 1\right) \cdot x\_m\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6447.0
Applied rewrites47.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6434.1
Applied rewrites34.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y) :precision binary64 (* x_s x_m))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y) {
return x_s * x_m;
}
x\_m = private
x\_s = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_s, x_m, y)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
code = x_s * 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 y) {
return x_s * x_m;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y): return x_s * x_m
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y) return Float64(x_s * x_m) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y) tmp = x_s * 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_, y_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot x\_m
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
lift-sin.f6447.0
Applied rewrites47.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.9%
Taylor expanded in x around 0
Applied rewrites23.6%
herbie shell --seed 2025064
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))