
(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 12 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}
(FPCore (x y) :precision binary64 (* (/ (sin x) x) (sinh y)))
double code(double x, double y) {
return (sin(x) / x) * sinh(y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) / x) * sinh(y)
end function
public static double code(double x, double y) {
return (Math.sin(x) / x) * Math.sinh(y);
}
def code(x, y): return (math.sin(x) / x) * math.sinh(y)
function code(x, y) return Float64(Float64(sin(x) / x) * sinh(y)) end
function tmp = code(x, y) tmp = (sin(x) / x) * sinh(y); end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x}{x} \cdot \sinh y
\end{array}
Initial program 91.1%
associate-*l/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= (sinh y) -1e+18)
(sinh y)
(if (<= (sinh y) 500.0)
(* (/ (sin x) x) y)
(* (sinh y) (+ 1.0 (* (* x x) -0.16666666666666666))))))
double code(double x, double y) {
double tmp;
if (sinh(y) <= -1e+18) {
tmp = sinh(y);
} else if (sinh(y) <= 500.0) {
tmp = (sin(x) / x) * y;
} else {
tmp = sinh(y) * (1.0 + ((x * x) * -0.16666666666666666));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (sinh(y) <= (-1d+18)) then
tmp = sinh(y)
else if (sinh(y) <= 500.0d0) then
tmp = (sin(x) / x) * y
else
tmp = sinh(y) * (1.0d0 + ((x * x) * (-0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.sinh(y) <= -1e+18) {
tmp = Math.sinh(y);
} else if (Math.sinh(y) <= 500.0) {
tmp = (Math.sin(x) / x) * y;
} else {
tmp = Math.sinh(y) * (1.0 + ((x * x) * -0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if math.sinh(y) <= -1e+18: tmp = math.sinh(y) elif math.sinh(y) <= 500.0: tmp = (math.sin(x) / x) * y else: tmp = math.sinh(y) * (1.0 + ((x * x) * -0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if (sinh(y) <= -1e+18) tmp = sinh(y); elseif (sinh(y) <= 500.0) tmp = Float64(Float64(sin(x) / x) * y); else tmp = Float64(sinh(y) * Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (sinh(y) <= -1e+18) tmp = sinh(y); elseif (sinh(y) <= 500.0) tmp = (sin(x) / x) * y; else tmp = sinh(y) * (1.0 + ((x * x) * -0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Sinh[y], $MachinePrecision], -1e+18], N[Sinh[y], $MachinePrecision], If[LessEqual[N[Sinh[y], $MachinePrecision], 500.0], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -1 \cdot 10^{+18}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;\sinh y \leq 500:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y \cdot \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right)\\
\end{array}
\end{array}
if (sinh.f64 y) < -1e18Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 80.0%
if -1e18 < (sinh.f64 y) < 500Initial program 82.6%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in y around 0 98.6%
if 500 < (sinh.f64 y) Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 74.0%
*-commutative74.0%
unpow274.0%
Simplified74.0%
Final simplification88.3%
(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}
Initial program 91.1%
associate-*r/99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (<= y -0.0014) (sinh y) (if (<= y 9e+17) (* (sin x) (/ y x)) (sinh y))))
double code(double x, double y) {
double tmp;
if (y <= -0.0014) {
tmp = sinh(y);
} else if (y <= 9e+17) {
tmp = sin(x) * (y / x);
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-0.0014d0)) then
tmp = sinh(y)
else if (y <= 9d+17) then
tmp = sin(x) * (y / x)
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -0.0014) {
tmp = Math.sinh(y);
} else if (y <= 9e+17) {
tmp = Math.sin(x) * (y / x);
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.0014: tmp = math.sinh(y) elif y <= 9e+17: tmp = math.sin(x) * (y / x) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -0.0014) tmp = sinh(y); elseif (y <= 9e+17) tmp = Float64(sin(x) * Float64(y / x)); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.0014) tmp = sinh(y); elseif (y <= 9e+17) tmp = sin(x) * (y / x); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.0014], N[Sinh[y], $MachinePrecision], If[LessEqual[y, 9e+17], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0014:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+17}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if y < -0.00139999999999999999 or 9e17 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 74.0%
if -0.00139999999999999999 < y < 9e17Initial program 82.9%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 97.0%
Final simplification86.0%
(FPCore (x y) :precision binary64 (if (<= y -0.046) (sinh y) (if (<= y 9e+17) (* (/ (sin x) x) y) (sinh y))))
double code(double x, double y) {
double tmp;
if (y <= -0.046) {
tmp = sinh(y);
} else if (y <= 9e+17) {
tmp = (sin(x) / x) * y;
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-0.046d0)) then
tmp = sinh(y)
else if (y <= 9d+17) then
tmp = (sin(x) / x) * y
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -0.046) {
tmp = Math.sinh(y);
} else if (y <= 9e+17) {
tmp = (Math.sin(x) / x) * y;
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.046: tmp = math.sinh(y) elif y <= 9e+17: tmp = (math.sin(x) / x) * y else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -0.046) tmp = sinh(y); elseif (y <= 9e+17) tmp = Float64(Float64(sin(x) / x) * y); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.046) tmp = sinh(y); elseif (y <= 9e+17) tmp = (sin(x) / x) * y; else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.046], N[Sinh[y], $MachinePrecision], If[LessEqual[y, 9e+17], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.046:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+17}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if y < -0.045999999999999999 or 9e17 < y Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 74.0%
if -0.045999999999999999 < y < 9e17Initial program 82.9%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in y around 0 97.1%
Final simplification86.0%
(FPCore (x y)
:precision binary64
(if (<= y 3.2e-63)
(* x (/ -1.0 (/ (- x) y)))
(if (<= y 1.32e+154)
(* y (+ 1.0 (* (* x x) -0.16666666666666666)))
(sqrt (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 3.2e-63) {
tmp = x * (-1.0 / (-x / y));
} else if (y <= 1.32e+154) {
tmp = y * (1.0 + ((x * x) * -0.16666666666666666));
} else {
tmp = sqrt((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 <= 3.2d-63) then
tmp = x * ((-1.0d0) / (-x / y))
else if (y <= 1.32d+154) then
tmp = y * (1.0d0 + ((x * x) * (-0.16666666666666666d0)))
else
tmp = sqrt((y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 3.2e-63) {
tmp = x * (-1.0 / (-x / y));
} else if (y <= 1.32e+154) {
tmp = y * (1.0 + ((x * x) * -0.16666666666666666));
} else {
tmp = Math.sqrt((y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3.2e-63: tmp = x * (-1.0 / (-x / y)) elif y <= 1.32e+154: tmp = y * (1.0 + ((x * x) * -0.16666666666666666)) else: tmp = math.sqrt((y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 3.2e-63) tmp = Float64(x * Float64(-1.0 / Float64(Float64(-x) / y))); elseif (y <= 1.32e+154) tmp = Float64(y * Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666))); else tmp = sqrt(Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3.2e-63) tmp = x * (-1.0 / (-x / y)); elseif (y <= 1.32e+154) tmp = y * (1.0 + ((x * x) * -0.16666666666666666)); else tmp = sqrt((y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3.2e-63], N[(x * N[(-1.0 / N[((-x) / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.32e+154], N[(y * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{-63}:\\
\;\;\;\;x \cdot \frac{-1}{\frac{-x}{y}}\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;y \cdot \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot y}\\
\end{array}
\end{array}
if y < 3.19999999999999989e-63Initial program 88.1%
associate-*r/99.4%
Simplified99.4%
Taylor expanded in y around 0 50.6%
*-commutative50.6%
associate-/l*71.9%
Simplified71.9%
frac-2neg71.9%
div-inv72.8%
distribute-neg-frac72.8%
Applied egg-rr72.8%
Taylor expanded in x around 0 58.1%
if 3.19999999999999989e-63 < y < 1.31999999999999998e154Initial program 99.9%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in x around 0 67.3%
*-commutative67.3%
unpow267.3%
Simplified67.3%
Taylor expanded in y around 0 48.6%
if 1.31999999999999998e154 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.3%
*-commutative5.3%
associate-/l*43.8%
Simplified43.8%
Taylor expanded in x around 0 43.6%
associate-/r/5.2%
*-inverses5.2%
*-un-lft-identity5.2%
add-sqr-sqrt5.2%
sqrt-unprod72.4%
Applied egg-rr72.4%
Final simplification58.4%
(FPCore (x y) :precision binary64 (if (<= y -5.4e-70) (sinh y) (if (<= y 2.1e-63) (/ x (/ x y)) (sinh y))))
double code(double x, double y) {
double tmp;
if (y <= -5.4e-70) {
tmp = sinh(y);
} else if (y <= 2.1e-63) {
tmp = x / (x / y);
} else {
tmp = sinh(y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-5.4d-70)) then
tmp = sinh(y)
else if (y <= 2.1d-63) then
tmp = x / (x / y)
else
tmp = sinh(y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.4e-70) {
tmp = Math.sinh(y);
} else if (y <= 2.1e-63) {
tmp = x / (x / y);
} else {
tmp = Math.sinh(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.4e-70: tmp = math.sinh(y) elif y <= 2.1e-63: tmp = x / (x / y) else: tmp = math.sinh(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -5.4e-70) tmp = sinh(y); elseif (y <= 2.1e-63) tmp = Float64(x / Float64(x / y)); else tmp = sinh(y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.4e-70) tmp = sinh(y); elseif (y <= 2.1e-63) tmp = x / (x / y); else tmp = sinh(y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.4e-70], N[Sinh[y], $MachinePrecision], If[LessEqual[y, 2.1e-63], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], N[Sinh[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{-70}:\\
\;\;\;\;\sinh y\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-63}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\\
\end{array}
\end{array}
if y < -5.4000000000000003e-70 or 2.1e-63 < y Initial program 99.2%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around 0 70.2%
if -5.4000000000000003e-70 < y < 2.1e-63Initial program 78.4%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 78.4%
*-commutative78.4%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in x around 0 77.7%
Final simplification73.1%
(FPCore (x y)
:precision binary64
(if (<= x 8.8e+142)
(* x (/ y x))
(if (<= x 2.6e+170)
(* y (+ 1.0 (* (* x x) -0.16666666666666666)))
(/ x (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= 8.8e+142) {
tmp = x * (y / x);
} else if (x <= 2.6e+170) {
tmp = y * (1.0 + ((x * x) * -0.16666666666666666));
} else {
tmp = 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 <= 8.8d+142) then
tmp = x * (y / x)
else if (x <= 2.6d+170) then
tmp = y * (1.0d0 + ((x * x) * (-0.16666666666666666d0)))
else
tmp = x / (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 8.8e+142) {
tmp = x * (y / x);
} else if (x <= 2.6e+170) {
tmp = y * (1.0 + ((x * x) * -0.16666666666666666));
} else {
tmp = x / (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 8.8e+142: tmp = x * (y / x) elif x <= 2.6e+170: tmp = y * (1.0 + ((x * x) * -0.16666666666666666)) else: tmp = x / (x / y) return tmp
function code(x, y) tmp = 0.0 if (x <= 8.8e+142) tmp = Float64(x * Float64(y / x)); elseif (x <= 2.6e+170) tmp = Float64(y * Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666))); else tmp = Float64(x / Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 8.8e+142) tmp = x * (y / x); elseif (x <= 2.6e+170) tmp = y * (1.0 + ((x * x) * -0.16666666666666666)); else tmp = x / (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 8.8e+142], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+170], N[(y * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.8 \cdot 10^{+142}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+170}:\\
\;\;\;\;y \cdot \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\end{array}
\end{array}
if x < 8.79999999999999947e142Initial program 89.5%
associate-*r/99.4%
Simplified99.4%
Taylor expanded in y around 0 41.7%
*-commutative41.7%
associate-/l*65.8%
Simplified65.8%
Taylor expanded in x around 0 51.7%
clear-num51.6%
associate-/r/53.0%
clear-num52.6%
Applied egg-rr52.6%
if 8.79999999999999947e142 < x < 2.5999999999999998e170Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 66.7%
*-commutative66.7%
unpow266.7%
Simplified66.7%
Taylor expanded in y around 0 66.7%
if 2.5999999999999998e170 < x Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 60.0%
*-commutative60.0%
associate-/l*58.6%
Simplified58.6%
Taylor expanded in x around 0 53.0%
Final simplification52.8%
(FPCore (x y)
:precision binary64
(if (<= x 8.8e+142)
(* x (/ y x))
(if (<= x 2.6e+170)
(+ y (* x (* y (* x -0.16666666666666666))))
(/ x (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= 8.8e+142) {
tmp = x * (y / x);
} else if (x <= 2.6e+170) {
tmp = y + (x * (y * (x * -0.16666666666666666)));
} else {
tmp = 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 <= 8.8d+142) then
tmp = x * (y / x)
else if (x <= 2.6d+170) then
tmp = y + (x * (y * (x * (-0.16666666666666666d0))))
else
tmp = x / (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 8.8e+142) {
tmp = x * (y / x);
} else if (x <= 2.6e+170) {
tmp = y + (x * (y * (x * -0.16666666666666666)));
} else {
tmp = x / (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 8.8e+142: tmp = x * (y / x) elif x <= 2.6e+170: tmp = y + (x * (y * (x * -0.16666666666666666))) else: tmp = x / (x / y) return tmp
function code(x, y) tmp = 0.0 if (x <= 8.8e+142) tmp = Float64(x * Float64(y / x)); elseif (x <= 2.6e+170) tmp = Float64(y + Float64(x * Float64(y * Float64(x * -0.16666666666666666)))); else tmp = Float64(x / Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 8.8e+142) tmp = x * (y / x); elseif (x <= 2.6e+170) tmp = y + (x * (y * (x * -0.16666666666666666))); else tmp = x / (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 8.8e+142], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+170], N[(y + N[(x * N[(y * N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.8 \cdot 10^{+142}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+170}:\\
\;\;\;\;y + x \cdot \left(y \cdot \left(x \cdot -0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\end{array}
\end{array}
if x < 8.79999999999999947e142Initial program 89.5%
associate-*r/99.4%
Simplified99.4%
Taylor expanded in y around 0 41.7%
*-commutative41.7%
associate-/l*65.8%
Simplified65.8%
Taylor expanded in x around 0 51.7%
clear-num51.6%
associate-/r/53.0%
clear-num52.6%
Applied egg-rr52.6%
if 8.79999999999999947e142 < x < 2.5999999999999998e170Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 66.7%
unpow266.7%
Simplified66.7%
Taylor expanded in y around 0 66.7%
*-commutative66.7%
*-commutative66.7%
unpow266.7%
associate-*l*66.7%
*-commutative66.7%
associate-*l*66.7%
associate-*l*66.7%
Simplified66.7%
if 2.5999999999999998e170 < x Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 60.0%
*-commutative60.0%
associate-/l*58.6%
Simplified58.6%
Taylor expanded in x around 0 53.0%
Final simplification52.8%
(FPCore (x y) :precision binary64 (* x (/ -1.0 (/ (- x) y))))
double code(double x, double y) {
return x * (-1.0 / (-x / y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * ((-1.0d0) / (-x / y))
end function
public static double code(double x, double y) {
return x * (-1.0 / (-x / y));
}
def code(x, y): return x * (-1.0 / (-x / y))
function code(x, y) return Float64(x * Float64(-1.0 / Float64(Float64(-x) / y))) end
function tmp = code(x, y) tmp = x * (-1.0 / (-x / y)); end
code[x_, y_] := N[(x * N[(-1.0 / N[((-x) / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{-1}{\frac{-x}{y}}
\end{array}
Initial program 91.1%
associate-*r/99.5%
Simplified99.5%
Taylor expanded in y around 0 43.8%
*-commutative43.8%
associate-/l*64.0%
Simplified64.0%
frac-2neg64.0%
div-inv65.1%
distribute-neg-frac65.1%
Applied egg-rr65.1%
Taylor expanded in x around 0 52.4%
Final simplification52.4%
(FPCore (x y) :precision binary64 (* x (/ y x)))
double code(double x, double y) {
return x * (y / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (y / x)
end function
public static double code(double x, double y) {
return x * (y / x);
}
def code(x, y): return x * (y / x)
function code(x, y) return Float64(x * Float64(y / x)) end
function tmp = code(x, y) tmp = x * (y / x); end
code[x_, y_] := N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y}{x}
\end{array}
Initial program 91.1%
associate-*r/99.5%
Simplified99.5%
Taylor expanded in y around 0 43.8%
*-commutative43.8%
associate-/l*64.0%
Simplified64.0%
Taylor expanded in x around 0 51.3%
clear-num51.3%
associate-/r/52.4%
clear-num51.9%
Applied egg-rr51.9%
Final simplification51.9%
(FPCore (x y) :precision binary64 y)
double code(double x, double y) {
return y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = y
end function
public static double code(double x, double y) {
return y;
}
def code(x, y): return y
function code(x, y) return y end
function tmp = code(x, y) tmp = y; end
code[x_, y_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 91.1%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 52.6%
Taylor expanded in x around 0 26.8%
Final simplification26.8%
(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 2023279
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
:herbie-target
(* (sin x) (/ (sinh y) x))
(/ (* (sin x) (sinh y)) x))