
(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(sin(y) / Float64(y / cosh(x))) end
function tmp = code(x, y) tmp = sin(y) / (y / cosh(x)); end
code[x_, y_] := N[(N[Sin[y], $MachinePrecision] / N[(y / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin y}{\frac{y}{\cosh x}}
\end{array}
Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Final simplification99.9%
(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 (<= x 7e-10)
(/ (sin y) y)
(if (<= x 3e+133)
(* y (+ (/ 1.0 y) (* 0.5 (/ x (/ y x)))))
(* (sin y) (* y (* 0.5 (* x x)))))))
double code(double x, double y) {
double tmp;
if (x <= 7e-10) {
tmp = sin(y) / y;
} else if (x <= 3e+133) {
tmp = y * ((1.0 / y) + (0.5 * (x / (y / x))));
} else {
tmp = sin(y) * (y * (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 <= 7d-10) then
tmp = sin(y) / y
else if (x <= 3d+133) then
tmp = y * ((1.0d0 / y) + (0.5d0 * (x / (y / x))))
else
tmp = sin(y) * (y * (0.5d0 * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 7e-10) {
tmp = Math.sin(y) / y;
} else if (x <= 3e+133) {
tmp = y * ((1.0 / y) + (0.5 * (x / (y / x))));
} else {
tmp = Math.sin(y) * (y * (0.5 * (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 7e-10: tmp = math.sin(y) / y elif x <= 3e+133: tmp = y * ((1.0 / y) + (0.5 * (x / (y / x)))) else: tmp = math.sin(y) * (y * (0.5 * (x * x))) return tmp
function code(x, y) tmp = 0.0 if (x <= 7e-10) tmp = Float64(sin(y) / y); elseif (x <= 3e+133) tmp = Float64(y * Float64(Float64(1.0 / y) + Float64(0.5 * Float64(x / Float64(y / x))))); else tmp = Float64(sin(y) * Float64(y * Float64(0.5 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 7e-10) tmp = sin(y) / y; elseif (x <= 3e+133) tmp = y * ((1.0 / y) + (0.5 * (x / (y / x)))); else tmp = sin(y) * (y * (0.5 * (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 7e-10], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 3e+133], N[(y * N[(N[(1.0 / y), $MachinePrecision] + N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(y * N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+133}:\\
\;\;\;\;y \cdot \left(\frac{1}{y} + 0.5 \cdot \frac{x}{\frac{y}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \left(y \cdot \left(0.5 \cdot \left(x \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if x < 6.99999999999999961e-10Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 67.5%
if 6.99999999999999961e-10 < x < 3.00000000000000007e133Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 29.3%
unpow229.3%
Simplified29.3%
Taylor expanded in x around 0 29.3%
unpow229.3%
associate-/l*29.3%
Simplified29.3%
Taylor expanded in y around 0 29.1%
if 3.00000000000000007e133 < x Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
unpow2100.0%
Simplified100.0%
expm1-log1p-u81.3%
expm1-udef81.3%
Applied egg-rr81.3%
expm1-def81.3%
expm1-log1p100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification67.2%
(FPCore (x y) :precision binary64 (if (<= x 500000.0) (/ (+ 1.0 (* 0.5 (* x x))) (/ y (sin y))) (* (sin y) (* 0.5 (/ (* x x) y)))))
double code(double x, double y) {
double tmp;
if (x <= 500000.0) {
tmp = (1.0 + (0.5 * (x * x))) / (y / sin(y));
} else {
tmp = sin(y) * (0.5 * ((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 <= 500000.0d0) then
tmp = (1.0d0 + (0.5d0 * (x * x))) / (y / sin(y))
else
tmp = sin(y) * (0.5d0 * ((x * x) / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 500000.0) {
tmp = (1.0 + (0.5 * (x * x))) / (y / Math.sin(y));
} else {
tmp = Math.sin(y) * (0.5 * ((x * x) / y));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 500000.0: tmp = (1.0 + (0.5 * (x * x))) / (y / math.sin(y)) else: tmp = math.sin(y) * (0.5 * ((x * x) / y)) return tmp
function code(x, y) tmp = 0.0 if (x <= 500000.0) tmp = Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / Float64(y / sin(y))); else tmp = Float64(sin(y) * Float64(0.5 * Float64(Float64(x * x) / y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 500000.0) tmp = (1.0 + (0.5 * (x * x))) / (y / sin(y)); else tmp = sin(y) * (0.5 * ((x * x) / y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 500000.0], N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(0.5 * N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 500000:\\
\;\;\;\;\frac{1 + 0.5 \cdot \left(x \cdot x\right)}{\frac{y}{\sin y}}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \left(0.5 \cdot \frac{x \cdot x}{y}\right)\\
\end{array}
\end{array}
if x < 5e5Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 87.5%
unpow287.5%
Simplified87.5%
Taylor expanded in y around inf 83.9%
associate-/l*83.7%
unpow283.7%
Simplified83.7%
if 5e5 < x Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 67.9%
unpow267.9%
Simplified67.9%
Taylor expanded in x around inf 67.9%
unpow267.9%
Simplified67.9%
Final simplification80.2%
(FPCore (x y) :precision binary64 (* (sin y) (+ (/ 1.0 y) (* 0.5 (/ (* x x) y)))))
double code(double x, double y) {
return sin(y) * ((1.0 / y) + (0.5 * ((x * x) / y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(y) * ((1.0d0 / y) + (0.5d0 * ((x * x) / y)))
end function
public static double code(double x, double y) {
return Math.sin(y) * ((1.0 / y) + (0.5 * ((x * x) / y)));
}
def code(x, y): return math.sin(y) * ((1.0 / y) + (0.5 * ((x * x) / y)))
function code(x, y) return Float64(sin(y) * Float64(Float64(1.0 / y) + Float64(0.5 * Float64(Float64(x * x) / y)))) end
function tmp = code(x, y) tmp = sin(y) * ((1.0 / y) + (0.5 * ((x * x) / y))); end
code[x_, y_] := N[(N[Sin[y], $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] + N[(0.5 * N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin y \cdot \left(\frac{1}{y} + 0.5 \cdot \frac{x \cdot x}{y}\right)
\end{array}
Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 83.1%
unpow283.1%
Simplified83.1%
Final simplification83.1%
(FPCore (x y) :precision binary64 (if (<= x 1.4) (/ (sin y) y) (* (sin y) (* 0.5 (/ (* x x) y)))))
double code(double x, double y) {
double tmp;
if (x <= 1.4) {
tmp = sin(y) / y;
} else {
tmp = sin(y) * (0.5 * ((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 <= 1.4d0) then
tmp = sin(y) / y
else
tmp = sin(y) * (0.5d0 * ((x * x) / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1.4) {
tmp = Math.sin(y) / y;
} else {
tmp = Math.sin(y) * (0.5 * ((x * x) / y));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1.4: tmp = math.sin(y) / y else: tmp = math.sin(y) * (0.5 * ((x * x) / y)) return tmp
function code(x, y) tmp = 0.0 if (x <= 1.4) tmp = Float64(sin(y) / y); else tmp = Float64(sin(y) * Float64(0.5 * Float64(Float64(x * x) / y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1.4) tmp = sin(y) / y; else tmp = sin(y) * (0.5 * ((x * x) / y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1.4], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(0.5 * N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \left(0.5 \cdot \frac{x \cdot x}{y}\right)\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 67.5%
if 1.3999999999999999 < x Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 65.6%
unpow265.6%
Simplified65.6%
Taylor expanded in x around inf 65.6%
unpow265.6%
Simplified65.6%
Final simplification67.1%
(FPCore (x y) :precision binary64 (if (<= x 7e-10) (/ (sin y) y) (* y (+ (/ 1.0 y) (* 0.5 (/ x (/ y x)))))))
double code(double x, double y) {
double tmp;
if (x <= 7e-10) {
tmp = sin(y) / y;
} else {
tmp = y * ((1.0 / y) + (0.5 * (x / (y / x))));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 7d-10) then
tmp = sin(y) / y
else
tmp = y * ((1.0d0 / y) + (0.5d0 * (x / (y / x))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 7e-10) {
tmp = Math.sin(y) / y;
} else {
tmp = y * ((1.0 / y) + (0.5 * (x / (y / x))));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 7e-10: tmp = math.sin(y) / y else: tmp = y * ((1.0 / y) + (0.5 * (x / (y / x)))) return tmp
function code(x, y) tmp = 0.0 if (x <= 7e-10) tmp = Float64(sin(y) / y); else tmp = Float64(y * Float64(Float64(1.0 / y) + Float64(0.5 * Float64(x / Float64(y / x))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 7e-10) tmp = sin(y) / y; else tmp = y * ((1.0 / y) + (0.5 * (x / (y / x)))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 7e-10], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], N[(y * N[(N[(1.0 / y), $MachinePrecision] + N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{1}{y} + 0.5 \cdot \frac{x}{\frac{y}{x}}\right)\\
\end{array}
\end{array}
if x < 6.99999999999999961e-10Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 67.5%
if 6.99999999999999961e-10 < x Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 66.4%
unpow266.4%
Simplified66.4%
Taylor expanded in x around 0 66.4%
unpow266.4%
associate-/l*55.4%
Simplified55.4%
Taylor expanded in y around 0 56.5%
Final simplification64.8%
(FPCore (x y) :precision binary64 (* y (+ (/ 1.0 y) (* 0.5 (/ x (/ y x))))))
double code(double x, double y) {
return y * ((1.0 / y) + (0.5 * (x / (y / x))));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = y * ((1.0d0 / y) + (0.5d0 * (x / (y / x))))
end function
public static double code(double x, double y) {
return y * ((1.0 / y) + (0.5 * (x / (y / x))));
}
def code(x, y): return y * ((1.0 / y) + (0.5 * (x / (y / x))))
function code(x, y) return Float64(y * Float64(Float64(1.0 / y) + Float64(0.5 * Float64(x / Float64(y / x))))) end
function tmp = code(x, y) tmp = y * ((1.0 / y) + (0.5 * (x / (y / x)))); end
code[x_, y_] := N[(y * N[(N[(1.0 / y), $MachinePrecision] + N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(\frac{1}{y} + 0.5 \cdot \frac{x}{\frac{y}{x}}\right)
\end{array}
Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 83.1%
unpow283.1%
Simplified83.1%
Taylor expanded in x around 0 83.1%
unpow283.1%
associate-/l*76.9%
Simplified76.9%
Taylor expanded in y around 0 52.7%
Final simplification52.7%
(FPCore (x y) :precision binary64 (if (<= x 235.0) (+ 1.0 (* 0.5 (* x x))) (* y (* 0.5 (/ (* x x) y)))))
double code(double x, double y) {
double tmp;
if (x <= 235.0) {
tmp = 1.0 + (0.5 * (x * x));
} else {
tmp = y * (0.5 * ((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 <= 235.0d0) then
tmp = 1.0d0 + (0.5d0 * (x * x))
else
tmp = y * (0.5d0 * ((x * x) / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 235.0) {
tmp = 1.0 + (0.5 * (x * x));
} else {
tmp = y * (0.5 * ((x * x) / y));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 235.0: tmp = 1.0 + (0.5 * (x * x)) else: tmp = y * (0.5 * ((x * x) / y)) return tmp
function code(x, y) tmp = 0.0 if (x <= 235.0) tmp = Float64(1.0 + Float64(0.5 * Float64(x * x))); else tmp = Float64(y * Float64(0.5 * Float64(Float64(x * x) / y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 235.0) tmp = 1.0 + (0.5 * (x * x)); else tmp = y * (0.5 * ((x * x) / y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 235.0], N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 * N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 235:\\
\;\;\;\;1 + 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{x \cdot x}{y}\right)\\
\end{array}
\end{array}
if x < 235Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 88.4%
unpow288.4%
Simplified88.4%
Taylor expanded in y around 0 48.1%
unpow248.1%
Simplified48.1%
if 235 < x Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 65.6%
unpow265.6%
Simplified65.6%
Taylor expanded in x around inf 65.6%
unpow265.6%
Simplified65.6%
Taylor expanded in y around 0 55.4%
Final simplification49.8%
(FPCore (x y) :precision binary64 (+ 1.0 (* 0.5 (* x x))))
double code(double x, double y) {
return 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.5d0 * (x * x))
end function
public static double code(double x, double y) {
return 1.0 + (0.5 * (x * x));
}
def code(x, y): return 1.0 + (0.5 * (x * x))
function code(x, y) return Float64(1.0 + Float64(0.5 * Float64(x * x))) end
function tmp = code(x, y) tmp = 1.0 + (0.5 * (x * x)); end
code[x_, y_] := N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 0.5 \cdot \left(x \cdot x\right)
\end{array}
Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 83.1%
unpow283.1%
Simplified83.1%
Taylor expanded in y around 0 47.6%
unpow247.6%
Simplified47.6%
Final simplification47.6%
(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%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 52.6%
Taylor expanded in y around 0 27.9%
Final simplification27.9%
(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 2023279
(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)))