
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
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)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
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)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
(FPCore (x y) :precision binary64 (* (/ (sinh y) x) (sin x)))
double code(double x, double y) {
return (sinh(y) / x) * sin(x);
}
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 = (sinh(y) / x) * sin(x)
end function
public static double code(double x, double y) {
return (Math.sinh(y) / x) * Math.sin(x);
}
def code(x, y): return (math.sinh(y) / x) * math.sin(x)
function code(x, y) return Float64(Float64(sinh(y) / x) * sin(x)) end
function tmp = code(x, y) tmp = (sinh(y) / x) * sin(x); end
code[x_, y_] := N[(N[(N[Sinh[y], $MachinePrecision] / x), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sinh y}{x} \cdot \sin x
\end{array}
Initial program 88.9%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 (- INFINITY))
(* (* 2.0 (sinh y)) 0.5)
(if (<= t_0 10.0)
(* (/ (sin x) x) y)
(* (pow (* y y) 3.5) 0.0001984126984126984)))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (2.0 * sinh(y)) * 0.5;
} else if (t_0 <= 10.0) {
tmp = (sin(x) / x) * y;
} else {
tmp = pow((y * y), 3.5) * 0.0001984126984126984;
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = (Math.sin(x) * Math.sinh(y)) / x;
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = (2.0 * Math.sinh(y)) * 0.5;
} else if (t_0 <= 10.0) {
tmp = (Math.sin(x) / x) * y;
} else {
tmp = Math.pow((y * y), 3.5) * 0.0001984126984126984;
}
return tmp;
}
def code(x, y): t_0 = (math.sin(x) * math.sinh(y)) / x tmp = 0 if t_0 <= -math.inf: tmp = (2.0 * math.sinh(y)) * 0.5 elif t_0 <= 10.0: tmp = (math.sin(x) / x) * y else: tmp = math.pow((y * y), 3.5) * 0.0001984126984126984 return tmp
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(2.0 * sinh(y)) * 0.5); elseif (t_0 <= 10.0) tmp = Float64(Float64(sin(x) / x) * y); else tmp = Float64((Float64(y * y) ^ 3.5) * 0.0001984126984126984); end return tmp end
function tmp_2 = code(x, y) t_0 = (sin(x) * sinh(y)) / x; tmp = 0.0; if (t_0 <= -Inf) tmp = (2.0 * sinh(y)) * 0.5; elseif (t_0 <= 10.0) tmp = (sin(x) / x) * y; else tmp = ((y * y) ^ 3.5) * 0.0001984126984126984; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(2.0 * N[Sinh[y], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[t$95$0, 10.0], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[(N[Power[N[(y * y), $MachinePrecision], 3.5], $MachinePrecision] * 0.0001984126984126984), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(2 \cdot \sinh y\right) \cdot 0.5\\
\mathbf{elif}\;t\_0 \leq 10:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;{\left(y \cdot y\right)}^{3.5} \cdot 0.0001984126984126984\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -inf.0Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites79.7%
if -inf.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 10Initial program 77.1%
Taylor expanded in y around 0
Applied rewrites98.1%
if 10 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites71.2%
Taylor expanded in y around 0
Applied rewrites62.2%
Taylor expanded in y around inf
Applied rewrites62.2%
Applied rewrites88.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 -1e-319)
(* (* 2.0 (sinh y)) 0.5)
(if (<= t_0 10.0)
(*
(/
(*
(fma
(fma (* y y) 0.008333333333333333 0.16666666666666666)
(* y y)
1.0)
y)
x)
x)
(* (pow (* y y) 3.5) 0.0001984126984126984)))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -1e-319) {
tmp = (2.0 * sinh(y)) * 0.5;
} else if (t_0 <= 10.0) {
tmp = ((fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0) * y) / x) * x;
} else {
tmp = pow((y * y), 3.5) * 0.0001984126984126984;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= -1e-319) tmp = Float64(Float64(2.0 * sinh(y)) * 0.5); elseif (t_0 <= 10.0) tmp = Float64(Float64(Float64(fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0) * y) / x) * x); else tmp = Float64((Float64(y * y) ^ 3.5) * 0.0001984126984126984); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-319], N[(N[(2.0 * N[Sinh[y], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[t$95$0, 10.0], N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] * x), $MachinePrecision], N[(N[Power[N[(y * y), $MachinePrecision], 3.5], $MachinePrecision] * 0.0001984126984126984), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-319}:\\
\;\;\;\;\left(2 \cdot \sinh y\right) \cdot 0.5\\
\mathbf{elif}\;t\_0 \leq 10:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right) \cdot y}{x} \cdot x\\
\mathbf{else}:\\
\;\;\;\;{\left(y \cdot y\right)}^{3.5} \cdot 0.0001984126984126984\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -9.99989e-320Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites72.6%
if -9.99989e-320 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 10Initial program 65.2%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites98.4%
Taylor expanded in x around 0
Applied rewrites78.9%
if 10 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites71.2%
Taylor expanded in y around 0
Applied rewrites62.2%
Taylor expanded in y around inf
Applied rewrites62.2%
Applied rewrites88.3%
(FPCore (x y)
:precision binary64
(if (<= x 0.0112)
(* (* 2.0 (sinh y)) 0.5)
(/
(*
(sin x)
(*
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0)
y))
x)))
double code(double x, double y) {
double tmp;
if (x <= 0.0112) {
tmp = (2.0 * sinh(y)) * 0.5;
} else {
tmp = (sin(x) * (fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0) * y)) / x;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 0.0112) tmp = Float64(Float64(2.0 * sinh(y)) * 0.5); else tmp = Float64(Float64(sin(x) * Float64(fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0) * y)) / x); end return tmp end
code[x_, y_] := If[LessEqual[x, 0.0112], N[(N[(2.0 * N[Sinh[y], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[Sin[x], $MachinePrecision] * N[(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] * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0112:\\
\;\;\;\;\left(2 \cdot \sinh y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin x \cdot \left(\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) \cdot y\right)}{x}\\
\end{array}
\end{array}
if x < 0.0111999999999999999Initial program 85.6%
Taylor expanded in x around 0
Applied rewrites77.3%
if 0.0111999999999999999 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites89.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 2.0 (sinh y))) (t_1 (fma (* y y) 0.16666666666666666 1.0)))
(if (<= y -1.8e+153)
(* (* (/ t_1 x) y) (sin x))
(if (<= y -1550000000.0)
(* t_0 (fma (* x x) -0.08333333333333333 0.5))
(if (<= y 0.56)
(* (/ (sin x) x) y)
(if (<= y 1.7e+101) (* t_0 0.5) (/ (* (sin x) (* t_1 y)) x)))))))
double code(double x, double y) {
double t_0 = 2.0 * sinh(y);
double t_1 = fma((y * y), 0.16666666666666666, 1.0);
double tmp;
if (y <= -1.8e+153) {
tmp = ((t_1 / x) * y) * sin(x);
} else if (y <= -1550000000.0) {
tmp = t_0 * fma((x * x), -0.08333333333333333, 0.5);
} else if (y <= 0.56) {
tmp = (sin(x) / x) * y;
} else if (y <= 1.7e+101) {
tmp = t_0 * 0.5;
} else {
tmp = (sin(x) * (t_1 * y)) / x;
}
return tmp;
}
function code(x, y) t_0 = Float64(2.0 * sinh(y)) t_1 = fma(Float64(y * y), 0.16666666666666666, 1.0) tmp = 0.0 if (y <= -1.8e+153) tmp = Float64(Float64(Float64(t_1 / x) * y) * sin(x)); elseif (y <= -1550000000.0) tmp = Float64(t_0 * fma(Float64(x * x), -0.08333333333333333, 0.5)); elseif (y <= 0.56) tmp = Float64(Float64(sin(x) / x) * y); elseif (y <= 1.7e+101) tmp = Float64(t_0 * 0.5); else tmp = Float64(Float64(sin(x) * Float64(t_1 * y)) / x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(2.0 * N[Sinh[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision]}, If[LessEqual[y, -1.8e+153], N[(N[(N[(t$95$1 / x), $MachinePrecision] * y), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1550000000.0], N[(t$95$0 * N[(N[(x * x), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.56], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 1.7e+101], N[(t$95$0 * 0.5), $MachinePrecision], N[(N[(N[Sin[x], $MachinePrecision] * N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \sinh y\\
t_1 := \mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{+153}:\\
\;\;\;\;\left(\frac{t\_1}{x} \cdot y\right) \cdot \sin x\\
\mathbf{elif}\;y \leq -1550000000:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(x \cdot x, -0.08333333333333333, 0.5\right)\\
\mathbf{elif}\;y \leq 0.56:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+101}:\\
\;\;\;\;t\_0 \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin x \cdot \left(t\_1 \cdot y\right)}{x}\\
\end{array}
\end{array}
if y < -1.8e153Initial program 100.0%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
if -1.8e153 < y < -1.55e9Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites87.5%
if -1.55e9 < y < 0.56000000000000005Initial program 77.1%
Taylor expanded in y around 0
Applied rewrites98.0%
if 0.56000000000000005 < y < 1.70000000000000009e101Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites73.7%
if 1.70000000000000009e101 < y Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites97.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 2.0 (sinh y)))
(t_1 (* (* (/ (fma (* y y) 0.16666666666666666 1.0) x) y) (sin x))))
(if (<= y -1.8e+153)
t_1
(if (<= y -1550000000.0)
(* t_0 (fma (* x x) -0.08333333333333333 0.5))
(if (<= y 0.56)
(* (/ (sin x) x) y)
(if (<= y 2.3e+109) (* t_0 0.5) t_1))))))
double code(double x, double y) {
double t_0 = 2.0 * sinh(y);
double t_1 = ((fma((y * y), 0.16666666666666666, 1.0) / x) * y) * sin(x);
double tmp;
if (y <= -1.8e+153) {
tmp = t_1;
} else if (y <= -1550000000.0) {
tmp = t_0 * fma((x * x), -0.08333333333333333, 0.5);
} else if (y <= 0.56) {
tmp = (sin(x) / x) * y;
} else if (y <= 2.3e+109) {
tmp = t_0 * 0.5;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y) t_0 = Float64(2.0 * sinh(y)) t_1 = Float64(Float64(Float64(fma(Float64(y * y), 0.16666666666666666, 1.0) / x) * y) * sin(x)) tmp = 0.0 if (y <= -1.8e+153) tmp = t_1; elseif (y <= -1550000000.0) tmp = Float64(t_0 * fma(Float64(x * x), -0.08333333333333333, 0.5)); elseif (y <= 0.56) tmp = Float64(Float64(sin(x) / x) * y); elseif (y <= 2.3e+109) tmp = Float64(t_0 * 0.5); else tmp = t_1; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(2.0 * N[Sinh[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8e+153], t$95$1, If[LessEqual[y, -1550000000.0], N[(t$95$0 * N[(N[(x * x), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.56], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 2.3e+109], N[(t$95$0 * 0.5), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \sinh y\\
t_1 := \left(\frac{\mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)}{x} \cdot y\right) \cdot \sin x\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1550000000:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(x \cdot x, -0.08333333333333333, 0.5\right)\\
\mathbf{elif}\;y \leq 0.56:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+109}:\\
\;\;\;\;t\_0 \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.8e153 or 2.3000000000000001e109 < y Initial program 100.0%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
if -1.8e153 < y < -1.55e9Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites87.5%
if -1.55e9 < y < 0.56000000000000005Initial program 77.1%
Taylor expanded in y around 0
Applied rewrites98.0%
if 0.56000000000000005 < y < 2.3000000000000001e109Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites75.0%
(FPCore (x y)
:precision binary64
(if (<= x 0.0112)
(* (* 2.0 (sinh y)) 0.5)
(/
(*
(sin x)
(*
(fma (fma (* y y) 0.008333333333333333 0.16666666666666666) (* y y) 1.0)
y))
x)))
double code(double x, double y) {
double tmp;
if (x <= 0.0112) {
tmp = (2.0 * sinh(y)) * 0.5;
} else {
tmp = (sin(x) * (fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0) * y)) / x;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 0.0112) tmp = Float64(Float64(2.0 * sinh(y)) * 0.5); else tmp = Float64(Float64(sin(x) * Float64(fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0) * y)) / x); end return tmp end
code[x_, y_] := If[LessEqual[x, 0.0112], N[(N[(2.0 * N[Sinh[y], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[Sin[x], $MachinePrecision] * N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0112:\\
\;\;\;\;\left(2 \cdot \sinh y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin x \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right) \cdot y\right)}{x}\\
\end{array}
\end{array}
if x < 0.0111999999999999999Initial program 85.6%
Taylor expanded in x around 0
Applied rewrites77.3%
if 0.0111999999999999999 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites85.6%
(FPCore (x y)
:precision binary64
(if (<= x 0.0112)
(* (* 2.0 (sinh y)) 0.5)
(*
(/
(fma
(* (* (fma (* y y) 0.008333333333333333 0.16666666666666666) y) y)
y
y)
x)
(sin x))))
double code(double x, double y) {
double tmp;
if (x <= 0.0112) {
tmp = (2.0 * sinh(y)) * 0.5;
} else {
tmp = (fma(((fma((y * y), 0.008333333333333333, 0.16666666666666666) * y) * y), y, y) / x) * sin(x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 0.0112) tmp = Float64(Float64(2.0 * sinh(y)) * 0.5); else tmp = Float64(Float64(fma(Float64(Float64(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666) * y) * y), y, y) / x) * sin(x)); end return tmp end
code[x_, y_] := If[LessEqual[x, 0.0112], N[(N[(2.0 * N[Sinh[y], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] * y + y), $MachinePrecision] / x), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0112:\\
\;\;\;\;\left(2 \cdot \sinh y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right) \cdot y\right) \cdot y, y, y\right)}{x} \cdot \sin x\\
\end{array}
\end{array}
if x < 0.0111999999999999999Initial program 85.6%
Taylor expanded in x around 0
Applied rewrites77.3%
if 0.0111999999999999999 < x Initial program 99.9%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites85.5%
Applied rewrites85.5%
Applied rewrites85.5%
(FPCore (x y)
:precision binary64
(if (<= x 0.0112)
(* (* 2.0 (sinh y)) 0.5)
(*
(/
(*
(fma (fma (* y y) 0.008333333333333333 0.16666666666666666) (* y y) 1.0)
y)
x)
(sin x))))
double code(double x, double y) {
double tmp;
if (x <= 0.0112) {
tmp = (2.0 * sinh(y)) * 0.5;
} else {
tmp = ((fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0) * y) / x) * sin(x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 0.0112) tmp = Float64(Float64(2.0 * sinh(y)) * 0.5); else tmp = Float64(Float64(Float64(fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0) * y) / x) * sin(x)); end return tmp end
code[x_, y_] := If[LessEqual[x, 0.0112], N[(N[(2.0 * N[Sinh[y], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0112:\\
\;\;\;\;\left(2 \cdot \sinh y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right) \cdot y}{x} \cdot \sin x\\
\end{array}
\end{array}
if x < 0.0111999999999999999Initial program 85.6%
Taylor expanded in x around 0
Applied rewrites77.3%
if 0.0111999999999999999 < x Initial program 99.9%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites85.5%
(FPCore (x y)
:precision binary64
(let* ((t_0
(/
(*
(fma
(fma (* y y) 0.008333333333333333 0.16666666666666666)
(* y y)
1.0)
y)
x)))
(if (<= y -1550000000.0)
(* t_0 (* (fma -0.16666666666666666 (* x x) 1.0) x))
(if (<= y 0.56) (* t_0 x) (* (* 2.0 (sinh y)) 0.5)))))
double code(double x, double y) {
double t_0 = (fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0) * y) / x;
double tmp;
if (y <= -1550000000.0) {
tmp = t_0 * (fma(-0.16666666666666666, (x * x), 1.0) * x);
} else if (y <= 0.56) {
tmp = t_0 * x;
} else {
tmp = (2.0 * sinh(y)) * 0.5;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0) * y) / x) tmp = 0.0 if (y <= -1550000000.0) tmp = Float64(t_0 * Float64(fma(-0.16666666666666666, Float64(x * x), 1.0) * x)); elseif (y <= 0.56) tmp = Float64(t_0 * x); else tmp = Float64(Float64(2.0 * sinh(y)) * 0.5); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[y, -1550000000.0], N[(t$95$0 * N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.56], N[(t$95$0 * x), $MachinePrecision], N[(N[(2.0 * N[Sinh[y], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right) \cdot y}{x}\\
\mathbf{if}\;y \leq -1550000000:\\
\;\;\;\;t\_0 \cdot \left(\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 1\right) \cdot x\right)\\
\mathbf{elif}\;y \leq 0.56:\\
\;\;\;\;t\_0 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \sinh y\right) \cdot 0.5\\
\end{array}
\end{array}
if y < -1.55e9Initial program 100.0%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites90.0%
Taylor expanded in x around 0
Applied rewrites76.4%
if -1.55e9 < y < 0.56000000000000005Initial program 77.1%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites98.3%
Taylor expanded in x around 0
Applied rewrites73.2%
if 0.56000000000000005 < y Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites81.5%
(FPCore (x y)
:precision binary64
(let* ((t_0
(/
(*
(fma
(fma (* y y) 0.008333333333333333 0.16666666666666666)
(* y y)
1.0)
y)
x)))
(if (<= y -1550000000.0)
(* t_0 (* (fma -0.16666666666666666 (* x x) 1.0) x))
(* t_0 x))))
double code(double x, double y) {
double t_0 = (fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0) * y) / x;
double tmp;
if (y <= -1550000000.0) {
tmp = t_0 * (fma(-0.16666666666666666, (x * x), 1.0) * x);
} else {
tmp = t_0 * x;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0) * y) / x) tmp = 0.0 if (y <= -1550000000.0) tmp = Float64(t_0 * Float64(fma(-0.16666666666666666, Float64(x * x), 1.0) * x)); else tmp = Float64(t_0 * x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[y, -1550000000.0], N[(t$95$0 * N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right) \cdot y}{x}\\
\mathbf{if}\;y \leq -1550000000:\\
\;\;\;\;t\_0 \cdot \left(\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 1\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot x\\
\end{array}
\end{array}
if y < -1.55e9Initial program 100.0%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites90.0%
Taylor expanded in x around 0
Applied rewrites76.4%
if -1.55e9 < y Initial program 85.0%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites93.4%
Taylor expanded in x around 0
Applied rewrites72.1%
(FPCore (x y)
:precision binary64
(if (<= y -2.05e+103)
(/
(*
(* (fma -0.16666666666666666 (* x x) 1.0) x)
(* (fma (* y y) 0.16666666666666666 1.0) y))
x)
(*
(/
(*
(fma (fma (* y y) 0.008333333333333333 0.16666666666666666) (* y y) 1.0)
y)
x)
x)))
double code(double x, double y) {
double tmp;
if (y <= -2.05e+103) {
tmp = ((fma(-0.16666666666666666, (x * x), 1.0) * x) * (fma((y * y), 0.16666666666666666, 1.0) * y)) / x;
} else {
tmp = ((fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0) * y) / x) * x;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -2.05e+103) tmp = Float64(Float64(Float64(fma(-0.16666666666666666, Float64(x * x), 1.0) * x) * Float64(fma(Float64(y * y), 0.16666666666666666, 1.0) * y)) / x); else tmp = Float64(Float64(Float64(fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0) * y) / x) * x); end return tmp end
code[x_, y_] := If[LessEqual[y, -2.05e+103], N[(N[(N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{+103}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 1\right) \cdot x\right) \cdot \left(\mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right) \cdot y\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right) \cdot y}{x} \cdot x\\
\end{array}
\end{array}
if y < -2.0500000000000001e103Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites79.5%
if -2.0500000000000001e103 < y Initial program 86.6%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites90.9%
Taylor expanded in x around 0
Applied rewrites71.0%
(FPCore (x y)
:precision binary64
(if (<= x 1.75e+87)
(*
(fma
(*
(fma
(fma (* y y) 0.0001984126984126984 0.008333333333333333)
(* y y)
0.16666666666666666)
y)
y
1.0)
y)
(* (* (* y y) 0.16666666666666666) y)))
double code(double x, double y) {
double tmp;
if (x <= 1.75e+87) {
tmp = fma((fma(fma((y * y), 0.0001984126984126984, 0.008333333333333333), (y * y), 0.16666666666666666) * y), y, 1.0) * y;
} else {
tmp = ((y * y) * 0.16666666666666666) * y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 1.75e+87) tmp = Float64(fma(Float64(fma(fma(Float64(y * y), 0.0001984126984126984, 0.008333333333333333), Float64(y * y), 0.16666666666666666) * y), y, 1.0) * y); else tmp = Float64(Float64(Float64(y * y) * 0.16666666666666666) * y); end return tmp end
code[x_, y_] := If[LessEqual[x, 1.75e+87], N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.0001984126984126984, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right) \cdot y, y, 1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot y\\
\end{array}
\end{array}
if x < 1.74999999999999993e87Initial program 86.6%
Taylor expanded in x around 0
Applied rewrites74.2%
Taylor expanded in y around 0
Applied rewrites68.1%
Applied rewrites68.1%
if 1.74999999999999993e87 < x Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites33.7%
Taylor expanded in y around 0
Applied rewrites27.2%
Taylor expanded in y around inf
Applied rewrites44.5%
(FPCore (x y)
:precision binary64
(if (<= x 1.75e+87)
(*
(fma
(fma (* (* y y) 0.0001984126984126984) (* y y) 0.16666666666666666)
(* y y)
1.0)
y)
(* (* (* y y) 0.16666666666666666) y)))
double code(double x, double y) {
double tmp;
if (x <= 1.75e+87) {
tmp = fma(fma(((y * y) * 0.0001984126984126984), (y * y), 0.16666666666666666), (y * y), 1.0) * y;
} else {
tmp = ((y * y) * 0.16666666666666666) * y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 1.75e+87) tmp = Float64(fma(fma(Float64(Float64(y * y) * 0.0001984126984126984), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0) * y); else tmp = Float64(Float64(Float64(y * y) * 0.16666666666666666) * y); end return tmp end
code[x_, y_] := If[LessEqual[x, 1.75e+87], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(y \cdot y\right) \cdot 0.0001984126984126984, y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot y\\
\end{array}
\end{array}
if x < 1.74999999999999993e87Initial program 86.6%
Taylor expanded in x around 0
Applied rewrites74.2%
Taylor expanded in y around 0
Applied rewrites68.1%
Taylor expanded in y around inf
Applied rewrites68.0%
if 1.74999999999999993e87 < x Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites33.7%
Taylor expanded in y around 0
Applied rewrites27.2%
Taylor expanded in y around inf
Applied rewrites44.5%
(FPCore (x y)
:precision binary64
(*
(/
(*
(fma (fma (* y y) 0.008333333333333333 0.16666666666666666) (* y y) 1.0)
y)
x)
x))
double code(double x, double y) {
return ((fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0) * y) / x) * x;
}
function code(x, y) return Float64(Float64(Float64(fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0) * y) / x) * x) end
code[x_, y_] := N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right) \cdot y}{x} \cdot x
\end{array}
Initial program 88.9%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites92.5%
Taylor expanded in x around 0
Applied rewrites69.7%
(FPCore (x y)
:precision binary64
(if (<= x 1.75e+87)
(*
(fma (* (fma (* y y) 0.008333333333333333 0.16666666666666666) y) y 1.0)
y)
(* (* (* y y) 0.16666666666666666) y)))
double code(double x, double y) {
double tmp;
if (x <= 1.75e+87) {
tmp = fma((fma((y * y), 0.008333333333333333, 0.16666666666666666) * y), y, 1.0) * y;
} else {
tmp = ((y * y) * 0.16666666666666666) * y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 1.75e+87) tmp = Float64(fma(Float64(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666) * y), y, 1.0) * y); else tmp = Float64(Float64(Float64(y * y) * 0.16666666666666666) * y); end return tmp end
code[x_, y_] := If[LessEqual[x, 1.75e+87], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right) \cdot y, y, 1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot y\\
\end{array}
\end{array}
if x < 1.74999999999999993e87Initial program 86.6%
Taylor expanded in x around 0
Applied rewrites74.2%
Taylor expanded in y around 0
Applied rewrites65.8%
Applied rewrites65.8%
if 1.74999999999999993e87 < x Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites33.7%
Taylor expanded in y around 0
Applied rewrites27.2%
Taylor expanded in y around inf
Applied rewrites44.5%
(FPCore (x y) :precision binary64 (if (<= x 1.75e+87) (* (fma (* (* y y) 0.008333333333333333) (* y y) 1.0) y) (* (* (* y y) 0.16666666666666666) y)))
double code(double x, double y) {
double tmp;
if (x <= 1.75e+87) {
tmp = fma(((y * y) * 0.008333333333333333), (y * y), 1.0) * y;
} else {
tmp = ((y * y) * 0.16666666666666666) * y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 1.75e+87) tmp = Float64(fma(Float64(Float64(y * y) * 0.008333333333333333), Float64(y * y), 1.0) * y); else tmp = Float64(Float64(Float64(y * y) * 0.16666666666666666) * y); end return tmp end
code[x_, y_] := If[LessEqual[x, 1.75e+87], N[(N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(\left(y \cdot y\right) \cdot 0.008333333333333333, y \cdot y, 1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot y\\
\end{array}
\end{array}
if x < 1.74999999999999993e87Initial program 86.6%
Taylor expanded in x around 0
Applied rewrites74.2%
Taylor expanded in y around 0
Applied rewrites65.8%
Taylor expanded in y around inf
Applied rewrites65.8%
if 1.74999999999999993e87 < x Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites33.7%
Taylor expanded in y around 0
Applied rewrites27.2%
Taylor expanded in y around inf
Applied rewrites44.5%
(FPCore (x y) :precision binary64 (if (or (<= y -2.25e-18) (not (<= y 6.6e-46))) (* (* (* y y) 0.16666666666666666) y) y))
double code(double x, double y) {
double tmp;
if ((y <= -2.25e-18) || !(y <= 6.6e-46)) {
tmp = ((y * y) * 0.16666666666666666) * y;
} else {
tmp = y;
}
return tmp;
}
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
real(8) :: tmp
if ((y <= (-2.25d-18)) .or. (.not. (y <= 6.6d-46))) then
tmp = ((y * y) * 0.16666666666666666d0) * y
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -2.25e-18) || !(y <= 6.6e-46)) {
tmp = ((y * y) * 0.16666666666666666) * y;
} else {
tmp = y;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -2.25e-18) or not (y <= 6.6e-46): tmp = ((y * y) * 0.16666666666666666) * y else: tmp = y return tmp
function code(x, y) tmp = 0.0 if ((y <= -2.25e-18) || !(y <= 6.6e-46)) tmp = Float64(Float64(Float64(y * y) * 0.16666666666666666) * y); else tmp = y; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -2.25e-18) || ~((y <= 6.6e-46))) tmp = ((y * y) * 0.16666666666666666) * y; else tmp = y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -2.25e-18], N[Not[LessEqual[y, 6.6e-46]], $MachinePrecision]], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision], y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.25 \cdot 10^{-18} \lor \neg \left(y \leq 6.6 \cdot 10^{-46}\right):\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -2.24999999999999997e-18 or 6.60000000000000027e-46 < y Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites71.6%
Taylor expanded in y around 0
Applied rewrites49.4%
Taylor expanded in y around inf
Applied rewrites49.4%
if -2.24999999999999997e-18 < y < 6.60000000000000027e-46Initial program 75.6%
Taylor expanded in x around 0
Applied rewrites61.9%
Taylor expanded in y around 0
Applied rewrites61.9%
Final simplification55.1%
(FPCore (x y) :precision binary64 (if (<= x 2.3e+24) (* (fma y (* 0.16666666666666666 y) 1.0) y) (* (* (* y y) 0.16666666666666666) y)))
double code(double x, double y) {
double tmp;
if (x <= 2.3e+24) {
tmp = fma(y, (0.16666666666666666 * y), 1.0) * y;
} else {
tmp = ((y * y) * 0.16666666666666666) * y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 2.3e+24) tmp = Float64(fma(y, Float64(0.16666666666666666 * y), 1.0) * y); else tmp = Float64(Float64(Float64(y * y) * 0.16666666666666666) * y); end return tmp end
code[x_, y_] := If[LessEqual[x, 2.3e+24], N[(N[(y * N[(0.16666666666666666 * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.3 \cdot 10^{+24}:\\
\;\;\;\;\mathsf{fma}\left(y, 0.16666666666666666 \cdot y, 1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot y\\
\end{array}
\end{array}
if x < 2.2999999999999999e24Initial program 86.0%
Taylor expanded in x around 0
Applied rewrites76.7%
Taylor expanded in y around 0
Applied rewrites63.2%
Applied rewrites63.2%
if 2.2999999999999999e24 < x Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites31.7%
Taylor expanded in y around 0
Applied rewrites24.6%
Taylor expanded in y around inf
Applied rewrites38.8%
(FPCore (x y) :precision binary64 y)
double code(double x, double y) {
return 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 = y
end function
public static double code(double x, double y) {
return y;
}
def code(x, y): return y
function code(x, y) return y end
function tmp = code(x, y) tmp = y; end
code[x_, y_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites67.2%
Taylor expanded in y around 0
Applied rewrites30.4%
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) x)))
double code(double x, double y) {
return sin(x) * (sinh(y) / x);
}
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) / x)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / x);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / x)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / x)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / x); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{x}
\end{array}
herbie shell --seed 2025026
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
:alt
(! :herbie-platform default (* (sin x) (/ (sinh y) x)))
(/ (* (sin x) (sinh y)) x))