
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (sin x) (* 0.16666666666666666 (* y y))))
(t_1 (/ (* x (sinh y)) y)))
(if (<= y -1.65e+202)
t_0
(if (<= y -9.6)
t_1
(if (<= y 1.45e-5) (sin x) (if (<= y 1.35e+154) t_1 t_0))))))
double code(double x, double y) {
double t_0 = sin(x) * (0.16666666666666666 * (y * y));
double t_1 = (x * sinh(y)) / y;
double tmp;
if (y <= -1.65e+202) {
tmp = t_0;
} else if (y <= -9.6) {
tmp = t_1;
} else if (y <= 1.45e-5) {
tmp = sin(x);
} else if (y <= 1.35e+154) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_0 = sin(x) * (0.16666666666666666d0 * (y * y))
t_1 = (x * sinh(y)) / y
if (y <= (-1.65d+202)) then
tmp = t_0
else if (y <= (-9.6d0)) then
tmp = t_1
else if (y <= 1.45d-5) then
tmp = sin(x)
else if (y <= 1.35d+154) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sin(x) * (0.16666666666666666 * (y * y));
double t_1 = (x * Math.sinh(y)) / y;
double tmp;
if (y <= -1.65e+202) {
tmp = t_0;
} else if (y <= -9.6) {
tmp = t_1;
} else if (y <= 1.45e-5) {
tmp = Math.sin(x);
} else if (y <= 1.35e+154) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sin(x) * (0.16666666666666666 * (y * y)) t_1 = (x * math.sinh(y)) / y tmp = 0 if y <= -1.65e+202: tmp = t_0 elif y <= -9.6: tmp = t_1 elif y <= 1.45e-5: tmp = math.sin(x) elif y <= 1.35e+154: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(sin(x) * Float64(0.16666666666666666 * Float64(y * y))) t_1 = Float64(Float64(x * sinh(y)) / y) tmp = 0.0 if (y <= -1.65e+202) tmp = t_0; elseif (y <= -9.6) tmp = t_1; elseif (y <= 1.45e-5) tmp = sin(x); elseif (y <= 1.35e+154) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = sin(x) * (0.16666666666666666 * (y * y)); t_1 = (x * sinh(y)) / y; tmp = 0.0; if (y <= -1.65e+202) tmp = t_0; elseif (y <= -9.6) tmp = t_1; elseif (y <= 1.45e-5) tmp = sin(x); elseif (y <= 1.35e+154) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sin[x], $MachinePrecision] * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -1.65e+202], t$95$0, If[LessEqual[y, -9.6], t$95$1, If[LessEqual[y, 1.45e-5], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
t_1 := \frac{x \cdot \sinh y}{y}\\
\mathbf{if}\;y \leq -1.65 \cdot 10^{+202}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -9.6:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-5}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.6499999999999999e202 or 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -1.6499999999999999e202 < y < -9.59999999999999964 or 1.45e-5 < y < 1.35000000000000003e154Initial program 100.0%
add-log-exp98.8%
*-un-lft-identity98.8%
log-prod98.8%
metadata-eval98.8%
add-log-exp100.0%
*-commutative100.0%
associate-*l/100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
*-commutative100.0%
associate-*l/93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in x around 0 76.7%
*-commutative76.7%
associate-*l/83.5%
Applied egg-rr83.5%
if -9.59999999999999964 < y < 1.45e-5Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification95.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y)))
(t_1 (* (sin x) t_0))
(t_2 (/ (* x (sinh y)) y)))
(if (<= y -1.65e+202)
t_1
(if (<= y -9.6)
t_2
(if (<= y 29000000.0)
(* (sin x) (+ t_0 1.0))
(if (<= y 5e+153) t_2 t_1))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double t_1 = sin(x) * t_0;
double t_2 = (x * sinh(y)) / y;
double tmp;
if (y <= -1.65e+202) {
tmp = t_1;
} else if (y <= -9.6) {
tmp = t_2;
} else if (y <= 29000000.0) {
tmp = sin(x) * (t_0 + 1.0);
} else if (y <= 5e+153) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = 0.16666666666666666d0 * (y * y)
t_1 = sin(x) * t_0
t_2 = (x * sinh(y)) / y
if (y <= (-1.65d+202)) then
tmp = t_1
else if (y <= (-9.6d0)) then
tmp = t_2
else if (y <= 29000000.0d0) then
tmp = sin(x) * (t_0 + 1.0d0)
else if (y <= 5d+153) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double t_1 = Math.sin(x) * t_0;
double t_2 = (x * Math.sinh(y)) / y;
double tmp;
if (y <= -1.65e+202) {
tmp = t_1;
} else if (y <= -9.6) {
tmp = t_2;
} else if (y <= 29000000.0) {
tmp = Math.sin(x) * (t_0 + 1.0);
} else if (y <= 5e+153) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) t_1 = math.sin(x) * t_0 t_2 = (x * math.sinh(y)) / y tmp = 0 if y <= -1.65e+202: tmp = t_1 elif y <= -9.6: tmp = t_2 elif y <= 29000000.0: tmp = math.sin(x) * (t_0 + 1.0) elif y <= 5e+153: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) t_1 = Float64(sin(x) * t_0) t_2 = Float64(Float64(x * sinh(y)) / y) tmp = 0.0 if (y <= -1.65e+202) tmp = t_1; elseif (y <= -9.6) tmp = t_2; elseif (y <= 29000000.0) tmp = Float64(sin(x) * Float64(t_0 + 1.0)); elseif (y <= 5e+153) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * y); t_1 = sin(x) * t_0; t_2 = (x * sinh(y)) / y; tmp = 0.0; if (y <= -1.65e+202) tmp = t_1; elseif (y <= -9.6) tmp = t_2; elseif (y <= 29000000.0) tmp = sin(x) * (t_0 + 1.0); elseif (y <= 5e+153) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -1.65e+202], t$95$1, If[LessEqual[y, -9.6], t$95$2, If[LessEqual[y, 29000000.0], N[(N[Sin[x], $MachinePrecision] * N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+153], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
t_1 := \sin x \cdot t_0\\
t_2 := \frac{x \cdot \sinh y}{y}\\
\mathbf{if}\;y \leq -1.65 \cdot 10^{+202}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -9.6:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 29000000:\\
\;\;\;\;\sin x \cdot \left(t_0 + 1\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+153}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.6499999999999999e202 or 5.00000000000000018e153 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -1.6499999999999999e202 < y < -9.59999999999999964 or 2.9e7 < y < 5.00000000000000018e153Initial program 100.0%
add-log-exp100.0%
*-un-lft-identity100.0%
log-prod100.0%
metadata-eval100.0%
add-log-exp100.0%
*-commutative100.0%
associate-*l/100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
*-commutative100.0%
associate-*l/93.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in x around 0 77.5%
*-commutative77.5%
associate-*l/84.5%
Applied egg-rr84.5%
if -9.59999999999999964 < y < 2.9e7Initial program 100.0%
Taylor expanded in y around 0 98.6%
unpow298.6%
Simplified98.6%
Final simplification95.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (sinh y)) y)))
(if (<= y -9.6)
t_0
(if (<= y 1.42e-5)
(sin x)
(if (or (<= y 2.05e+201) (not (<= y 3e+237)))
t_0
(* -0.16666666666666666 (pow x 3.0)))))))
double code(double x, double y) {
double t_0 = (x * sinh(y)) / y;
double tmp;
if (y <= -9.6) {
tmp = t_0;
} else if (y <= 1.42e-5) {
tmp = sin(x);
} else if ((y <= 2.05e+201) || !(y <= 3e+237)) {
tmp = t_0;
} else {
tmp = -0.16666666666666666 * pow(x, 3.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 = (x * sinh(y)) / y
if (y <= (-9.6d0)) then
tmp = t_0
else if (y <= 1.42d-5) then
tmp = sin(x)
else if ((y <= 2.05d+201) .or. (.not. (y <= 3d+237))) then
tmp = t_0
else
tmp = (-0.16666666666666666d0) * (x ** 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * Math.sinh(y)) / y;
double tmp;
if (y <= -9.6) {
tmp = t_0;
} else if (y <= 1.42e-5) {
tmp = Math.sin(x);
} else if ((y <= 2.05e+201) || !(y <= 3e+237)) {
tmp = t_0;
} else {
tmp = -0.16666666666666666 * Math.pow(x, 3.0);
}
return tmp;
}
def code(x, y): t_0 = (x * math.sinh(y)) / y tmp = 0 if y <= -9.6: tmp = t_0 elif y <= 1.42e-5: tmp = math.sin(x) elif (y <= 2.05e+201) or not (y <= 3e+237): tmp = t_0 else: tmp = -0.16666666666666666 * math.pow(x, 3.0) return tmp
function code(x, y) t_0 = Float64(Float64(x * sinh(y)) / y) tmp = 0.0 if (y <= -9.6) tmp = t_0; elseif (y <= 1.42e-5) tmp = sin(x); elseif ((y <= 2.05e+201) || !(y <= 3e+237)) tmp = t_0; else tmp = Float64(-0.16666666666666666 * (x ^ 3.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * sinh(y)) / y; tmp = 0.0; if (y <= -9.6) tmp = t_0; elseif (y <= 1.42e-5) tmp = sin(x); elseif ((y <= 2.05e+201) || ~((y <= 3e+237))) tmp = t_0; else tmp = -0.16666666666666666 * (x ^ 3.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -9.6], t$95$0, If[LessEqual[y, 1.42e-5], N[Sin[x], $MachinePrecision], If[Or[LessEqual[y, 2.05e+201], N[Not[LessEqual[y, 3e+237]], $MachinePrecision]], t$95$0, N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \sinh y}{y}\\
\mathbf{if}\;y \leq -9.6:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{-5}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+201} \lor \neg \left(y \leq 3 \cdot 10^{+237}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot {x}^{3}\\
\end{array}
\end{array}
if y < -9.59999999999999964 or 1.42e-5 < y < 2.0500000000000001e201 or 3e237 < y Initial program 100.0%
add-log-exp99.3%
*-un-lft-identity99.3%
log-prod99.3%
metadata-eval99.3%
add-log-exp100.0%
*-commutative100.0%
associate-*l/100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
*-commutative100.0%
associate-*l/81.5%
*-commutative81.5%
Simplified81.5%
Taylor expanded in x around 0 57.3%
*-commutative57.3%
associate-*l/75.8%
Applied egg-rr75.8%
if -9.59999999999999964 < y < 1.42e-5Initial program 100.0%
Taylor expanded in y around 0 99.3%
if 2.0500000000000001e201 < y < 3e237Initial program 100.0%
add-log-exp100.0%
*-un-lft-identity100.0%
log-prod100.0%
metadata-eval100.0%
add-log-exp100.0%
*-commutative100.0%
associate-*l/100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
*-commutative100.0%
associate-*l/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around inf 100.0%
Final simplification87.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* x (* y y)))) (t_1 (* (sinh y) (/ x y))))
(if (<= y -1.42e+190)
t_0
(if (<= y -9.6)
t_1
(if (<= y 1.45e-5) (sin x) (if (<= y 1.35e+154) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (x * (y * y));
double t_1 = sinh(y) * (x / y);
double tmp;
if (y <= -1.42e+190) {
tmp = t_0;
} else if (y <= -9.6) {
tmp = t_1;
} else if (y <= 1.45e-5) {
tmp = sin(x);
} else if (y <= 1.35e+154) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_0 = 0.16666666666666666d0 * (x * (y * y))
t_1 = sinh(y) * (x / y)
if (y <= (-1.42d+190)) then
tmp = t_0
else if (y <= (-9.6d0)) then
tmp = t_1
else if (y <= 1.45d-5) then
tmp = sin(x)
else if (y <= 1.35d+154) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (x * (y * y));
double t_1 = Math.sinh(y) * (x / y);
double tmp;
if (y <= -1.42e+190) {
tmp = t_0;
} else if (y <= -9.6) {
tmp = t_1;
} else if (y <= 1.45e-5) {
tmp = Math.sin(x);
} else if (y <= 1.35e+154) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (x * (y * y)) t_1 = math.sinh(y) * (x / y) tmp = 0 if y <= -1.42e+190: tmp = t_0 elif y <= -9.6: tmp = t_1 elif y <= 1.45e-5: tmp = math.sin(x) elif y <= 1.35e+154: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(x * Float64(y * y))) t_1 = Float64(sinh(y) * Float64(x / y)) tmp = 0.0 if (y <= -1.42e+190) tmp = t_0; elseif (y <= -9.6) tmp = t_1; elseif (y <= 1.45e-5) tmp = sin(x); elseif (y <= 1.35e+154) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (x * (y * y)); t_1 = sinh(y) * (x / y); tmp = 0.0; if (y <= -1.42e+190) tmp = t_0; elseif (y <= -9.6) tmp = t_1; elseif (y <= 1.45e-5) tmp = sin(x); elseif (y <= 1.35e+154) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sinh[y], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.42e+190], t$95$0, If[LessEqual[y, -9.6], t$95$1, If[LessEqual[y, 1.45e-5], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
t_1 := \sinh y \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq -1.42 \cdot 10^{+190}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -9.6:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-5}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.42e190 or 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 59.6%
*-commutative59.6%
unpow259.6%
Simplified59.6%
if -1.42e190 < y < -9.59999999999999964 or 1.45e-5 < y < 1.35000000000000003e154Initial program 100.0%
add-log-exp98.8%
*-un-lft-identity98.8%
log-prod98.8%
metadata-eval98.8%
add-log-exp100.0%
*-commutative100.0%
associate-*l/100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
*-commutative100.0%
associate-*l/94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in x around 0 77.8%
if -9.59999999999999964 < y < 1.45e-5Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification84.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* x (* y y)))))
(if (<= y -3000.0)
t_0
(if (<= y 1.25e+31)
(sin x)
(if (<= y 3e+237) (* -0.16666666666666666 (pow x 3.0)) t_0)))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (x * (y * y));
double tmp;
if (y <= -3000.0) {
tmp = t_0;
} else if (y <= 1.25e+31) {
tmp = sin(x);
} else if (y <= 3e+237) {
tmp = -0.16666666666666666 * pow(x, 3.0);
} else {
tmp = 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.16666666666666666d0 * (x * (y * y))
if (y <= (-3000.0d0)) then
tmp = t_0
else if (y <= 1.25d+31) then
tmp = sin(x)
else if (y <= 3d+237) then
tmp = (-0.16666666666666666d0) * (x ** 3.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (x * (y * y));
double tmp;
if (y <= -3000.0) {
tmp = t_0;
} else if (y <= 1.25e+31) {
tmp = Math.sin(x);
} else if (y <= 3e+237) {
tmp = -0.16666666666666666 * Math.pow(x, 3.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (x * (y * y)) tmp = 0 if y <= -3000.0: tmp = t_0 elif y <= 1.25e+31: tmp = math.sin(x) elif y <= 3e+237: tmp = -0.16666666666666666 * math.pow(x, 3.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(x * Float64(y * y))) tmp = 0.0 if (y <= -3000.0) tmp = t_0; elseif (y <= 1.25e+31) tmp = sin(x); elseif (y <= 3e+237) tmp = Float64(-0.16666666666666666 * (x ^ 3.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (x * (y * y)); tmp = 0.0; if (y <= -3000.0) tmp = t_0; elseif (y <= 1.25e+31) tmp = sin(x); elseif (y <= 3e+237) tmp = -0.16666666666666666 * (x ^ 3.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3000.0], t$95$0, If[LessEqual[y, 1.25e+31], N[Sin[x], $MachinePrecision], If[LessEqual[y, 3e+237], N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq -3000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+31}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+237}:\\
\;\;\;\;-0.16666666666666666 \cdot {x}^{3}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -3e3 or 3e237 < y Initial program 100.0%
Taylor expanded in y around 0 62.8%
unpow262.8%
Simplified62.8%
Taylor expanded in y around inf 62.8%
unpow262.8%
associate-*r*62.8%
*-commutative62.8%
Simplified62.8%
Taylor expanded in x around 0 47.1%
*-commutative47.1%
unpow247.1%
Simplified47.1%
if -3e3 < y < 1.25000000000000007e31Initial program 100.0%
Taylor expanded in y around 0 92.1%
if 1.25000000000000007e31 < y < 3e237Initial program 100.0%
add-log-exp100.0%
*-un-lft-identity100.0%
log-prod100.0%
metadata-eval100.0%
add-log-exp100.0%
*-commutative100.0%
associate-*l/100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
*-commutative100.0%
associate-*l/87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in y around 0 2.7%
Taylor expanded in x around 0 31.7%
Taylor expanded in x around inf 31.3%
Final simplification69.3%
(FPCore (x y) :precision binary64 (if (or (<= y -3100.0) (not (<= y 17200000000000.0))) (* 0.16666666666666666 (* x (* y y))) (sin x)))
double code(double x, double y) {
double tmp;
if ((y <= -3100.0) || !(y <= 17200000000000.0)) {
tmp = 0.16666666666666666 * (x * (y * y));
} else {
tmp = sin(x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-3100.0d0)) .or. (.not. (y <= 17200000000000.0d0))) then
tmp = 0.16666666666666666d0 * (x * (y * y))
else
tmp = sin(x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -3100.0) || !(y <= 17200000000000.0)) {
tmp = 0.16666666666666666 * (x * (y * y));
} else {
tmp = Math.sin(x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3100.0) or not (y <= 17200000000000.0): tmp = 0.16666666666666666 * (x * (y * y)) else: tmp = math.sin(x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -3100.0) || !(y <= 17200000000000.0)) tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); else tmp = sin(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -3100.0) || ~((y <= 17200000000000.0))) tmp = 0.16666666666666666 * (x * (y * y)); else tmp = sin(x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3100.0], N[Not[LessEqual[y, 17200000000000.0]], $MachinePrecision]], N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3100 \lor \neg \left(y \leq 17200000000000\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin x\\
\end{array}
\end{array}
if y < -3100 or 1.72e13 < y Initial program 100.0%
Taylor expanded in y around 0 50.9%
unpow250.9%
Simplified50.9%
Taylor expanded in y around inf 50.9%
unpow250.9%
associate-*r*50.9%
*-commutative50.9%
Simplified50.9%
Taylor expanded in x around 0 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
if -3100 < y < 1.72e13Initial program 100.0%
Taylor expanded in y around 0 98.4%
Final simplification67.5%
(FPCore (x y) :precision binary64 (if (or (<= y -54.0) (not (<= y 85000000.0))) (* 0.16666666666666666 (* x (* y y))) (/ y (+ (/ y x) (* 0.16666666666666666 (* x y))))))
double code(double x, double y) {
double tmp;
if ((y <= -54.0) || !(y <= 85000000.0)) {
tmp = 0.16666666666666666 * (x * (y * y));
} else {
tmp = y / ((y / x) + (0.16666666666666666 * (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 <= (-54.0d0)) .or. (.not. (y <= 85000000.0d0))) then
tmp = 0.16666666666666666d0 * (x * (y * y))
else
tmp = y / ((y / x) + (0.16666666666666666d0 * (x * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -54.0) || !(y <= 85000000.0)) {
tmp = 0.16666666666666666 * (x * (y * y));
} else {
tmp = y / ((y / x) + (0.16666666666666666 * (x * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -54.0) or not (y <= 85000000.0): tmp = 0.16666666666666666 * (x * (y * y)) else: tmp = y / ((y / x) + (0.16666666666666666 * (x * y))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -54.0) || !(y <= 85000000.0)) tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); else tmp = Float64(y / Float64(Float64(y / x) + Float64(0.16666666666666666 * Float64(x * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -54.0) || ~((y <= 85000000.0))) tmp = 0.16666666666666666 * (x * (y * y)); else tmp = y / ((y / x) + (0.16666666666666666 * (x * y))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -54.0], N[Not[LessEqual[y, 85000000.0]], $MachinePrecision]], N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(N[(y / x), $MachinePrecision] + N[(0.16666666666666666 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -54 \lor \neg \left(y \leq 85000000\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{y}{x} + 0.16666666666666666 \cdot \left(x \cdot y\right)}\\
\end{array}
\end{array}
if y < -54 or 8.5e7 < y Initial program 100.0%
Taylor expanded in y around 0 50.9%
unpow250.9%
Simplified50.9%
Taylor expanded in y around inf 50.9%
unpow250.9%
associate-*r*50.9%
*-commutative50.9%
Simplified50.9%
Taylor expanded in x around 0 36.2%
*-commutative36.2%
unpow236.2%
Simplified36.2%
if -54 < y < 8.5e7Initial program 100.0%
add-log-exp58.7%
*-un-lft-identity58.7%
log-prod58.7%
metadata-eval58.7%
add-log-exp100.0%
*-commutative100.0%
associate-*l/85.8%
Applied egg-rr85.8%
+-lft-identity85.8%
*-commutative85.8%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 98.2%
clear-num97.9%
un-div-inv98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 47.5%
Final simplification41.9%
(FPCore (x y) :precision binary64 (if (or (<= y -1.12e-8) (not (<= y 29000000.0))) (* 0.16666666666666666 (* x (* y y))) x))
double code(double x, double y) {
double tmp;
if ((y <= -1.12e-8) || !(y <= 29000000.0)) {
tmp = 0.16666666666666666 * (x * (y * y));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.12d-8)) .or. (.not. (y <= 29000000.0d0))) then
tmp = 0.16666666666666666d0 * (x * (y * y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.12e-8) || !(y <= 29000000.0)) {
tmp = 0.16666666666666666 * (x * (y * y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.12e-8) or not (y <= 29000000.0): tmp = 0.16666666666666666 * (x * (y * y)) else: tmp = x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.12e-8) || !(y <= 29000000.0)) tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.12e-8) || ~((y <= 29000000.0))) tmp = 0.16666666666666666 * (x * (y * y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.12e-8], N[Not[LessEqual[y, 29000000.0]], $MachinePrecision]], N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{-8} \lor \neg \left(y \leq 29000000\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.11999999999999994e-8 or 2.9e7 < y Initial program 100.0%
Taylor expanded in y around 0 51.0%
unpow251.0%
Simplified51.0%
Taylor expanded in y around inf 50.3%
unpow250.3%
associate-*r*50.3%
*-commutative50.3%
Simplified50.3%
Taylor expanded in x around 0 35.7%
*-commutative35.7%
unpow235.7%
Simplified35.7%
if -1.11999999999999994e-8 < y < 2.9e7Initial program 100.0%
add-log-exp58.1%
*-un-lft-identity58.1%
log-prod58.1%
metadata-eval58.1%
add-log-exp100.0%
*-commutative100.0%
associate-*l/85.5%
Applied egg-rr85.5%
+-lft-identity85.5%
*-commutative85.5%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 98.8%
Taylor expanded in x around 0 47.0%
Final simplification41.3%
(FPCore (x y) :precision binary64 (if (<= x -7.2e+61) (/ (* x y) y) x))
double code(double x, double y) {
double tmp;
if (x <= -7.2e+61) {
tmp = (x * y) / y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7.2d+61)) then
tmp = (x * y) / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -7.2e+61) {
tmp = (x * y) / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7.2e+61: tmp = (x * y) / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (x <= -7.2e+61) tmp = Float64(Float64(x * y) / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -7.2e+61) tmp = (x * y) / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7.2e+61], N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+61}:\\
\;\;\;\;\frac{x \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.20000000000000021e61Initial program 100.0%
add-log-exp99.4%
*-un-lft-identity99.4%
log-prod99.4%
metadata-eval99.4%
add-log-exp100.0%
*-commutative100.0%
associate-*l/99.9%
Applied egg-rr99.9%
+-lft-identity99.9%
*-commutative99.9%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 56.9%
Taylor expanded in x around 0 2.8%
associate-*r/14.6%
*-commutative14.6%
Applied egg-rr14.6%
if -7.20000000000000021e61 < x Initial program 100.0%
add-log-exp72.4%
*-un-lft-identity72.4%
log-prod72.4%
metadata-eval72.4%
add-log-exp100.0%
*-commutative100.0%
associate-*l/90.4%
Applied egg-rr90.4%
+-lft-identity90.4%
*-commutative90.4%
associate-*l/87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in y around 0 48.7%
Taylor expanded in x around 0 31.8%
Final simplification27.4%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
add-log-exp79.2%
*-un-lft-identity79.2%
log-prod79.2%
metadata-eval79.2%
add-log-exp100.0%
*-commutative100.0%
associate-*l/92.8%
Applied egg-rr92.8%
+-lft-identity92.8%
*-commutative92.8%
associate-*l/90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in y around 0 50.8%
Taylor expanded in x around 0 24.5%
Final simplification24.5%
herbie shell --seed 2023192
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))