
(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 11 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 (* (/ (sin y) y) (cosh x)))
double code(double x, double y) {
return (sin(y) / y) * cosh(x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(y) / y) * cosh(x)
end function
public static double code(double x, double y) {
return (Math.sin(y) / y) * Math.cosh(x);
}
def code(x, y): return (math.sin(y) / y) * math.cosh(x)
function code(x, y) return Float64(Float64(sin(y) / y) * cosh(x)) end
function tmp = code(x, y) tmp = (sin(y) / y) * cosh(x); end
code[x_, y_] := N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin y}{y} \cdot \cosh x
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= x 3.5e-9) (/ (sin y) y) (if (<= x 1.4e+154) (cosh x) (* 0.5 (/ (* (sin y) (* x x)) y)))))
double code(double x, double y) {
double tmp;
if (x <= 3.5e-9) {
tmp = sin(y) / y;
} else if (x <= 1.4e+154) {
tmp = cosh(x);
} else {
tmp = 0.5 * ((sin(y) * (x * x)) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 3.5d-9) then
tmp = sin(y) / y
else if (x <= 1.4d+154) then
tmp = cosh(x)
else
tmp = 0.5d0 * ((sin(y) * (x * x)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 3.5e-9) {
tmp = Math.sin(y) / y;
} else if (x <= 1.4e+154) {
tmp = Math.cosh(x);
} else {
tmp = 0.5 * ((Math.sin(y) * (x * x)) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 3.5e-9: tmp = math.sin(y) / y elif x <= 1.4e+154: tmp = math.cosh(x) else: tmp = 0.5 * ((math.sin(y) * (x * x)) / y) return tmp
function code(x, y) tmp = 0.0 if (x <= 3.5e-9) tmp = Float64(sin(y) / y); elseif (x <= 1.4e+154) tmp = cosh(x); else tmp = Float64(0.5 * Float64(Float64(sin(y) * Float64(x * x)) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 3.5e-9) tmp = sin(y) / y; elseif (x <= 1.4e+154) tmp = cosh(x); else tmp = 0.5 * ((sin(y) * (x * x)) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 3.5e-9], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 1.4e+154], N[Cosh[x], $MachinePrecision], N[(0.5 * N[(N[(N[Sin[y], $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\cosh x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\sin y \cdot \left(x \cdot x\right)}{y}\\
\end{array}
\end{array}
if x < 3.4999999999999999e-9Initial program 99.9%
Taylor expanded in x around 0 85.0%
unpow285.0%
Simplified85.0%
clear-num85.0%
associate-/r/84.9%
Applied egg-rr84.9%
/-rgt-identity84.9%
associate-/r/85.0%
Applied egg-rr85.0%
Taylor expanded in x around 0 69.3%
if 3.4999999999999999e-9 < x < 1.4e154Initial program 100.0%
Taylor expanded in y around 0 75.1%
if 1.4e154 < 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%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification74.1%
(FPCore (x y)
:precision binary64
(if (<= x 3.5e-9)
(/ (sin y) y)
(if (<= x 4e+153)
(* (+ 1.0 (* -0.16666666666666666 (* y y))) (cosh x))
(* 0.5 (/ (* (sin y) (* x x)) y)))))
double code(double x, double y) {
double tmp;
if (x <= 3.5e-9) {
tmp = sin(y) / y;
} else if (x <= 4e+153) {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * cosh(x);
} else {
tmp = 0.5 * ((sin(y) * (x * x)) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 3.5d-9) then
tmp = sin(y) / y
else if (x <= 4d+153) then
tmp = (1.0d0 + ((-0.16666666666666666d0) * (y * y))) * cosh(x)
else
tmp = 0.5d0 * ((sin(y) * (x * x)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 3.5e-9) {
tmp = Math.sin(y) / y;
} else if (x <= 4e+153) {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * Math.cosh(x);
} else {
tmp = 0.5 * ((Math.sin(y) * (x * x)) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 3.5e-9: tmp = math.sin(y) / y elif x <= 4e+153: tmp = (1.0 + (-0.16666666666666666 * (y * y))) * math.cosh(x) else: tmp = 0.5 * ((math.sin(y) * (x * x)) / y) return tmp
function code(x, y) tmp = 0.0 if (x <= 3.5e-9) tmp = Float64(sin(y) / y); elseif (x <= 4e+153) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))) * cosh(x)); else tmp = Float64(0.5 * Float64(Float64(sin(y) * Float64(x * x)) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 3.5e-9) tmp = sin(y) / y; elseif (x <= 4e+153) tmp = (1.0 + (-0.16666666666666666 * (y * y))) * cosh(x); else tmp = 0.5 * ((sin(y) * (x * x)) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 3.5e-9], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 4e+153], N[(N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(N[Sin[y], $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+153}:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \cosh x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\sin y \cdot \left(x \cdot x\right)}{y}\\
\end{array}
\end{array}
if x < 3.4999999999999999e-9Initial program 99.9%
Taylor expanded in x around 0 85.0%
unpow285.0%
Simplified85.0%
clear-num85.0%
associate-/r/84.9%
Applied egg-rr84.9%
/-rgt-identity84.9%
associate-/r/85.0%
Applied egg-rr85.0%
Taylor expanded in x around 0 69.3%
if 3.4999999999999999e-9 < x < 4e153Initial program 100.0%
Taylor expanded in y around 0 75.1%
unpow221.8%
Simplified75.1%
if 4e153 < 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%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification74.1%
(FPCore (x y)
:precision binary64
(if (<= x 3.5e-9)
(/ (sin y) y)
(if (<= x 1.44e+150)
(* (+ 1.0 (* -0.16666666666666666 (* y y))) (cosh x))
(* (sin y) (* (/ (* x x) y) 0.5)))))
double code(double x, double y) {
double tmp;
if (x <= 3.5e-9) {
tmp = sin(y) / y;
} else if (x <= 1.44e+150) {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * cosh(x);
} else {
tmp = sin(y) * (((x * x) / y) * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 3.5d-9) then
tmp = sin(y) / y
else if (x <= 1.44d+150) then
tmp = (1.0d0 + ((-0.16666666666666666d0) * (y * y))) * cosh(x)
else
tmp = sin(y) * (((x * x) / y) * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 3.5e-9) {
tmp = Math.sin(y) / y;
} else if (x <= 1.44e+150) {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * Math.cosh(x);
} else {
tmp = Math.sin(y) * (((x * x) / y) * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 3.5e-9: tmp = math.sin(y) / y elif x <= 1.44e+150: tmp = (1.0 + (-0.16666666666666666 * (y * y))) * math.cosh(x) else: tmp = math.sin(y) * (((x * x) / y) * 0.5) return tmp
function code(x, y) tmp = 0.0 if (x <= 3.5e-9) tmp = Float64(sin(y) / y); elseif (x <= 1.44e+150) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))) * cosh(x)); else tmp = Float64(sin(y) * Float64(Float64(Float64(x * x) / y) * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 3.5e-9) tmp = sin(y) / y; elseif (x <= 1.44e+150) tmp = (1.0 + (-0.16666666666666666 * (y * y))) * cosh(x); else tmp = sin(y) * (((x * x) / y) * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 3.5e-9], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 1.44e+150], N[(N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 1.44 \cdot 10^{+150}:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \cosh x\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \left(\frac{x \cdot x}{y} \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 3.4999999999999999e-9Initial program 99.9%
Taylor expanded in x around 0 85.0%
unpow285.0%
Simplified85.0%
clear-num85.0%
associate-/r/84.9%
Applied egg-rr84.9%
/-rgt-identity84.9%
associate-/r/85.0%
Applied egg-rr85.0%
Taylor expanded in x around 0 69.3%
if 3.4999999999999999e-9 < x < 1.43999999999999998e150Initial program 100.0%
Taylor expanded in y around 0 77.5%
unpow222.5%
Simplified77.5%
if 1.43999999999999998e150 < x Initial program 100.0%
Taylor expanded in x around 0 97.3%
unpow297.3%
Simplified97.3%
Taylor expanded in x around inf 97.3%
unpow297.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in y around inf 97.3%
*-commutative97.3%
unpow297.3%
*-commutative97.3%
associate-*r/97.3%
associate-*l*97.3%
Simplified97.3%
Final simplification74.1%
(FPCore (x y) :precision binary64 (if (<= x 3.5e-9) (/ (sin y) y) (cosh x)))
double code(double x, double y) {
double tmp;
if (x <= 3.5e-9) {
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 (x <= 3.5d-9) 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 (x <= 3.5e-9) {
tmp = Math.sin(y) / y;
} else {
tmp = Math.cosh(x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 3.5e-9: tmp = math.sin(y) / y else: tmp = math.cosh(x) return tmp
function code(x, y) tmp = 0.0 if (x <= 3.5e-9) tmp = Float64(sin(y) / y); else tmp = cosh(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 3.5e-9) tmp = sin(y) / y; else tmp = cosh(x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 3.5e-9], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], N[Cosh[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;\cosh x\\
\end{array}
\end{array}
if x < 3.4999999999999999e-9Initial program 99.9%
Taylor expanded in x around 0 85.0%
unpow285.0%
Simplified85.0%
clear-num85.0%
associate-/r/84.9%
Applied egg-rr84.9%
/-rgt-identity84.9%
associate-/r/85.0%
Applied egg-rr85.0%
Taylor expanded in x around 0 69.3%
if 3.4999999999999999e-9 < x Initial program 100.0%
Taylor expanded in y around 0 80.3%
Final simplification72.1%
(FPCore (x y) :precision binary64 (if (<= y 2.25e+112) (cosh x) (* (+ 1.0 (* -0.16666666666666666 (* y y))) (+ 1.0 (* (* x x) 0.5)))))
double code(double x, double y) {
double tmp;
if (y <= 2.25e+112) {
tmp = cosh(x);
} else {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + ((x * x) * 0.5));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.25d+112) then
tmp = cosh(x)
else
tmp = (1.0d0 + ((-0.16666666666666666d0) * (y * y))) * (1.0d0 + ((x * x) * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.25e+112) {
tmp = Math.cosh(x);
} else {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + ((x * x) * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.25e+112: tmp = math.cosh(x) else: tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + ((x * x) * 0.5)) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.25e+112) tmp = cosh(x); else tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))) * Float64(1.0 + Float64(Float64(x * x) * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.25e+112) tmp = cosh(x); else tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + ((x * x) * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.25e+112], N[Cosh[x], $MachinePrecision], N[(N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.25 \cdot 10^{+112}:\\
\;\;\;\;\cosh x\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(1 + \left(x \cdot x\right) \cdot 0.5\right)\\
\end{array}
\end{array}
if y < 2.24999999999999995e112Initial program 99.9%
Taylor expanded in y around 0 73.0%
if 2.24999999999999995e112 < y Initial program 99.7%
Taylor expanded in x around 0 81.6%
unpow281.6%
Simplified81.6%
Taylor expanded in y around 0 26.5%
unpow226.5%
Simplified26.5%
Final simplification65.2%
(FPCore (x y) :precision binary64 (if (<= x 9.5e+57) (* (+ 1.0 (* -0.16666666666666666 (* y y))) (+ 1.0 (* (* x x) 0.5))) (* y (* (/ (* x x) y) 0.5))))
double code(double x, double y) {
double tmp;
if (x <= 9.5e+57) {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + ((x * x) * 0.5));
} else {
tmp = y * (((x * x) / y) * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 9.5d+57) then
tmp = (1.0d0 + ((-0.16666666666666666d0) * (y * y))) * (1.0d0 + ((x * x) * 0.5d0))
else
tmp = y * (((x * x) / y) * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 9.5e+57) {
tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + ((x * x) * 0.5));
} else {
tmp = y * (((x * x) / y) * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 9.5e+57: tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + ((x * x) * 0.5)) else: tmp = y * (((x * x) / y) * 0.5) return tmp
function code(x, y) tmp = 0.0 if (x <= 9.5e+57) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))) * Float64(1.0 + Float64(Float64(x * x) * 0.5))); else tmp = Float64(y * Float64(Float64(Float64(x * x) / y) * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 9.5e+57) tmp = (1.0 + (-0.16666666666666666 * (y * y))) * (1.0 + ((x * x) * 0.5)); else tmp = y * (((x * x) / y) * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 9.5e+57], N[(N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.5 \cdot 10^{+57}:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(1 + \left(x \cdot x\right) \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x \cdot x}{y} \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 9.4999999999999997e57Initial program 99.9%
Taylor expanded in x around 0 80.6%
unpow280.6%
Simplified80.6%
Taylor expanded in y around 0 51.8%
unpow251.8%
Simplified51.8%
if 9.4999999999999997e57 < x Initial program 100.0%
Taylor expanded in x around 0 63.8%
unpow263.8%
Simplified63.8%
Taylor expanded in x around inf 63.8%
unpow263.8%
*-commutative63.8%
Simplified63.8%
Taylor expanded in y around inf 63.8%
*-commutative63.8%
unpow263.8%
*-commutative63.8%
associate-*r/79.2%
associate-*l*79.2%
Simplified79.2%
Taylor expanded in y around 0 70.0%
Final simplification55.7%
(FPCore (x y) :precision binary64 (if (<= y 4e-90) (* y (* (/ (* x x) y) 0.5)) (* 0.5 (/ (* y (* x x)) y))))
double code(double x, double y) {
double tmp;
if (y <= 4e-90) {
tmp = y * (((x * x) / y) * 0.5);
} else {
tmp = 0.5 * ((y * (x * x)) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 4d-90) then
tmp = y * (((x * x) / y) * 0.5d0)
else
tmp = 0.5d0 * ((y * (x * x)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 4e-90) {
tmp = y * (((x * x) / y) * 0.5);
} else {
tmp = 0.5 * ((y * (x * x)) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 4e-90: tmp = y * (((x * x) / y) * 0.5) else: tmp = 0.5 * ((y * (x * x)) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= 4e-90) tmp = Float64(y * Float64(Float64(Float64(x * x) / y) * 0.5)); else tmp = Float64(0.5 * Float64(Float64(y * Float64(x * x)) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 4e-90) tmp = y * (((x * x) / y) * 0.5); else tmp = 0.5 * ((y * (x * x)) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 4e-90], N[(y * N[(N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{-90}:\\
\;\;\;\;y \cdot \left(\frac{x \cdot x}{y} \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot \left(x \cdot x\right)}{y}\\
\end{array}
\end{array}
if y < 3.99999999999999998e-90Initial program 99.9%
Taylor expanded in x around 0 73.6%
unpow273.6%
Simplified73.6%
Taylor expanded in x around inf 26.3%
unpow226.3%
*-commutative26.3%
Simplified26.3%
Taylor expanded in y around inf 26.3%
*-commutative26.3%
unpow226.3%
*-commutative26.3%
associate-*r/35.6%
associate-*l*35.6%
Simplified35.6%
Taylor expanded in y around 0 32.0%
if 3.99999999999999998e-90 < y Initial program 99.8%
Taylor expanded in x around 0 84.2%
unpow284.2%
Simplified84.2%
Taylor expanded in x around inf 33.9%
unpow233.9%
*-commutative33.9%
Simplified33.9%
Taylor expanded in y around 0 27.1%
unpow227.1%
*-commutative27.1%
Simplified27.1%
Final simplification30.4%
(FPCore (x y) :precision binary64 (if (<= x 2.45) (+ 1.0 (* (* x x) 0.5)) (* y (* (/ (* x x) y) 0.5))))
double code(double x, double y) {
double tmp;
if (x <= 2.45) {
tmp = 1.0 + ((x * x) * 0.5);
} else {
tmp = y * (((x * x) / y) * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 2.45d0) then
tmp = 1.0d0 + ((x * x) * 0.5d0)
else
tmp = y * (((x * x) / y) * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 2.45) {
tmp = 1.0 + ((x * x) * 0.5);
} else {
tmp = y * (((x * x) / y) * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.45: tmp = 1.0 + ((x * x) * 0.5) else: tmp = y * (((x * x) / y) * 0.5) return tmp
function code(x, y) tmp = 0.0 if (x <= 2.45) tmp = Float64(1.0 + Float64(Float64(x * x) * 0.5)); else tmp = Float64(y * Float64(Float64(Float64(x * x) / y) * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 2.45) tmp = 1.0 + ((x * x) * 0.5); else tmp = y * (((x * x) / y) * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.45], N[(1.0 + N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.45:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x \cdot x}{y} \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 2.4500000000000002Initial program 99.9%
Taylor expanded in y around 0 58.5%
Taylor expanded in x around 0 48.4%
unpow285.0%
Simplified48.4%
if 2.4500000000000002 < x Initial program 100.0%
Taylor expanded in x around 0 53.9%
unpow253.9%
Simplified53.9%
Taylor expanded in x around inf 53.9%
unpow253.9%
*-commutative53.9%
Simplified53.9%
Taylor expanded in y around inf 53.9%
*-commutative53.9%
unpow253.9%
*-commutative53.9%
associate-*r/68.2%
associate-*l*68.2%
Simplified68.2%
Taylor expanded in y around 0 60.2%
Final simplification51.4%
(FPCore (x y) :precision binary64 (* 0.5 (/ (* y (* x x)) y)))
double code(double x, double y) {
return 0.5 * ((y * (x * x)) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.5d0 * ((y * (x * x)) / y)
end function
public static double code(double x, double y) {
return 0.5 * ((y * (x * x)) / y);
}
def code(x, y): return 0.5 * ((y * (x * x)) / y)
function code(x, y) return Float64(0.5 * Float64(Float64(y * Float64(x * x)) / y)) end
function tmp = code(x, y) tmp = 0.5 * ((y * (x * x)) / y); end
code[x_, y_] := N[(0.5 * N[(N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{y \cdot \left(x \cdot x\right)}{y}
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 77.0%
unpow277.0%
Simplified77.0%
Taylor expanded in x around inf 28.8%
unpow228.8%
*-commutative28.8%
Simplified28.8%
Taylor expanded in y around 0 25.2%
unpow225.2%
*-commutative25.2%
Simplified25.2%
Final simplification25.2%
(FPCore (x y) :precision binary64 (* x (* x 0.5)))
double code(double x, double y) {
return x * (x * 0.5);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (x * 0.5d0)
end function
public static double code(double x, double y) {
return x * (x * 0.5);
}
def code(x, y): return x * (x * 0.5)
function code(x, y) return Float64(x * Float64(x * 0.5)) end
function tmp = code(x, y) tmp = x * (x * 0.5); end
code[x_, y_] := N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(x \cdot 0.5\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 77.0%
unpow277.0%
Simplified77.0%
Taylor expanded in x around inf 28.8%
unpow228.8%
*-commutative28.8%
Simplified28.8%
Taylor expanded in y around 0 23.1%
unpow223.1%
*-commutative23.1%
associate-*r*23.1%
Simplified23.1%
Final simplification23.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 2023271
(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)))