
(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 16 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 89.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (or (<= t_0 -2e-102) (not (<= t_0 5e-231)))
(/ (* (* (fma (* y y) (* (* 0.008333333333333333 y) y) 1.0) x) y) x)
(* (/ y x) x))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if ((t_0 <= -2e-102) || !(t_0 <= 5e-231)) {
tmp = ((fma((y * y), ((0.008333333333333333 * y) * y), 1.0) * x) * y) / x;
} else {
tmp = (y / x) * x;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if ((t_0 <= -2e-102) || !(t_0 <= 5e-231)) tmp = Float64(Float64(Float64(fma(Float64(y * y), Float64(Float64(0.008333333333333333 * y) * y), 1.0) * x) * y) / x); else tmp = Float64(Float64(y / x) * x); 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[Or[LessEqual[t$95$0, -2e-102], N[Not[LessEqual[t$95$0, 5e-231]], $MachinePrecision]], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * N[(N[(0.008333333333333333 * y), $MachinePrecision] * y), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-102} \lor \neg \left(t\_0 \leq 5 \cdot 10^{-231}\right):\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(y \cdot y, \left(0.008333333333333333 \cdot y\right) \cdot y, 1\right) \cdot x\right) \cdot y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.99999999999999987e-102 or 5.00000000000000023e-231 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites86.8%
Taylor expanded in x around 0
Applied rewrites64.9%
Taylor expanded in y around inf
Applied rewrites64.4%
if -1.99999999999999987e-102 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 5.00000000000000023e-231Initial program 73.2%
Taylor expanded in y around 0
Applied rewrites72.8%
Taylor expanded in x around 0
Applied rewrites14.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6470.2
Applied rewrites70.2%
Final simplification66.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (sinh y)) x))
(t_1 (/ (* (* (* (* y y) 0.16666666666666666) (sin x)) y) x)))
(if (<= y -3.6e+109)
t_1
(if (<= y -0.012)
t_0
(if (<= y 1.15e-21)
(* (* (/ (fma (* y y) 0.16666666666666666 1.0) x) y) (sin x))
(if (<= y 1.05e+103) t_0 t_1))))))
double code(double x, double y) {
double t_0 = (x * sinh(y)) / x;
double t_1 = ((((y * y) * 0.16666666666666666) * sin(x)) * y) / x;
double tmp;
if (y <= -3.6e+109) {
tmp = t_1;
} else if (y <= -0.012) {
tmp = t_0;
} else if (y <= 1.15e-21) {
tmp = ((fma((y * y), 0.16666666666666666, 1.0) / x) * y) * sin(x);
} else if (y <= 1.05e+103) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(x * sinh(y)) / x) t_1 = Float64(Float64(Float64(Float64(Float64(y * y) * 0.16666666666666666) * sin(x)) * y) / x) tmp = 0.0 if (y <= -3.6e+109) tmp = t_1; elseif (y <= -0.012) tmp = t_0; elseif (y <= 1.15e-21) tmp = Float64(Float64(Float64(fma(Float64(y * y), 0.16666666666666666, 1.0) / x) * y) * sin(x)); elseif (y <= 1.05e+103) tmp = t_0; else tmp = t_1; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[y, -3.6e+109], t$95$1, If[LessEqual[y, -0.012], t$95$0, If[LessEqual[y, 1.15e-21], 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.05e+103], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \sinh y}{x}\\
t_1 := \frac{\left(\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot \sin x\right) \cdot y}{x}\\
\mathbf{if}\;y \leq -3.6 \cdot 10^{+109}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -0.012:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-21}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)}{x} \cdot y\right) \cdot \sin x\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.6e109 or 1.0500000000000001e103 < y Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites68.5%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
if -3.6e109 < y < -0.012 or 1.15e-21 < y < 1.0500000000000001e103Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites84.8%
if -0.012 < y < 1.15e-21Initial program 79.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites99.5%
Taylor expanded in y around 0
Applied rewrites99.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (sinh y)) x))
(t_1 (/ (* (* (* (* y y) 0.16666666666666666) (sin x)) y) x)))
(if (<= y -3.6e+109)
t_1
(if (<= y -0.00042)
t_0
(if (<= y 2.7e-17)
(* (/ (sin x) x) y)
(if (<= y 1.05e+103) t_0 t_1))))))
double code(double x, double y) {
double t_0 = (x * sinh(y)) / x;
double t_1 = ((((y * y) * 0.16666666666666666) * sin(x)) * y) / x;
double tmp;
if (y <= -3.6e+109) {
tmp = t_1;
} else if (y <= -0.00042) {
tmp = t_0;
} else if (y <= 2.7e-17) {
tmp = (sin(x) / x) * y;
} else if (y <= 1.05e+103) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x * sinh(y)) / x
t_1 = ((((y * y) * 0.16666666666666666d0) * sin(x)) * y) / x
if (y <= (-3.6d+109)) then
tmp = t_1
else if (y <= (-0.00042d0)) then
tmp = t_0
else if (y <= 2.7d-17) then
tmp = (sin(x) / x) * y
else if (y <= 1.05d+103) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * Math.sinh(y)) / x;
double t_1 = ((((y * y) * 0.16666666666666666) * Math.sin(x)) * y) / x;
double tmp;
if (y <= -3.6e+109) {
tmp = t_1;
} else if (y <= -0.00042) {
tmp = t_0;
} else if (y <= 2.7e-17) {
tmp = (Math.sin(x) / x) * y;
} else if (y <= 1.05e+103) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = (x * math.sinh(y)) / x t_1 = ((((y * y) * 0.16666666666666666) * math.sin(x)) * y) / x tmp = 0 if y <= -3.6e+109: tmp = t_1 elif y <= -0.00042: tmp = t_0 elif y <= 2.7e-17: tmp = (math.sin(x) / x) * y elif y <= 1.05e+103: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(Float64(x * sinh(y)) / x) t_1 = Float64(Float64(Float64(Float64(Float64(y * y) * 0.16666666666666666) * sin(x)) * y) / x) tmp = 0.0 if (y <= -3.6e+109) tmp = t_1; elseif (y <= -0.00042) tmp = t_0; elseif (y <= 2.7e-17) tmp = Float64(Float64(sin(x) / x) * y); elseif (y <= 1.05e+103) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y) t_0 = (x * sinh(y)) / x; t_1 = ((((y * y) * 0.16666666666666666) * sin(x)) * y) / x; tmp = 0.0; if (y <= -3.6e+109) tmp = t_1; elseif (y <= -0.00042) tmp = t_0; elseif (y <= 2.7e-17) tmp = (sin(x) / x) * y; elseif (y <= 1.05e+103) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[y, -3.6e+109], t$95$1, If[LessEqual[y, -0.00042], t$95$0, If[LessEqual[y, 2.7e-17], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 1.05e+103], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \sinh y}{x}\\
t_1 := \frac{\left(\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot \sin x\right) \cdot y}{x}\\
\mathbf{if}\;y \leq -3.6 \cdot 10^{+109}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -0.00042:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-17}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.6e109 or 1.0500000000000001e103 < y Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites68.5%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
if -3.6e109 < y < -4.2000000000000002e-4 or 2.7000000000000001e-17 < y < 1.0500000000000001e103Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites84.3%
if -4.2000000000000002e-4 < y < 2.7000000000000001e-17Initial program 79.8%
Taylor expanded in y around 0
Applied rewrites99.6%
(FPCore (x y)
:precision binary64
(if (<= x 7e-23)
(* (* (/ (fma (* y y) 0.16666666666666666 1.0) x) y) (sin x))
(/
(*
(*
(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 <= 7e-23) {
tmp = ((fma((y * y), 0.16666666666666666, 1.0) / x) * y) * sin(x);
} 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 <= 7e-23) tmp = Float64(Float64(Float64(fma(Float64(y * y), 0.16666666666666666, 1.0) / x) * y) * sin(x)); else tmp = Float64(Float64(Float64(sin(x) * 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, 7e-23], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sin[x], $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-23}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)}{x} \cdot y\right) \cdot \sin x\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\sin x \cdot \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)\right) \cdot y}{x}\\
\end{array}
\end{array}
if x < 6.99999999999999987e-23Initial program 85.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites67.7%
Taylor expanded in y around 0
Applied rewrites88.8%
if 6.99999999999999987e-23 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites94.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (sinh y)) x)))
(if (<= y -0.00042)
t_0
(if (<= y 2.7e-17)
(* (/ (sin x) x) y)
(if (<= y 2e+183)
t_0
(/
(*
(*
(* (* (fma -0.027777777777777776 (* x x) 0.16666666666666666) x) y)
y)
y)
x))))))
double code(double x, double y) {
double t_0 = (x * sinh(y)) / x;
double tmp;
if (y <= -0.00042) {
tmp = t_0;
} else if (y <= 2.7e-17) {
tmp = (sin(x) / x) * y;
} else if (y <= 2e+183) {
tmp = t_0;
} else {
tmp = ((((fma(-0.027777777777777776, (x * x), 0.16666666666666666) * x) * y) * y) * y) / x;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(x * sinh(y)) / x) tmp = 0.0 if (y <= -0.00042) tmp = t_0; elseif (y <= 2.7e-17) tmp = Float64(Float64(sin(x) / x) * y); elseif (y <= 2e+183) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(Float64(fma(-0.027777777777777776, Float64(x * x), 0.16666666666666666) * x) * y) * y) * y) / x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[y, -0.00042], t$95$0, If[LessEqual[y, 2.7e-17], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 2e+183], t$95$0, N[(N[(N[(N[(N[(N[(-0.027777777777777776 * N[(x * x), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \sinh y}{x}\\
\mathbf{if}\;y \leq -0.00042:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-17}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\left(\mathsf{fma}\left(-0.027777777777777776, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot y\right) \cdot y\right) \cdot y}{x}\\
\end{array}
\end{array}
if y < -4.2000000000000002e-4 or 2.7000000000000001e-17 < y < 1.99999999999999989e183Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites78.2%
if -4.2000000000000002e-4 < y < 2.7000000000000001e-17Initial program 79.8%
Taylor expanded in y around 0
Applied rewrites99.6%
if 1.99999999999999989e183 < y Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites60.9%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites0.0%
Taylor expanded in y around inf
Applied rewrites82.6%
(FPCore (x y)
:precision binary64
(let* ((t_0
(/
(*
(*
(fma
(* y y)
(fma (* 0.008333333333333333 y) y 0.16666666666666666)
1.0)
x)
y)
x)))
(if (<= y -0.00042)
t_0
(if (<= y 2.7e-17)
(* (/ (sin x) x) y)
(if (<= y 2e+183)
t_0
(/
(*
(*
(* (* (fma -0.027777777777777776 (* x x) 0.16666666666666666) x) y)
y)
y)
x))))))
double code(double x, double y) {
double t_0 = ((fma((y * y), fma((0.008333333333333333 * y), y, 0.16666666666666666), 1.0) * x) * y) / x;
double tmp;
if (y <= -0.00042) {
tmp = t_0;
} else if (y <= 2.7e-17) {
tmp = (sin(x) / x) * y;
} else if (y <= 2e+183) {
tmp = t_0;
} else {
tmp = ((((fma(-0.027777777777777776, (x * x), 0.16666666666666666) * x) * y) * y) * y) / x;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(Float64(fma(Float64(y * y), fma(Float64(0.008333333333333333 * y), y, 0.16666666666666666), 1.0) * x) * y) / x) tmp = 0.0 if (y <= -0.00042) tmp = t_0; elseif (y <= 2.7e-17) tmp = Float64(Float64(sin(x) / x) * y); elseif (y <= 2e+183) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(Float64(fma(-0.027777777777777776, Float64(x * x), 0.16666666666666666) * x) * y) * y) * y) / x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(N[(N[(y * y), $MachinePrecision] * N[(N[(0.008333333333333333 * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[y, -0.00042], t$95$0, If[LessEqual[y, 2.7e-17], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 2e+183], t$95$0, N[(N[(N[(N[(N[(N[(-0.027777777777777776 * N[(x * x), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(0.008333333333333333 \cdot y, y, 0.16666666666666666\right), 1\right) \cdot x\right) \cdot y}{x}\\
\mathbf{if}\;y \leq -0.00042:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-17}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\left(\mathsf{fma}\left(-0.027777777777777776, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot y\right) \cdot y\right) \cdot y}{x}\\
\end{array}
\end{array}
if y < -4.2000000000000002e-4 or 2.7000000000000001e-17 < y < 1.99999999999999989e183Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites79.6%
Taylor expanded in x around 0
Applied rewrites65.5%
if -4.2000000000000002e-4 < y < 2.7000000000000001e-17Initial program 79.8%
Taylor expanded in y around 0
Applied rewrites99.6%
if 1.99999999999999989e183 < y Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites60.9%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites0.0%
Taylor expanded in y around inf
Applied rewrites82.6%
(FPCore (x y)
:precision binary64
(let* ((t_0
(/
(*
(*
(fma
(* y y)
(fma (* 0.008333333333333333 y) y 0.16666666666666666)
1.0)
x)
y)
x)))
(if (<= y -2e-16)
t_0
(if (<= y 3.7e-53)
(* (/ y x) x)
(if (<= y 2e+183)
t_0
(/
(*
(*
(* (* (fma -0.027777777777777776 (* x x) 0.16666666666666666) x) y)
y)
y)
x))))))
double code(double x, double y) {
double t_0 = ((fma((y * y), fma((0.008333333333333333 * y), y, 0.16666666666666666), 1.0) * x) * y) / x;
double tmp;
if (y <= -2e-16) {
tmp = t_0;
} else if (y <= 3.7e-53) {
tmp = (y / x) * x;
} else if (y <= 2e+183) {
tmp = t_0;
} else {
tmp = ((((fma(-0.027777777777777776, (x * x), 0.16666666666666666) * x) * y) * y) * y) / x;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(Float64(fma(Float64(y * y), fma(Float64(0.008333333333333333 * y), y, 0.16666666666666666), 1.0) * x) * y) / x) tmp = 0.0 if (y <= -2e-16) tmp = t_0; elseif (y <= 3.7e-53) tmp = Float64(Float64(y / x) * x); elseif (y <= 2e+183) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(Float64(fma(-0.027777777777777776, Float64(x * x), 0.16666666666666666) * x) * y) * y) * y) / x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(N[(N[(y * y), $MachinePrecision] * N[(N[(0.008333333333333333 * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[y, -2e-16], t$95$0, If[LessEqual[y, 3.7e-53], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 2e+183], t$95$0, N[(N[(N[(N[(N[(N[(-0.027777777777777776 * N[(x * x), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(0.008333333333333333 \cdot y, y, 0.16666666666666666\right), 1\right) \cdot x\right) \cdot y}{x}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-53}:\\
\;\;\;\;\frac{y}{x} \cdot x\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\left(\mathsf{fma}\left(-0.027777777777777776, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot y\right) \cdot y\right) \cdot y}{x}\\
\end{array}
\end{array}
if y < -2e-16 or 3.69999999999999982e-53 < y < 1.99999999999999989e183Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites82.2%
Taylor expanded in x around 0
Applied rewrites63.4%
if -2e-16 < y < 3.69999999999999982e-53Initial program 77.3%
Taylor expanded in y around 0
Applied rewrites77.3%
Taylor expanded in x around 0
Applied rewrites24.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.6
Applied rewrites71.6%
if 1.99999999999999989e183 < y Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites60.9%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites0.0%
Taylor expanded in y around inf
Applied rewrites82.6%
(FPCore (x y)
:precision binary64
(let* ((t_0
(/ (* (* (fma (* y y) (* (* 0.008333333333333333 y) y) 1.0) x) y) x)))
(if (<= y -2e-16)
t_0
(if (<= y 3.7e-53)
(* (/ y x) x)
(if (<= y 2e+183)
t_0
(/
(*
(*
(* (* (fma -0.027777777777777776 (* x x) 0.16666666666666666) x) y)
y)
y)
x))))))
double code(double x, double y) {
double t_0 = ((fma((y * y), ((0.008333333333333333 * y) * y), 1.0) * x) * y) / x;
double tmp;
if (y <= -2e-16) {
tmp = t_0;
} else if (y <= 3.7e-53) {
tmp = (y / x) * x;
} else if (y <= 2e+183) {
tmp = t_0;
} else {
tmp = ((((fma(-0.027777777777777776, (x * x), 0.16666666666666666) * x) * y) * y) * y) / x;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(Float64(fma(Float64(y * y), Float64(Float64(0.008333333333333333 * y) * y), 1.0) * x) * y) / x) tmp = 0.0 if (y <= -2e-16) tmp = t_0; elseif (y <= 3.7e-53) tmp = Float64(Float64(y / x) * x); elseif (y <= 2e+183) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(Float64(fma(-0.027777777777777776, Float64(x * x), 0.16666666666666666) * x) * y) * y) * y) / x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(N[(N[(y * y), $MachinePrecision] * N[(N[(0.008333333333333333 * y), $MachinePrecision] * y), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[y, -2e-16], t$95$0, If[LessEqual[y, 3.7e-53], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 2e+183], t$95$0, N[(N[(N[(N[(N[(N[(-0.027777777777777776 * N[(x * x), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\mathsf{fma}\left(y \cdot y, \left(0.008333333333333333 \cdot y\right) \cdot y, 1\right) \cdot x\right) \cdot y}{x}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-53}:\\
\;\;\;\;\frac{y}{x} \cdot x\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\left(\mathsf{fma}\left(-0.027777777777777776, x \cdot x, 0.16666666666666666\right) \cdot x\right) \cdot y\right) \cdot y\right) \cdot y}{x}\\
\end{array}
\end{array}
if y < -2e-16 or 3.69999999999999982e-53 < y < 1.99999999999999989e183Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites82.2%
Taylor expanded in x around 0
Applied rewrites63.4%
Taylor expanded in y around inf
Applied rewrites62.8%
if -2e-16 < y < 3.69999999999999982e-53Initial program 77.3%
Taylor expanded in y around 0
Applied rewrites77.3%
Taylor expanded in x around 0
Applied rewrites24.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.6
Applied rewrites71.6%
if 1.99999999999999989e183 < y Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites60.9%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites0.0%
Taylor expanded in y around inf
Applied rewrites82.6%
(FPCore (x y)
:precision binary64
(if (<= x 7.2e-81)
(* (/ y x) x)
(if (<= x 4500.0)
(/ (* (fma 0.16666666666666666 (* y y) 1.0) (* x y)) x)
(/ (* (* (* (* y y) 0.16666666666666666) x) y) x))))
double code(double x, double y) {
double tmp;
if (x <= 7.2e-81) {
tmp = (y / x) * x;
} else if (x <= 4500.0) {
tmp = (fma(0.16666666666666666, (y * y), 1.0) * (x * y)) / x;
} else {
tmp = ((((y * y) * 0.16666666666666666) * x) * y) / x;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 7.2e-81) tmp = Float64(Float64(y / x) * x); elseif (x <= 4500.0) tmp = Float64(Float64(fma(0.16666666666666666, Float64(y * y), 1.0) * Float64(x * y)) / x); else tmp = Float64(Float64(Float64(Float64(Float64(y * y) * 0.16666666666666666) * x) * y) / x); end return tmp end
code[x_, y_] := If[LessEqual[x, 7.2e-81], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 4500.0], N[(N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{-81}:\\
\;\;\;\;\frac{y}{x} \cdot x\\
\mathbf{elif}\;x \leq 4500:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.16666666666666666, y \cdot y, 1\right) \cdot \left(x \cdot y\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot x\right) \cdot y}{x}\\
\end{array}
\end{array}
if x < 7.1999999999999997e-81Initial program 85.5%
Taylor expanded in y around 0
Applied rewrites40.6%
Taylor expanded in x around 0
Applied rewrites25.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.5
Applied rewrites55.5%
if 7.1999999999999997e-81 < x < 4500Initial program 92.5%
Taylor expanded in x around 0
Applied rewrites86.8%
Taylor expanded in y around 0
Applied rewrites74.0%
Taylor expanded in x around 0
Applied rewrites68.3%
Applied rewrites68.3%
if 4500 < x Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites25.2%
Taylor expanded in y around 0
Applied rewrites88.4%
Taylor expanded in x around 0
Applied rewrites22.5%
Taylor expanded in y around inf
Applied rewrites44.6%
(FPCore (x y)
:precision binary64
(if (<= x 7.2e-81)
(* (/ y x) x)
(if (<= x 4500.0)
(/ (* (* y (fma 0.16666666666666666 (* y y) 1.0)) x) x)
(/ (* (* (* (* y y) 0.16666666666666666) x) y) x))))
double code(double x, double y) {
double tmp;
if (x <= 7.2e-81) {
tmp = (y / x) * x;
} else if (x <= 4500.0) {
tmp = ((y * fma(0.16666666666666666, (y * y), 1.0)) * x) / x;
} else {
tmp = ((((y * y) * 0.16666666666666666) * x) * y) / x;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 7.2e-81) tmp = Float64(Float64(y / x) * x); elseif (x <= 4500.0) tmp = Float64(Float64(Float64(y * fma(0.16666666666666666, Float64(y * y), 1.0)) * x) / x); else tmp = Float64(Float64(Float64(Float64(Float64(y * y) * 0.16666666666666666) * x) * y) / x); end return tmp end
code[x_, y_] := If[LessEqual[x, 7.2e-81], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 4500.0], N[(N[(N[(y * N[(0.16666666666666666 * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{-81}:\\
\;\;\;\;\frac{y}{x} \cdot x\\
\mathbf{elif}\;x \leq 4500:\\
\;\;\;\;\frac{\left(y \cdot \mathsf{fma}\left(0.16666666666666666, y \cdot y, 1\right)\right) \cdot x}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot x\right) \cdot y}{x}\\
\end{array}
\end{array}
if x < 7.1999999999999997e-81Initial program 85.5%
Taylor expanded in y around 0
Applied rewrites40.6%
Taylor expanded in x around 0
Applied rewrites25.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.5
Applied rewrites55.5%
if 7.1999999999999997e-81 < x < 4500Initial program 92.5%
Taylor expanded in x around 0
Applied rewrites86.8%
Taylor expanded in y around 0
Applied rewrites74.0%
Taylor expanded in x around 0
Applied rewrites68.3%
Applied rewrites68.3%
if 4500 < x Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites25.2%
Taylor expanded in y around 0
Applied rewrites88.4%
Taylor expanded in x around 0
Applied rewrites22.5%
Taylor expanded in y around inf
Applied rewrites44.6%
(FPCore (x y)
:precision binary64
(if (or (<= x 1e-9) (not (<= x 7.6e+146)))
(* (/ y x) x)
(*
(fma (fma 0.008333333333333333 (* x x) -0.16666666666666666) (* x x) 1.0)
y)))
double code(double x, double y) {
double tmp;
if ((x <= 1e-9) || !(x <= 7.6e+146)) {
tmp = (y / x) * x;
} else {
tmp = fma(fma(0.008333333333333333, (x * x), -0.16666666666666666), (x * x), 1.0) * y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((x <= 1e-9) || !(x <= 7.6e+146)) tmp = Float64(Float64(y / x) * x); else tmp = Float64(fma(fma(0.008333333333333333, Float64(x * x), -0.16666666666666666), Float64(x * x), 1.0) * y); end return tmp end
code[x_, y_] := If[Or[LessEqual[x, 1e-9], N[Not[LessEqual[x, 7.6e+146]], $MachinePrecision]], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(0.008333333333333333 * N[(x * x), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-9} \lor \neg \left(x \leq 7.6 \cdot 10^{+146}\right):\\
\;\;\;\;\frac{y}{x} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, x \cdot x, -0.16666666666666666\right), x \cdot x, 1\right) \cdot y\\
\end{array}
\end{array}
if x < 1.00000000000000006e-9 or 7.59999999999999958e146 < x Initial program 88.1%
Taylor expanded in y around 0
Applied rewrites42.6%
Taylor expanded in x around 0
Applied rewrites24.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.7
Applied rewrites53.7%
if 1.00000000000000006e-9 < x < 7.59999999999999958e146Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites52.1%
Taylor expanded in x around 0
Applied rewrites25.9%
Final simplification50.3%
(FPCore (x y) :precision binary64 (if (<= x 4800000.0) (* (/ y x) x) (/ (* (* (* (* y y) 0.16666666666666666) x) y) x)))
double code(double x, double y) {
double tmp;
if (x <= 4800000.0) {
tmp = (y / x) * x;
} else {
tmp = ((((y * y) * 0.16666666666666666) * x) * y) / x;
}
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 (x <= 4800000.0d0) then
tmp = (y / x) * x
else
tmp = ((((y * y) * 0.16666666666666666d0) * x) * y) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 4800000.0) {
tmp = (y / x) * x;
} else {
tmp = ((((y * y) * 0.16666666666666666) * x) * y) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 4800000.0: tmp = (y / x) * x else: tmp = ((((y * y) * 0.16666666666666666) * x) * y) / x return tmp
function code(x, y) tmp = 0.0 if (x <= 4800000.0) tmp = Float64(Float64(y / x) * x); else tmp = Float64(Float64(Float64(Float64(Float64(y * y) * 0.16666666666666666) * x) * y) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 4800000.0) tmp = (y / x) * x; else tmp = ((((y * y) * 0.16666666666666666) * x) * y) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 4800000.0], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4800000:\\
\;\;\;\;\frac{y}{x} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot x\right) \cdot y}{x}\\
\end{array}
\end{array}
if x < 4.8e6Initial program 86.0%
Taylor expanded in y around 0
Applied rewrites40.2%
Taylor expanded in x around 0
Applied rewrites26.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.6
Applied rewrites55.6%
if 4.8e6 < x Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites25.2%
Taylor expanded in y around 0
Applied rewrites88.4%
Taylor expanded in x around 0
Applied rewrites22.5%
Taylor expanded in y around inf
Applied rewrites44.6%
(FPCore (x y) :precision binary64 (* (/ y x) x))
double code(double x, double y) {
return (y / x) * 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 = (y / x) * x
end function
public static double code(double x, double y) {
return (y / x) * x;
}
def code(x, y): return (y / x) * x
function code(x, y) return Float64(Float64(y / x) * x) end
function tmp = code(x, y) tmp = (y / x) * x; end
code[x_, y_] := N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{x} \cdot x
\end{array}
Initial program 89.6%
Taylor expanded in y around 0
Applied rewrites43.8%
Taylor expanded in x around 0
Applied rewrites23.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6448.0
Applied rewrites48.0%
(FPCore (x y) :precision binary64 (* (fma -0.16666666666666666 (* x x) 1.0) y))
double code(double x, double y) {
return fma(-0.16666666666666666, (x * x), 1.0) * y;
}
function code(x, y) return Float64(fma(-0.16666666666666666, Float64(x * x), 1.0) * y) end
code[x_, y_] := N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 1\right) \cdot y
\end{array}
Initial program 89.6%
Taylor expanded in y around 0
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites34.6%
(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 89.6%
Taylor expanded in y around 0
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites27.0%
(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 2025018
(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))