
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
real(8) function code(x, y)
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;
}
real(8) function code(x, y)
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}
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (if (<= x_m 5e-23) (sinh y) (/ (* (sin x_m) (sinh y)) x_m)))
x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 5e-23) {
tmp = sinh(y);
} else {
tmp = (sin(x_m) * sinh(y)) / x_m;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8) :: tmp
if (x_m <= 5d-23) then
tmp = sinh(y)
else
tmp = (sin(x_m) * sinh(y)) / x_m
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y) {
double tmp;
if (x_m <= 5e-23) {
tmp = Math.sinh(y);
} else {
tmp = (Math.sin(x_m) * Math.sinh(y)) / x_m;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y): tmp = 0 if x_m <= 5e-23: tmp = math.sinh(y) else: tmp = (math.sin(x_m) * math.sinh(y)) / x_m return tmp
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 5e-23) tmp = sinh(y); else tmp = Float64(Float64(sin(x_m) * sinh(y)) / x_m); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y) tmp = 0.0; if (x_m <= 5e-23) tmp = sinh(y); else tmp = (sin(x_m) * sinh(y)) / x_m; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 5e-23], N[Sinh[y], $MachinePrecision], N[(N[(N[Sin[x$95$m], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 5 \cdot 10^{-23}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin x\_m \cdot \sinh y}{x\_m}\\
\end{array}
\end{array}
if x < 5.0000000000000002e-23Initial program 85.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6455.7
Applied rewrites55.7%
Applied rewrites77.2%
if 5.0000000000000002e-23 < x Initial program 99.9%
x_m = (fabs.f64 x)
(FPCore (x_m y)
:precision binary64
(let* ((t_0 (/ (* (sin x_m) (sinh y)) x_m)))
(if (<= t_0 -5e-7)
(sinh y)
(if (<= t_0 5e-10)
(* (/ (sin x_m) x_m) y)
(* (- (exp y) (- 1.0 y)) 0.5)))))x_m = fabs(x);
double code(double x_m, double y) {
double t_0 = (sin(x_m) * sinh(y)) / x_m;
double tmp;
if (t_0 <= -5e-7) {
tmp = sinh(y);
} else if (t_0 <= 5e-10) {
tmp = (sin(x_m) / x_m) * y;
} else {
tmp = (exp(y) - (1.0 - y)) * 0.5;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (sin(x_m) * sinh(y)) / x_m
if (t_0 <= (-5d-7)) then
tmp = sinh(y)
else if (t_0 <= 5d-10) then
tmp = (sin(x_m) / x_m) * y
else
tmp = (exp(y) - (1.0d0 - y)) * 0.5d0
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y) {
double t_0 = (Math.sin(x_m) * Math.sinh(y)) / x_m;
double tmp;
if (t_0 <= -5e-7) {
tmp = Math.sinh(y);
} else if (t_0 <= 5e-10) {
tmp = (Math.sin(x_m) / x_m) * y;
} else {
tmp = (Math.exp(y) - (1.0 - y)) * 0.5;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y): t_0 = (math.sin(x_m) * math.sinh(y)) / x_m tmp = 0 if t_0 <= -5e-7: tmp = math.sinh(y) elif t_0 <= 5e-10: tmp = (math.sin(x_m) / x_m) * y else: tmp = (math.exp(y) - (1.0 - y)) * 0.5 return tmp
x_m = abs(x) function code(x_m, y) t_0 = Float64(Float64(sin(x_m) * sinh(y)) / x_m) tmp = 0.0 if (t_0 <= -5e-7) tmp = sinh(y); elseif (t_0 <= 5e-10) tmp = Float64(Float64(sin(x_m) / x_m) * y); else tmp = Float64(Float64(exp(y) - Float64(1.0 - y)) * 0.5); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y) t_0 = (sin(x_m) * sinh(y)) / x_m; tmp = 0.0; if (t_0 <= -5e-7) tmp = sinh(y); elseif (t_0 <= 5e-10) tmp = (sin(x_m) / x_m) * y; else tmp = (exp(y) - (1.0 - y)) * 0.5; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x$95$m], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-7], N[Sinh[y], $MachinePrecision], If[LessEqual[t$95$0, 5e-10], N[(N[(N[Sin[x$95$m], $MachinePrecision] / x$95$m), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[Exp[y], $MachinePrecision] - N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := \frac{\sin x\_m \cdot \sinh y}{x\_m}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-7}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin x\_m}{x\_m} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(e^{y} - \left(1 - y\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -4.99999999999999977e-7Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6474.2
Applied rewrites74.2%
Applied rewrites75.0%
if -4.99999999999999977e-7 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 5.00000000000000031e-10Initial program 78.1%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f6498.3
Applied rewrites98.3%
if 5.00000000000000031e-10 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6483.1
Applied rewrites83.1%
Taylor expanded in y around 0
Applied rewrites83.2%
x_m = (fabs.f64 x)
(FPCore (x_m y)
:precision binary64
(if (<= x_m 1.32e-21)
(sinh y)
(/
(*
(*
(sin x_m)
(fma (fma (* y y) 0.008333333333333333 0.16666666666666666) (* y y) 1.0))
y)
x_m)))x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 1.32e-21) {
tmp = sinh(y);
} else {
tmp = ((sin(x_m) * fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0)) * y) / x_m;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 1.32e-21) tmp = sinh(y); else tmp = Float64(Float64(Float64(sin(x_m) * fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0)) * y) / x_m); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 1.32e-21], N[Sinh[y], $MachinePrecision], N[(N[(N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / x$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 1.32 \cdot 10^{-21}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\sin x\_m \cdot \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)\right) \cdot y}{x\_m}\\
\end{array}
\end{array}
if x < 1.32e-21Initial program 85.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6455.7
Applied rewrites55.7%
Applied rewrites77.2%
if 1.32e-21 < x Initial program 99.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.0%
x_m = (fabs.f64 x)
(FPCore (x_m y)
:precision binary64
(if (<= x_m 9.5e-7)
(sinh y)
(*
(/
(fma (fma 0.008333333333333333 (* y y) 0.16666666666666666) (* y y) 1.0)
x_m)
(* y (sin x_m)))))x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 9.5e-7) {
tmp = sinh(y);
} else {
tmp = (fma(fma(0.008333333333333333, (y * y), 0.16666666666666666), (y * y), 1.0) / x_m) * (y * sin(x_m));
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 9.5e-7) tmp = sinh(y); else tmp = Float64(Float64(fma(fma(0.008333333333333333, Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0) / x_m) * Float64(y * sin(x_m))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 9.5e-7], N[Sinh[y], $MachinePrecision], N[(N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] / x$95$m), $MachinePrecision] * N[(y * N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 9.5 \cdot 10^{-7}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right)}{x\_m} \cdot \left(y \cdot \sin x\_m\right)\\
\end{array}
\end{array}
if x < 9.5000000000000001e-7Initial program 85.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6455.7
Applied rewrites55.7%
Applied rewrites77.8%
if 9.5000000000000001e-7 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites91.0%
Applied rewrites91.0%
x_m = (fabs.f64 x)
(FPCore (x_m y)
:precision binary64
(if (<= x_m 2e-22)
(sinh y)
(*
(/
(*
(sin x_m)
(fma (fma (* y y) 0.008333333333333333 0.16666666666666666) (* y y) 1.0))
x_m)
y)))x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 2e-22) {
tmp = sinh(y);
} else {
tmp = ((sin(x_m) * fma(fma((y * y), 0.008333333333333333, 0.16666666666666666), (y * y), 1.0)) / x_m) * y;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 2e-22) tmp = sinh(y); else tmp = Float64(Float64(Float64(sin(x_m) * fma(fma(Float64(y * y), 0.008333333333333333, 0.16666666666666666), Float64(y * y), 1.0)) / x_m) * y); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 2e-22], N[Sinh[y], $MachinePrecision], N[(N[(N[(N[Sin[x$95$m], $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / x$95$m), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin x\_m \cdot \mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.008333333333333333, 0.16666666666666666\right), y \cdot y, 1\right)}{x\_m} \cdot y\\
\end{array}
\end{array}
if x < 2.0000000000000001e-22Initial program 85.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6455.7
Applied rewrites55.7%
Applied rewrites77.2%
if 2.0000000000000001e-22 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites91.7%
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (if (<= x_m 1.32e-21) (sinh y) (/ (* (* (fma 0.16666666666666666 (* y y) 1.0) (sin x_m)) y) x_m)))
x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 1.32e-21) {
tmp = sinh(y);
} else {
tmp = ((fma(0.16666666666666666, (y * y), 1.0) * sin(x_m)) * y) / x_m;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 1.32e-21) tmp = sinh(y); else tmp = Float64(Float64(Float64(fma(0.16666666666666666, Float64(y * y), 1.0) * sin(x_m)) * y) / x_m); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 1.32e-21], N[Sinh[y], $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[x$95$m], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / x$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 1.32 \cdot 10^{-21}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(0.16666666666666666, y \cdot y, 1\right) \cdot \sin x\_m\right) \cdot y}{x\_m}\\
\end{array}
\end{array}
if x < 1.32e-21Initial program 85.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6455.7
Applied rewrites55.7%
Applied rewrites77.2%
if 1.32e-21 < x Initial program 99.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.0%
Taylor expanded in y around 0
Applied rewrites91.2%
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (if (<= x_m 1.2e-21) (sinh y) (* (* (fma 0.16666666666666666 (* y y) 1.0) (/ (sin x_m) x_m)) y)))
x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 1.2e-21) {
tmp = sinh(y);
} else {
tmp = (fma(0.16666666666666666, (y * y), 1.0) * (sin(x_m) / x_m)) * y;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 1.2e-21) tmp = sinh(y); else tmp = Float64(Float64(fma(0.16666666666666666, Float64(y * y), 1.0) * Float64(sin(x_m) / x_m)) * y); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 1.2e-21], N[Sinh[y], $MachinePrecision], N[(N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sin[x$95$m], $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 1.2 \cdot 10^{-21}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.16666666666666666, y \cdot y, 1\right) \cdot \frac{\sin x\_m}{x\_m}\right) \cdot y\\
\end{array}
\end{array}
if x < 1.2e-21Initial program 85.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6455.7
Applied rewrites55.7%
Applied rewrites77.2%
if 1.2e-21 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites91.7%
Applied rewrites91.6%
Taylor expanded in y around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.5%
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (if (<= x_m 1.36e+93) (sinh y) (* (- (+ 1.0 y) (fma (- (* 0.5 y) 1.0) y 1.0)) 0.5)))
x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 1.36e+93) {
tmp = sinh(y);
} else {
tmp = ((1.0 + y) - fma(((0.5 * y) - 1.0), y, 1.0)) * 0.5;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 1.36e+93) tmp = sinh(y); else tmp = Float64(Float64(Float64(1.0 + y) - fma(Float64(Float64(0.5 * y) - 1.0), y, 1.0)) * 0.5); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 1.36e+93], N[Sinh[y], $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] - N[(N[(N[(0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 1.36 \cdot 10^{+93}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + y\right) - \mathsf{fma}\left(0.5 \cdot y - 1, y, 1\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 1.3599999999999999e93Initial program 87.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6454.3
Applied rewrites54.3%
Applied rewrites73.8%
if 1.3599999999999999e93 < x Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6460.6
Applied rewrites60.6%
Taylor expanded in y around 0
Applied rewrites52.0%
Taylor expanded in y around 0
Applied rewrites63.1%
x_m = (fabs.f64 x)
(FPCore (x_m y)
:precision binary64
(if (<= x_m 1.36e+93)
(*
(*
(fma
(fma
(fma 0.0003968253968253968 (* y y) 0.016666666666666666)
(* y y)
0.3333333333333333)
(* y y)
2.0)
y)
0.5)
(* (- (+ 1.0 y) (fma (- (* 0.5 y) 1.0) y 1.0)) 0.5)))x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 1.36e+93) {
tmp = (fma(fma(fma(0.0003968253968253968, (y * y), 0.016666666666666666), (y * y), 0.3333333333333333), (y * y), 2.0) * y) * 0.5;
} else {
tmp = ((1.0 + y) - fma(((0.5 * y) - 1.0), y, 1.0)) * 0.5;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 1.36e+93) tmp = Float64(Float64(fma(fma(fma(0.0003968253968253968, Float64(y * y), 0.016666666666666666), Float64(y * y), 0.3333333333333333), Float64(y * y), 2.0) * y) * 0.5); else tmp = Float64(Float64(Float64(1.0 + y) - fma(Float64(Float64(0.5 * y) - 1.0), y, 1.0)) * 0.5); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 1.36e+93], N[(N[(N[(N[(N[(0.0003968253968253968 * N[(y * y), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 2.0), $MachinePrecision] * y), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] - N[(N[(N[(0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 1.36 \cdot 10^{+93}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968, y \cdot y, 0.016666666666666666\right), y \cdot y, 0.3333333333333333\right), y \cdot y, 2\right) \cdot y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + y\right) - \mathsf{fma}\left(0.5 \cdot y - 1, y, 1\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 1.3599999999999999e93Initial program 87.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6454.3
Applied rewrites54.3%
Taylor expanded in y around 0
Applied rewrites68.9%
if 1.3599999999999999e93 < x Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6460.6
Applied rewrites60.6%
Taylor expanded in y around 0
Applied rewrites52.0%
Taylor expanded in y around 0
Applied rewrites63.1%
x_m = (fabs.f64 x)
(FPCore (x_m y)
:precision binary64
(if (<= x_m 1.36e+93)
(*
(fma (fma 0.008333333333333333 (* y y) 0.16666666666666666) (* y y) 1.0)
y)
(* (- (+ 1.0 y) (fma (- (* 0.5 y) 1.0) y 1.0)) 0.5)))x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 1.36e+93) {
tmp = fma(fma(0.008333333333333333, (y * y), 0.16666666666666666), (y * y), 1.0) * y;
} else {
tmp = ((1.0 + y) - fma(((0.5 * y) - 1.0), y, 1.0)) * 0.5;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 1.36e+93) tmp = Float64(fma(fma(0.008333333333333333, Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0) * y); else tmp = Float64(Float64(Float64(1.0 + y) - fma(Float64(Float64(0.5 * y) - 1.0), y, 1.0)) * 0.5); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 1.36e+93], N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] - N[(N[(N[(0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 1.36 \cdot 10^{+93}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + y\right) - \mathsf{fma}\left(0.5 \cdot y - 1, y, 1\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 1.3599999999999999e93Initial program 87.1%
Taylor expanded in y around 0
Applied rewrites90.0%
Taylor expanded in x around 0
Applied rewrites67.9%
if 1.3599999999999999e93 < x Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6460.6
Applied rewrites60.6%
Taylor expanded in y around 0
Applied rewrites52.0%
Taylor expanded in y around 0
Applied rewrites63.1%
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (if (<= x_m 5.1e+46) (* (* (fma 0.3333333333333333 (* y y) 2.0) y) 0.5) (* (- (+ 1.0 y) (fma (- (* 0.5 y) 1.0) y 1.0)) 0.5)))
x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 5.1e+46) {
tmp = (fma(0.3333333333333333, (y * y), 2.0) * y) * 0.5;
} else {
tmp = ((1.0 + y) - fma(((0.5 * y) - 1.0), y, 1.0)) * 0.5;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 5.1e+46) tmp = Float64(Float64(fma(0.3333333333333333, Float64(y * y), 2.0) * y) * 0.5); else tmp = Float64(Float64(Float64(1.0 + y) - fma(Float64(Float64(0.5 * y) - 1.0), y, 1.0)) * 0.5); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 5.1e+46], N[(N[(N[(0.3333333333333333 * N[(y * y), $MachinePrecision] + 2.0), $MachinePrecision] * y), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] - N[(N[(N[(0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 5.1 \cdot 10^{+46}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.3333333333333333, y \cdot y, 2\right) \cdot y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + y\right) - \mathsf{fma}\left(0.5 \cdot y - 1, y, 1\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 5.0999999999999997e46Initial program 86.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6454.5
Applied rewrites54.5%
Taylor expanded in y around 0
Applied rewrites62.4%
if 5.0999999999999997e46 < x Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6458.5
Applied rewrites58.5%
Taylor expanded in y around 0
Applied rewrites46.7%
Taylor expanded in y around 0
Applied rewrites56.9%
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (if (<= x_m 240000.0) (* (* (fma 0.3333333333333333 (* y y) 2.0) y) 0.5) (* (- (fma (fma 0.5 y 1.0) y 1.0) (- 1.0 y)) 0.5)))
x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 240000.0) {
tmp = (fma(0.3333333333333333, (y * y), 2.0) * y) * 0.5;
} else {
tmp = (fma(fma(0.5, y, 1.0), y, 1.0) - (1.0 - y)) * 0.5;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 240000.0) tmp = Float64(Float64(fma(0.3333333333333333, Float64(y * y), 2.0) * y) * 0.5); else tmp = Float64(Float64(fma(fma(0.5, y, 1.0), y, 1.0) - Float64(1.0 - y)) * 0.5); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 240000.0], N[(N[(N[(0.3333333333333333 * N[(y * y), $MachinePrecision] + 2.0), $MachinePrecision] * y), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(N[(0.5 * y + 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision] - N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 240000:\\
\;\;\;\;\left(\mathsf{fma}\left(0.3333333333333333, y \cdot y, 2\right) \cdot y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(0.5, y, 1\right), y, 1\right) - \left(1 - y\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 2.4e5Initial program 85.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6455.4
Applied rewrites55.4%
Taylor expanded in y around 0
Applied rewrites64.2%
if 2.4e5 < x Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6455.3
Applied rewrites55.3%
Taylor expanded in y around 0
Applied rewrites42.0%
Taylor expanded in y around 0
Applied rewrites31.8%
Taylor expanded in y around 0
Applied rewrites40.4%
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (if (<= x_m 3.05e+109) (* (* (fma 0.3333333333333333 (* y y) 2.0) y) 0.5) (* (- (+ 1.0 y) (- 1.0 y)) 0.5)))
x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 3.05e+109) {
tmp = (fma(0.3333333333333333, (y * y), 2.0) * y) * 0.5;
} else {
tmp = ((1.0 + y) - (1.0 - y)) * 0.5;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 3.05e+109) tmp = Float64(Float64(fma(0.3333333333333333, Float64(y * y), 2.0) * y) * 0.5); else tmp = Float64(Float64(Float64(1.0 + y) - Float64(1.0 - y)) * 0.5); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 3.05e+109], N[(N[(N[(0.3333333333333333 * N[(y * y), $MachinePrecision] + 2.0), $MachinePrecision] * y), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] - N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 3.05 \cdot 10^{+109}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.3333333333333333, y \cdot y, 2\right) \cdot y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + y\right) - \left(1 - y\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 3.05000000000000004e109Initial program 87.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6453.8
Applied rewrites53.8%
Taylor expanded in y around 0
Applied rewrites59.9%
if 3.05000000000000004e109 < x Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6463.3
Applied rewrites63.3%
Taylor expanded in y around 0
Applied rewrites54.3%
Taylor expanded in y around 0
Applied rewrites43.2%
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (if (<= x_m 7.5e+50) (fma (* y -0.16666666666666666) (* x_m x_m) y) (* (- (+ 1.0 y) (- 1.0 y)) 0.5)))
x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 7.5e+50) {
tmp = fma((y * -0.16666666666666666), (x_m * x_m), y);
} else {
tmp = ((1.0 + y) - (1.0 - y)) * 0.5;
}
return tmp;
}
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 7.5e+50) tmp = fma(Float64(y * -0.16666666666666666), Float64(x_m * x_m), y); else tmp = Float64(Float64(Float64(1.0 + y) - Float64(1.0 - y)) * 0.5); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 7.5e+50], N[(N[(y * -0.16666666666666666), $MachinePrecision] * N[(x$95$m * x$95$m), $MachinePrecision] + y), $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] - N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 7.5 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot -0.16666666666666666, x\_m \cdot x\_m, y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + y\right) - \left(1 - y\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 7.4999999999999999e50Initial program 86.4%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in x around 0
Applied rewrites40.8%
Taylor expanded in x around 0
Applied rewrites39.3%
if 7.4999999999999999e50 < x Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6459.6
Applied rewrites59.6%
Taylor expanded in y around 0
Applied rewrites47.5%
Taylor expanded in y around 0
Applied rewrites35.7%
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (if (<= x_m 240000.0) (* 1.0 y) (* (- (+ 1.0 y) (- 1.0 y)) 0.5)))
x_m = fabs(x);
double code(double x_m, double y) {
double tmp;
if (x_m <= 240000.0) {
tmp = 1.0 * y;
} else {
tmp = ((1.0 + y) - (1.0 - y)) * 0.5;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8) :: tmp
if (x_m <= 240000.0d0) then
tmp = 1.0d0 * y
else
tmp = ((1.0d0 + y) - (1.0d0 - y)) * 0.5d0
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y) {
double tmp;
if (x_m <= 240000.0) {
tmp = 1.0 * y;
} else {
tmp = ((1.0 + y) - (1.0 - y)) * 0.5;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y): tmp = 0 if x_m <= 240000.0: tmp = 1.0 * y else: tmp = ((1.0 + y) - (1.0 - y)) * 0.5 return tmp
x_m = abs(x) function code(x_m, y) tmp = 0.0 if (x_m <= 240000.0) tmp = Float64(1.0 * y); else tmp = Float64(Float64(Float64(1.0 + y) - Float64(1.0 - y)) * 0.5); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y) tmp = 0.0; if (x_m <= 240000.0) tmp = 1.0 * y; else tmp = ((1.0 + y) - (1.0 - y)) * 0.5; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := If[LessEqual[x$95$m, 240000.0], N[(1.0 * y), $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] - N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 240000:\\
\;\;\;\;1 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + y\right) - \left(1 - y\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 2.4e5Initial program 85.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f6450.5
Applied rewrites50.5%
Taylor expanded in x around 0
Applied rewrites35.1%
if 2.4e5 < x Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
rec-expN/A
lower-exp.f64N/A
lower-neg.f6455.3
Applied rewrites55.3%
Taylor expanded in y around 0
Applied rewrites42.0%
Taylor expanded in y around 0
Applied rewrites31.8%
x_m = (fabs.f64 x) (FPCore (x_m y) :precision binary64 (* 1.0 y))
x_m = fabs(x);
double code(double x_m, double y) {
return 1.0 * y;
}
x_m = abs(x)
real(8) function code(x_m, y)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
code = 1.0d0 * y
end function
x_m = Math.abs(x);
public static double code(double x_m, double y) {
return 1.0 * y;
}
x_m = math.fabs(x) def code(x_m, y): return 1.0 * y
x_m = abs(x) function code(x_m, y) return Float64(1.0 * y) end
x_m = abs(x); function tmp = code(x_m, y) tmp = 1.0 * y; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_] := N[(1.0 * y), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
1 \cdot y
\end{array}
Initial program 89.3%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f6451.0
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites27.5%
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) x)))
double code(double x, double y) {
return sin(x) * (sinh(y) / x);
}
real(8) function code(x, y)
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 2024320
(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))