
(FPCore (x y) :precision binary64 (* (cosh x) (/ (sin y) y)))
double code(double x, double y) {
return cosh(x) * (sin(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cosh(x) * (sin(y) / y)
end function
public static double code(double x, double y) {
return Math.cosh(x) * (Math.sin(y) / y);
}
def code(x, y): return math.cosh(x) * (math.sin(y) / y)
function code(x, y) return Float64(cosh(x) * Float64(sin(y) / y)) end
function tmp = code(x, y) tmp = cosh(x) * (sin(y) / y); end
code[x_, y_] := N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cosh x \cdot \frac{\sin y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (cosh x) (/ (sin y) y)))
double code(double x, double y) {
return cosh(x) * (sin(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cosh(x) * (sin(y) / y)
end function
public static double code(double x, double y) {
return Math.cosh(x) * (Math.sin(y) / y);
}
def code(x, y): return math.cosh(x) * (math.sin(y) / y)
function code(x, y) return Float64(cosh(x) * Float64(sin(y) / y)) end
function tmp = code(x, y) tmp = cosh(x) * (sin(y) / y); end
code[x_, y_] := N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cosh x \cdot \frac{\sin y}{y}
\end{array}
(FPCore (x y) :precision binary64 (* (cosh x) (/ (sin y) y)))
double code(double x, double y) {
return cosh(x) * (sin(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cosh(x) * (sin(y) / y)
end function
public static double code(double x, double y) {
return Math.cosh(x) * (Math.sin(y) / y);
}
def code(x, y): return math.cosh(x) * (math.sin(y) / y)
function code(x, y) return Float64(cosh(x) * Float64(sin(y) / y)) end
function tmp = code(x, y) tmp = cosh(x) * (sin(y) / y); end
code[x_, y_] := N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cosh x \cdot \frac{\sin y}{y}
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= (cosh x) 1.0) (/ (sin y) y) (* (cosh x) (+ 1.0 (* -0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (cosh(x) <= 1.0) {
tmp = sin(y) / y;
} else {
tmp = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (cosh(x) <= 1.0d0) then
tmp = sin(y) / y
else
tmp = cosh(x) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.cosh(x) <= 1.0) {
tmp = Math.sin(y) / y;
} else {
tmp = Math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if math.cosh(x) <= 1.0: tmp = math.sin(y) / y else: tmp = math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (cosh(x) <= 1.0) tmp = Float64(sin(y) / y); else tmp = Float64(cosh(x) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (cosh(x) <= 1.0) tmp = sin(y) / y; else tmp = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Cosh[x], $MachinePrecision], 1.0], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cosh x \leq 1:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if (cosh.f64 x) < 1Initial program 99.8%
Taylor expanded in x around 0 99.8%
if 1 < (cosh.f64 x) Initial program 100.0%
Taylor expanded in y around 0 78.6%
unpow217.8%
Simplified78.6%
Final simplification87.5%
(FPCore (x y) :precision binary64 (if (<= (cosh x) 1.0) (/ (sin y) y) (cosh x)))
double code(double x, double y) {
double tmp;
if (cosh(x) <= 1.0) {
tmp = sin(y) / y;
} else {
tmp = cosh(x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (cosh(x) <= 1.0d0) then
tmp = sin(y) / y
else
tmp = cosh(x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.cosh(x) <= 1.0) {
tmp = Math.sin(y) / y;
} else {
tmp = Math.cosh(x);
}
return tmp;
}
def code(x, y): tmp = 0 if math.cosh(x) <= 1.0: tmp = math.sin(y) / y else: tmp = math.cosh(x) return tmp
function code(x, y) tmp = 0.0 if (cosh(x) <= 1.0) tmp = Float64(sin(y) / y); else tmp = cosh(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (cosh(x) <= 1.0) tmp = sin(y) / y; else tmp = cosh(x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Cosh[x], $MachinePrecision], 1.0], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], N[Cosh[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cosh x \leq 1:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;\cosh x\\
\end{array}
\end{array}
if (cosh.f64 x) < 1Initial program 99.8%
Taylor expanded in x around 0 99.8%
if 1 < (cosh.f64 x) Initial program 100.0%
Taylor expanded in y around 0 73.2%
Final simplification84.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (sin y) y))
(t_1 (* (cosh x) (+ 1.0 (* -0.16666666666666666 (* y y))))))
(if (<= x 2.05e-7)
t_0
(if (<= x 2e+70)
t_1
(if (<= x 2.5e+135)
(cosh x)
(if (<= x 1.35e+154) t_1 (* t_0 (* 0.5 (* x x)))))))))
double code(double x, double y) {
double t_0 = sin(y) / y;
double t_1 = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
double tmp;
if (x <= 2.05e-7) {
tmp = t_0;
} else if (x <= 2e+70) {
tmp = t_1;
} else if (x <= 2.5e+135) {
tmp = cosh(x);
} else if (x <= 1.35e+154) {
tmp = t_1;
} else {
tmp = t_0 * (0.5 * (x * x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin(y) / y
t_1 = cosh(x) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
if (x <= 2.05d-7) then
tmp = t_0
else if (x <= 2d+70) then
tmp = t_1
else if (x <= 2.5d+135) then
tmp = cosh(x)
else if (x <= 1.35d+154) then
tmp = t_1
else
tmp = t_0 * (0.5d0 * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sin(y) / y;
double t_1 = Math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
double tmp;
if (x <= 2.05e-7) {
tmp = t_0;
} else if (x <= 2e+70) {
tmp = t_1;
} else if (x <= 2.5e+135) {
tmp = Math.cosh(x);
} else if (x <= 1.35e+154) {
tmp = t_1;
} else {
tmp = t_0 * (0.5 * (x * x));
}
return tmp;
}
def code(x, y): t_0 = math.sin(y) / y t_1 = math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))) tmp = 0 if x <= 2.05e-7: tmp = t_0 elif x <= 2e+70: tmp = t_1 elif x <= 2.5e+135: tmp = math.cosh(x) elif x <= 1.35e+154: tmp = t_1 else: tmp = t_0 * (0.5 * (x * x)) return tmp
function code(x, y) t_0 = Float64(sin(y) / y) t_1 = Float64(cosh(x) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))) tmp = 0.0 if (x <= 2.05e-7) tmp = t_0; elseif (x <= 2e+70) tmp = t_1; elseif (x <= 2.5e+135) tmp = cosh(x); elseif (x <= 1.35e+154) tmp = t_1; else tmp = Float64(t_0 * Float64(0.5 * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) t_0 = sin(y) / y; t_1 = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))); tmp = 0.0; if (x <= 2.05e-7) tmp = t_0; elseif (x <= 2e+70) tmp = t_1; elseif (x <= 2.5e+135) tmp = cosh(x); elseif (x <= 1.35e+154) tmp = t_1; else tmp = t_0 * (0.5 * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cosh[x], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.05e-7], t$95$0, If[LessEqual[x, 2e+70], t$95$1, If[LessEqual[x, 2.5e+135], N[Cosh[x], $MachinePrecision], If[LessEqual[x, 1.35e+154], t$95$1, N[(t$95$0 * N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
t_1 := \cosh x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;x \leq 2.05 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+135}:\\
\;\;\;\;\cosh x\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if x < 2.05e-7Initial program 99.9%
Taylor expanded in x around 0 60.9%
if 2.05e-7 < x < 2.00000000000000015e70 or 2.50000000000000015e135 < x < 1.35000000000000003e154Initial program 99.9%
Taylor expanded in y around 0 82.5%
unpow231.2%
Simplified82.5%
if 2.00000000000000015e70 < x < 2.50000000000000015e135Initial program 100.0%
Taylor expanded in y around 0 84.6%
if 1.35000000000000003e154 < x Initial program 100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/r/100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification69.9%
(FPCore (x y) :precision binary64 (if (<= y 8.5e+242) (cosh x) (* (+ 1.0 (* -0.16666666666666666 (* y y))) (+ 1.0 (* 0.5 (* x x))))))
double code(double x, double y) {
double tmp;
if (y <= 8.5e+242) {
tmp = cosh(x);
} else {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + (0.5 * (x * x)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 8.5d+242) then
tmp = cosh(x)
else
tmp = (1.0d0 + ((-0.16666666666666666d0) * (y * y))) * (1.0d0 + (0.5d0 * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 8.5e+242) {
tmp = Math.cosh(x);
} else {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + (0.5 * (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 8.5e+242: tmp = math.cosh(x) else: tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + (0.5 * (x * x))) return tmp
function code(x, y) tmp = 0.0 if (y <= 8.5e+242) tmp = cosh(x); else tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))) * Float64(1.0 + Float64(0.5 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 8.5e+242) tmp = cosh(x); else tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + (0.5 * (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 8.5e+242], N[Cosh[x], $MachinePrecision], N[(N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.5 \cdot 10^{+242}:\\
\;\;\;\;\cosh x\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(1 + 0.5 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 8.5000000000000003e242Initial program 99.9%
Taylor expanded in y around 0 65.1%
if 8.5000000000000003e242 < y Initial program 99.9%
Taylor expanded in y around 0 56.8%
unpow256.8%
Simplified56.8%
Taylor expanded in x around 0 56.8%
unpow263.4%
Simplified56.8%
Final simplification64.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.5 (* x x))))
(if (<= y 14500000000.0)
(+ 1.0 t_0)
(* (+ 1.0 (* -0.16666666666666666 (* y y))) t_0))))
double code(double x, double y) {
double t_0 = 0.5 * (x * x);
double tmp;
if (y <= 14500000000.0) {
tmp = 1.0 + t_0;
} else {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (x * x)
if (y <= 14500000000.0d0) then
tmp = 1.0d0 + t_0
else
tmp = (1.0d0 + ((-0.16666666666666666d0) * (y * y))) * t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.5 * (x * x);
double tmp;
if (y <= 14500000000.0) {
tmp = 1.0 + t_0;
} else {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.5 * (x * x) tmp = 0 if y <= 14500000000.0: tmp = 1.0 + t_0 else: tmp = (1.0 + (-0.16666666666666666 * (y * y))) * t_0 return tmp
function code(x, y) t_0 = Float64(0.5 * Float64(x * x)) tmp = 0.0 if (y <= 14500000000.0) tmp = Float64(1.0 + t_0); else tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))) * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.5 * (x * x); tmp = 0.0; if (y <= 14500000000.0) tmp = 1.0 + t_0; else tmp = (1.0 + (-0.16666666666666666 * (y * y))) * t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 14500000000.0], N[(1.0 + t$95$0), $MachinePrecision], N[(N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;y \leq 14500000000:\\
\;\;\;\;1 + t_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot t_0\\
\end{array}
\end{array}
if y < 1.45e10Initial program 99.9%
Taylor expanded in y around 0 73.1%
Taylor expanded in x around 0 52.8%
unpow273.8%
Simplified52.8%
if 1.45e10 < y Initial program 99.8%
Taylor expanded in x around 0 67.7%
unpow267.7%
Simplified67.7%
Taylor expanded in x around inf 28.2%
*-commutative28.2%
associate-/l*28.2%
associate-/r/28.2%
associate-*r*28.2%
*-commutative28.2%
unpow228.2%
Simplified28.2%
Taylor expanded in y around 0 36.4%
unpow227.7%
Simplified36.4%
Final simplification49.1%
(FPCore (x y) :precision binary64 (* (+ 1.0 (* -0.16666666666666666 (* y y))) (+ 1.0 (* 0.5 (* x x)))))
double code(double x, double y) {
return (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + (0.5 * (x * x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 + ((-0.16666666666666666d0) * (y * y))) * (1.0d0 + (0.5d0 * (x * x)))
end function
public static double code(double x, double y) {
return (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + (0.5 * (x * x)));
}
def code(x, y): return (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + (0.5 * (x * x)))
function code(x, y) return Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))) * Float64(1.0 + Float64(0.5 * Float64(x * x)))) end
function tmp = code(x, y) tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + (0.5 * (x * x))); end
code[x_, y_] := N[(N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(1 + 0.5 \cdot \left(x \cdot x\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 64.7%
unpow229.2%
Simplified64.7%
Taylor expanded in x around 0 49.2%
unpow272.5%
Simplified49.2%
Final simplification49.2%
(FPCore (x y) :precision binary64 (if (<= y 14500000000.0) (+ 1.0 (* 0.5 (* x x))) (* (* x x) (+ 0.5 (* (* y y) -0.08333333333333333)))))
double code(double x, double y) {
double tmp;
if (y <= 14500000000.0) {
tmp = 1.0 + (0.5 * (x * x));
} else {
tmp = (x * x) * (0.5 + ((y * y) * -0.08333333333333333));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 14500000000.0d0) then
tmp = 1.0d0 + (0.5d0 * (x * x))
else
tmp = (x * x) * (0.5d0 + ((y * y) * (-0.08333333333333333d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 14500000000.0) {
tmp = 1.0 + (0.5 * (x * x));
} else {
tmp = (x * x) * (0.5 + ((y * y) * -0.08333333333333333));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 14500000000.0: tmp = 1.0 + (0.5 * (x * x)) else: tmp = (x * x) * (0.5 + ((y * y) * -0.08333333333333333)) return tmp
function code(x, y) tmp = 0.0 if (y <= 14500000000.0) tmp = Float64(1.0 + Float64(0.5 * Float64(x * x))); else tmp = Float64(Float64(x * x) * Float64(0.5 + Float64(Float64(y * y) * -0.08333333333333333))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 14500000000.0) tmp = 1.0 + (0.5 * (x * x)); else tmp = (x * x) * (0.5 + ((y * y) * -0.08333333333333333)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 14500000000.0], N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(0.5 + N[(N[(y * y), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 14500000000:\\
\;\;\;\;1 + 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(0.5 + \left(y \cdot y\right) \cdot -0.08333333333333333\right)\\
\end{array}
\end{array}
if y < 1.45e10Initial program 99.9%
Taylor expanded in y around 0 73.1%
Taylor expanded in x around 0 52.8%
unpow273.8%
Simplified52.8%
if 1.45e10 < y Initial program 99.8%
Taylor expanded in x around 0 67.7%
unpow267.7%
Simplified67.7%
Taylor expanded in x around inf 28.2%
*-commutative28.2%
associate-/l*28.2%
associate-/r/28.2%
associate-*r*28.2%
*-commutative28.2%
unpow228.2%
Simplified28.2%
Taylor expanded in y around 0 20.6%
+-commutative20.6%
associate-*r*20.6%
distribute-rgt-out36.4%
unpow236.4%
*-commutative36.4%
unpow236.4%
Simplified36.4%
Final simplification49.1%
(FPCore (x y) :precision binary64 (if (<= x 6e+153) (+ 1.0 (* -0.16666666666666666 (* y y))) (* 0.5 (* x x))))
double code(double x, double y) {
double tmp;
if (x <= 6e+153) {
tmp = 1.0 + (-0.16666666666666666 * (y * y));
} else {
tmp = 0.5 * (x * x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 6d+153) then
tmp = 1.0d0 + ((-0.16666666666666666d0) * (y * y))
else
tmp = 0.5d0 * (x * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 6e+153) {
tmp = 1.0 + (-0.16666666666666666 * (y * y));
} else {
tmp = 0.5 * (x * x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 6e+153: tmp = 1.0 + (-0.16666666666666666 * (y * y)) else: tmp = 0.5 * (x * x) return tmp
function code(x, y) tmp = 0.0 if (x <= 6e+153) tmp = Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))); else tmp = Float64(0.5 * Float64(x * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 6e+153) tmp = 1.0 + (-0.16666666666666666 * (y * y)); else tmp = 0.5 * (x * x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 6e+153], N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{+153}:\\
\;\;\;\;1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < 6.00000000000000037e153Initial program 99.9%
Taylor expanded in x around 0 50.8%
Taylor expanded in y around 0 30.7%
unpow230.7%
Simplified30.7%
if 6.00000000000000037e153 < x Initial program 100.0%
Taylor expanded in x around 0 97.8%
unpow297.8%
Simplified97.8%
Taylor expanded in x around inf 97.8%
*-commutative97.8%
associate-/l*100.0%
associate-/r/97.8%
associate-*r*97.8%
*-commutative97.8%
unpow297.8%
Simplified97.8%
Taylor expanded in y around 0 78.8%
unpow278.8%
Simplified78.8%
Final simplification37.7%
(FPCore (x y) :precision binary64 (if (<= y 1.25e+157) (+ 1.0 (* 0.5 (* x x))) (+ 1.0 (* -0.16666666666666666 (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 1.25e+157) {
tmp = 1.0 + (0.5 * (x * x));
} else {
tmp = 1.0 + (-0.16666666666666666 * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.25d+157) then
tmp = 1.0d0 + (0.5d0 * (x * x))
else
tmp = 1.0d0 + ((-0.16666666666666666d0) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.25e+157) {
tmp = 1.0 + (0.5 * (x * x));
} else {
tmp = 1.0 + (-0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.25e+157: tmp = 1.0 + (0.5 * (x * x)) else: tmp = 1.0 + (-0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.25e+157) tmp = Float64(1.0 + Float64(0.5 * Float64(x * x))); else tmp = Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.25e+157) tmp = 1.0 + (0.5 * (x * x)); else tmp = 1.0 + (-0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.25e+157], N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.25 \cdot 10^{+157}:\\
\;\;\;\;1 + 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 1.24999999999999994e157Initial program 99.9%
Taylor expanded in y around 0 67.9%
Taylor expanded in x around 0 48.1%
unpow273.3%
Simplified48.1%
if 1.24999999999999994e157 < y Initial program 99.9%
Taylor expanded in x around 0 35.4%
Taylor expanded in y around 0 47.5%
unpow247.5%
Simplified47.5%
Final simplification48.0%
(FPCore (x y) :precision binary64 (if (<= x 1.4) 1.0 (* 0.5 (* x x))))
double code(double x, double y) {
double tmp;
if (x <= 1.4) {
tmp = 1.0;
} else {
tmp = 0.5 * (x * x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 1.4d0) then
tmp = 1.0d0
else
tmp = 0.5d0 * (x * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1.4) {
tmp = 1.0;
} else {
tmp = 0.5 * (x * x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1.4: tmp = 1.0 else: tmp = 0.5 * (x * x) return tmp
function code(x, y) tmp = 0.0 if (x <= 1.4) tmp = 1.0; else tmp = Float64(0.5 * Float64(x * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1.4) tmp = 1.0; else tmp = 0.5 * (x * x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1.4], 1.0, N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 99.9%
Taylor expanded in x around 0 61.0%
Taylor expanded in y around 0 28.9%
if 1.3999999999999999 < x Initial program 100.0%
Taylor expanded in x around 0 50.2%
unpow250.2%
Simplified50.2%
Taylor expanded in x around inf 50.2%
*-commutative50.2%
associate-/l*57.4%
associate-/r/50.2%
associate-*r*50.2%
*-commutative50.2%
unpow250.2%
Simplified50.2%
Taylor expanded in y around 0 40.4%
unpow240.4%
Simplified40.4%
Final simplification32.3%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 43.8%
Taylor expanded in y around 0 21.1%
Final simplification21.1%
(FPCore (x y) :precision binary64 (/ (* (cosh x) (sin y)) y))
double code(double x, double y) {
return (cosh(x) * sin(y)) / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (cosh(x) * sin(y)) / y
end function
public static double code(double x, double y) {
return (Math.cosh(x) * Math.sin(y)) / y;
}
def code(x, y): return (math.cosh(x) * math.sin(y)) / y
function code(x, y) return Float64(Float64(cosh(x) * sin(y)) / y) end
function tmp = code(x, y) tmp = (cosh(x) * sin(y)) / y; end
code[x_, y_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \sin y}{y}
\end{array}
herbie shell --seed 2023221
(FPCore (x y)
:name "Linear.Quaternion:$csinh from linear-1.19.1.3"
:precision binary64
:herbie-target
(/ (* (cosh x) (sin y)) y)
(* (cosh x) (/ (sin y) y)))