
(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 9 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%
(FPCore (x y)
:precision binary64
(if (<= y 1e+16)
(sin x)
(if (or (<= y 3e+117) (not (<= y 3.1e+215)))
(*
x
(+
1.0
(* (pow x 2.0) (- (* x (+ 0.125 (* x -0.05))) 0.16666666666666666))))
(* x (+ 1.0 (* (pow x 2.0) (- (* x 0.125) 0.16666666666666666)))))))
double code(double x, double y) {
double tmp;
if (y <= 1e+16) {
tmp = sin(x);
} else if ((y <= 3e+117) || !(y <= 3.1e+215)) {
tmp = x * (1.0 + (pow(x, 2.0) * ((x * (0.125 + (x * -0.05))) - 0.16666666666666666)));
} else {
tmp = x * (1.0 + (pow(x, 2.0) * ((x * 0.125) - 0.16666666666666666)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1d+16) then
tmp = sin(x)
else if ((y <= 3d+117) .or. (.not. (y <= 3.1d+215))) then
tmp = x * (1.0d0 + ((x ** 2.0d0) * ((x * (0.125d0 + (x * (-0.05d0)))) - 0.16666666666666666d0)))
else
tmp = x * (1.0d0 + ((x ** 2.0d0) * ((x * 0.125d0) - 0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1e+16) {
tmp = Math.sin(x);
} else if ((y <= 3e+117) || !(y <= 3.1e+215)) {
tmp = x * (1.0 + (Math.pow(x, 2.0) * ((x * (0.125 + (x * -0.05))) - 0.16666666666666666)));
} else {
tmp = x * (1.0 + (Math.pow(x, 2.0) * ((x * 0.125) - 0.16666666666666666)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1e+16: tmp = math.sin(x) elif (y <= 3e+117) or not (y <= 3.1e+215): tmp = x * (1.0 + (math.pow(x, 2.0) * ((x * (0.125 + (x * -0.05))) - 0.16666666666666666))) else: tmp = x * (1.0 + (math.pow(x, 2.0) * ((x * 0.125) - 0.16666666666666666))) return tmp
function code(x, y) tmp = 0.0 if (y <= 1e+16) tmp = sin(x); elseif ((y <= 3e+117) || !(y <= 3.1e+215)) tmp = Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64(x * Float64(0.125 + Float64(x * -0.05))) - 0.16666666666666666)))); else tmp = Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64(x * 0.125) - 0.16666666666666666)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1e+16) tmp = sin(x); elseif ((y <= 3e+117) || ~((y <= 3.1e+215))) tmp = x * (1.0 + ((x ^ 2.0) * ((x * (0.125 + (x * -0.05))) - 0.16666666666666666))); else tmp = x * (1.0 + ((x ^ 2.0) * ((x * 0.125) - 0.16666666666666666))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1e+16], N[Sin[x], $MachinePrecision], If[Or[LessEqual[y, 3e+117], N[Not[LessEqual[y, 3.1e+215]], $MachinePrecision]], N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(x * N[(0.125 + N[(x * -0.05), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(x * 0.125), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+16}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+117} \lor \neg \left(y \leq 3.1 \cdot 10^{+215}\right):\\
\;\;\;\;x \cdot \left(1 + {x}^{2} \cdot \left(x \cdot \left(0.125 + x \cdot -0.05\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + {x}^{2} \cdot \left(x \cdot 0.125 - 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 1e16Initial program 100.0%
Taylor expanded in y around 0 66.7%
if 1e16 < y < 3e117 or 3.0999999999999999e215 < y Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.3%
expm1-define2.6%
Simplified2.6%
Taylor expanded in x around 0 6.3%
*-commutative6.3%
Simplified6.3%
Taylor expanded in x around 0 32.2%
if 3e117 < y < 3.0999999999999999e215Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.1%
expm1-define2.5%
Simplified2.5%
Taylor expanded in x around 0 5.6%
*-commutative5.6%
Simplified5.6%
Taylor expanded in x around 0 12.9%
Final simplification55.6%
(FPCore (x y)
:precision binary64
(if (<= y 1e+16)
(sin x)
(if (or (<= y 2.46e+117) (not (<= y 7.5e+216)))
(/ (* x (+ y (* -0.16666666666666666 (* y (pow x 2.0))))) y)
(* x (+ 1.0 (* (pow x 2.0) (- (* x 0.125) 0.16666666666666666)))))))
double code(double x, double y) {
double tmp;
if (y <= 1e+16) {
tmp = sin(x);
} else if ((y <= 2.46e+117) || !(y <= 7.5e+216)) {
tmp = (x * (y + (-0.16666666666666666 * (y * pow(x, 2.0))))) / y;
} else {
tmp = x * (1.0 + (pow(x, 2.0) * ((x * 0.125) - 0.16666666666666666)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1d+16) then
tmp = sin(x)
else if ((y <= 2.46d+117) .or. (.not. (y <= 7.5d+216))) then
tmp = (x * (y + ((-0.16666666666666666d0) * (y * (x ** 2.0d0))))) / y
else
tmp = x * (1.0d0 + ((x ** 2.0d0) * ((x * 0.125d0) - 0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1e+16) {
tmp = Math.sin(x);
} else if ((y <= 2.46e+117) || !(y <= 7.5e+216)) {
tmp = (x * (y + (-0.16666666666666666 * (y * Math.pow(x, 2.0))))) / y;
} else {
tmp = x * (1.0 + (Math.pow(x, 2.0) * ((x * 0.125) - 0.16666666666666666)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1e+16: tmp = math.sin(x) elif (y <= 2.46e+117) or not (y <= 7.5e+216): tmp = (x * (y + (-0.16666666666666666 * (y * math.pow(x, 2.0))))) / y else: tmp = x * (1.0 + (math.pow(x, 2.0) * ((x * 0.125) - 0.16666666666666666))) return tmp
function code(x, y) tmp = 0.0 if (y <= 1e+16) tmp = sin(x); elseif ((y <= 2.46e+117) || !(y <= 7.5e+216)) tmp = Float64(Float64(x * Float64(y + Float64(-0.16666666666666666 * Float64(y * (x ^ 2.0))))) / y); else tmp = Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64(x * 0.125) - 0.16666666666666666)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1e+16) tmp = sin(x); elseif ((y <= 2.46e+117) || ~((y <= 7.5e+216))) tmp = (x * (y + (-0.16666666666666666 * (y * (x ^ 2.0))))) / y; else tmp = x * (1.0 + ((x ^ 2.0) * ((x * 0.125) - 0.16666666666666666))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1e+16], N[Sin[x], $MachinePrecision], If[Or[LessEqual[y, 2.46e+117], N[Not[LessEqual[y, 7.5e+216]], $MachinePrecision]], N[(N[(x * N[(y + N[(-0.16666666666666666 * N[(y * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(x * 0.125), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+16}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 2.46 \cdot 10^{+117} \lor \neg \left(y \leq 7.5 \cdot 10^{+216}\right):\\
\;\;\;\;\frac{x \cdot \left(y + -0.16666666666666666 \cdot \left(y \cdot {x}^{2}\right)\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + {x}^{2} \cdot \left(x \cdot 0.125 - 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 1e16Initial program 100.0%
Taylor expanded in y around 0 66.7%
if 1e16 < y < 2.46000000000000002e117 or 7.4999999999999994e216 < y Initial program 100.0%
add-log-exp100.0%
*-un-lft-identity100.0%
log-prod100.0%
metadata-eval100.0%
add-log-exp100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 2.6%
Taylor expanded in x around 0 32.2%
if 2.46000000000000002e117 < y < 7.4999999999999994e216Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.1%
expm1-define2.5%
Simplified2.5%
Taylor expanded in x around 0 5.6%
*-commutative5.6%
Simplified5.6%
Taylor expanded in x around 0 12.9%
Final simplification55.6%
(FPCore (x y)
:precision binary64
(if (<= y 1e+16)
(sin x)
(if (or (<= y 6.2e+120) (not (<= y 1.65e+216)))
(+ x (* -0.16666666666666666 (pow x 3.0)))
(* x (+ 1.0 (* (pow x 2.0) (- (* x 0.125) 0.16666666666666666)))))))
double code(double x, double y) {
double tmp;
if (y <= 1e+16) {
tmp = sin(x);
} else if ((y <= 6.2e+120) || !(y <= 1.65e+216)) {
tmp = x + (-0.16666666666666666 * pow(x, 3.0));
} else {
tmp = x * (1.0 + (pow(x, 2.0) * ((x * 0.125) - 0.16666666666666666)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1d+16) then
tmp = sin(x)
else if ((y <= 6.2d+120) .or. (.not. (y <= 1.65d+216))) then
tmp = x + ((-0.16666666666666666d0) * (x ** 3.0d0))
else
tmp = x * (1.0d0 + ((x ** 2.0d0) * ((x * 0.125d0) - 0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1e+16) {
tmp = Math.sin(x);
} else if ((y <= 6.2e+120) || !(y <= 1.65e+216)) {
tmp = x + (-0.16666666666666666 * Math.pow(x, 3.0));
} else {
tmp = x * (1.0 + (Math.pow(x, 2.0) * ((x * 0.125) - 0.16666666666666666)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1e+16: tmp = math.sin(x) elif (y <= 6.2e+120) or not (y <= 1.65e+216): tmp = x + (-0.16666666666666666 * math.pow(x, 3.0)) else: tmp = x * (1.0 + (math.pow(x, 2.0) * ((x * 0.125) - 0.16666666666666666))) return tmp
function code(x, y) tmp = 0.0 if (y <= 1e+16) tmp = sin(x); elseif ((y <= 6.2e+120) || !(y <= 1.65e+216)) tmp = Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0))); else tmp = Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64(x * 0.125) - 0.16666666666666666)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1e+16) tmp = sin(x); elseif ((y <= 6.2e+120) || ~((y <= 1.65e+216))) tmp = x + (-0.16666666666666666 * (x ^ 3.0)); else tmp = x * (1.0 + ((x ^ 2.0) * ((x * 0.125) - 0.16666666666666666))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1e+16], N[Sin[x], $MachinePrecision], If[Or[LessEqual[y, 6.2e+120], N[Not[LessEqual[y, 1.65e+216]], $MachinePrecision]], N[(x + N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(x * 0.125), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+16}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+120} \lor \neg \left(y \leq 1.65 \cdot 10^{+216}\right):\\
\;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + {x}^{2} \cdot \left(x \cdot 0.125 - 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 1e16Initial program 100.0%
Taylor expanded in y around 0 66.7%
if 1e16 < y < 6.19999999999999947e120 or 1.65e216 < y Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.3%
expm1-define2.6%
Simplified2.6%
Taylor expanded in x around 0 22.9%
distribute-rgt-in22.9%
*-lft-identity22.9%
associate-*l*22.9%
pow-plus22.9%
metadata-eval22.9%
Simplified22.9%
if 6.19999999999999947e120 < y < 1.65e216Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.1%
expm1-define2.5%
Simplified2.5%
Taylor expanded in x around 0 5.7%
*-commutative5.7%
Simplified5.7%
Taylor expanded in x around 0 13.3%
Final simplification54.1%
(FPCore (x y) :precision binary64 (if (<= y 1.05e+16) (sin x) (+ x (* -0.16666666666666666 (pow x 3.0)))))
double code(double x, double y) {
double tmp;
if (y <= 1.05e+16) {
tmp = sin(x);
} else {
tmp = x + (-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) :: tmp
if (y <= 1.05d+16) then
tmp = sin(x)
else
tmp = x + ((-0.16666666666666666d0) * (x ** 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.05e+16) {
tmp = Math.sin(x);
} else {
tmp = x + (-0.16666666666666666 * Math.pow(x, 3.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.05e+16: tmp = math.sin(x) else: tmp = x + (-0.16666666666666666 * math.pow(x, 3.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.05e+16) tmp = sin(x); else tmp = Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.05e+16) tmp = sin(x); else tmp = x + (-0.16666666666666666 * (x ^ 3.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.05e+16], N[Sin[x], $MachinePrecision], N[(x + N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.05 \cdot 10^{+16}:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\
\end{array}
\end{array}
if y < 1.05e16Initial program 100.0%
Taylor expanded in y around 0 66.7%
if 1.05e16 < y Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.2%
expm1-define2.6%
Simplified2.6%
Taylor expanded in x around 0 18.0%
distribute-rgt-in18.0%
*-lft-identity18.0%
associate-*l*18.0%
pow-plus18.0%
metadata-eval18.0%
Simplified18.0%
(FPCore (x y) :precision binary64 (if (<= y 1e+16) (sin x) (* -0.16666666666666666 (pow x 3.0))))
double code(double x, double y) {
double tmp;
if (y <= 1e+16) {
tmp = sin(x);
} 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) :: tmp
if (y <= 1d+16) then
tmp = sin(x)
else
tmp = (-0.16666666666666666d0) * (x ** 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1e+16) {
tmp = Math.sin(x);
} else {
tmp = -0.16666666666666666 * Math.pow(x, 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1e+16: tmp = math.sin(x) else: tmp = -0.16666666666666666 * math.pow(x, 3.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 1e+16) tmp = sin(x); else tmp = Float64(-0.16666666666666666 * (x ^ 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1e+16) tmp = sin(x); else tmp = -0.16666666666666666 * (x ^ 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1e+16], N[Sin[x], $MachinePrecision], N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+16}:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot {x}^{3}\\
\end{array}
\end{array}
if y < 1e16Initial program 100.0%
Taylor expanded in y around 0 66.7%
if 1e16 < y Initial program 100.0%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.2%
expm1-define2.6%
Simplified2.6%
Taylor expanded in x around 0 18.0%
Taylor expanded in x around inf 17.6%
(FPCore (x y) :precision binary64 (if (<= y 1.95e+59) (sin x) (/ (* x y) y)))
double code(double x, double y) {
double tmp;
if (y <= 1.95e+59) {
tmp = sin(x);
} else {
tmp = (x * y) / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.95d+59) then
tmp = sin(x)
else
tmp = (x * y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.95e+59) {
tmp = Math.sin(x);
} else {
tmp = (x * y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.95e+59: tmp = math.sin(x) else: tmp = (x * y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= 1.95e+59) tmp = sin(x); else tmp = Float64(Float64(x * y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.95e+59) tmp = sin(x); else tmp = (x * y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.95e+59], N[Sin[x], $MachinePrecision], N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.95 \cdot 10^{+59}:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{y}\\
\end{array}
\end{array}
if y < 1.95000000000000011e59Initial program 100.0%
Taylor expanded in y around 0 64.4%
if 1.95000000000000011e59 < y Initial program 100.0%
add-log-exp100.0%
*-un-lft-identity100.0%
log-prod100.0%
metadata-eval100.0%
add-log-exp100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 2.6%
Taylor expanded in x around 0 11.4%
(FPCore (x y) :precision binary64 (if (<= x 1e+42) x (/ (* x y) y)))
double code(double x, double y) {
double tmp;
if (x <= 1e+42) {
tmp = x;
} else {
tmp = (x * y) / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 1d+42) then
tmp = x
else
tmp = (x * y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1e+42) {
tmp = x;
} else {
tmp = (x * y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1e+42: tmp = x else: tmp = (x * y) / y return tmp
function code(x, y) tmp = 0.0 if (x <= 1e+42) tmp = x; else tmp = Float64(Float64(x * y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1e+42) tmp = x; else tmp = (x * y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1e+42], x, N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+42}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{y}\\
\end{array}
\end{array}
if x < 1.00000000000000004e42Initial program 100.0%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 20.8%
expm1-define49.1%
Simplified49.1%
Taylor expanded in x around 0 32.3%
if 1.00000000000000004e42 < x Initial program 100.0%
add-log-exp99.4%
*-un-lft-identity99.4%
log-prod99.4%
metadata-eval99.4%
add-log-exp100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 50.7%
Taylor expanded in x around 0 7.6%
(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%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 28.6%
expm1-define49.5%
Simplified49.5%
Taylor expanded in x around 0 24.3%
herbie shell --seed 2024100
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))