
(FPCore (x y) :precision binary64 :pre TRUE (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
real(8) function code(x, y)
use fmin_fmax_functions
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]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = ((sin(x)) * (((1) / (2)) * ((exp(y)) + ((- (1)) / (exp(y)))))) / x END code
\frac{\sin x \cdot \sinh y}{x}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 :pre TRUE (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
real(8) function code(x, y)
use fmin_fmax_functions
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]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = ((sin(x)) * (((1) / (2)) * ((exp(y)) + ((- (1)) / (exp(y)))))) / x END code
\frac{\sin x \cdot \sinh y}{x}
(FPCore (x y) :precision binary64 :pre TRUE (* (sinh y) (/ (sin x) x)))
double code(double x, double y) {
return sinh(y) * (sin(x) / x);
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sinh(y) * (sin(x) / x)
end function
public static double code(double x, double y) {
return Math.sinh(y) * (Math.sin(x) / x);
}
def code(x, y): return math.sinh(y) * (math.sin(x) / x)
function code(x, y) return Float64(sinh(y) * Float64(sin(x) / x)) end
function tmp = code(x, y) tmp = sinh(y) * (sin(x) / x); end
code[x_, y_] := N[(N[Sinh[y], $MachinePrecision] * N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = (((1) / (2)) * ((exp(y)) + ((- (1)) / (exp(y))))) * ((sin(x)) / x) END code
\sinh y \cdot \frac{\sin x}{x}
Initial program 88.9%
Applied rewrites99.9%
(FPCore (x y)
:precision binary64
:pre TRUE
(let* ((t_0 (sinh (fabs y))) (t_1 (/ (* (sin x) t_0) x)))
(*
(copysign 1.0 y)
(if (<= t_1 (- INFINITY))
(* t_0 (fma (* x x) -0.16666666666666666 1.0))
(if (<= t_1 4e-46) (* (sin x) (/ (fabs y) x)) t_0)))))double code(double x, double y) {
double t_0 = sinh(fabs(y));
double t_1 = (sin(x) * t_0) / x;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_0 * fma((x * x), -0.16666666666666666, 1.0);
} else if (t_1 <= 4e-46) {
tmp = sin(x) * (fabs(y) / x);
} else {
tmp = t_0;
}
return copysign(1.0, y) * tmp;
}
function code(x, y) t_0 = sinh(abs(y)) t_1 = Float64(Float64(sin(x) * t_0) / x) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t_0 * fma(Float64(x * x), -0.16666666666666666, 1.0)); elseif (t_1 <= 4e-46) tmp = Float64(sin(x) * Float64(abs(y) / x)); else tmp = t_0; end return Float64(copysign(1.0, y) * tmp) end
code[x_, y_] := Block[{t$95$0 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision] / x), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, (-Infinity)], N[(t$95$0 * N[(N[(x * x), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-46], N[(N[Sin[x], $MachinePrecision] * N[(N[Abs[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], t$95$0]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \sinh \left(\left|y\right|\right)\\
t_1 := \frac{\sin x \cdot t\_0}{x}\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(x \cdot x, -0.16666666666666666, 1\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-46}:\\
\;\;\;\;\sin x \cdot \frac{\left|y\right|}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -inf.0Initial program 88.9%
Applied rewrites99.9%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites62.9%
Applied rewrites62.9%
if -inf.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 4.0000000000000001e-46Initial program 88.9%
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites62.9%
if 4.0000000000000001e-46 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Applied rewrites64.8%
(FPCore (x y)
:precision binary64
:pre TRUE
(let* ((t_0 (exp (fabs y))) (t_1 (sinh (fabs y))))
(*
(copysign 1.0 y)
(if (<= (fabs x) 6.575218410636739e+75)
t_1
(if (<= (fabs x) 2.9174093151562287e+89)
(* t_1 (fma (* (fabs x) (fabs x)) -0.16666666666666666 1.0))
(* 0.5 (- t_0 (/ 1.0 t_0))))))))double code(double x, double y) {
double t_0 = exp(fabs(y));
double t_1 = sinh(fabs(y));
double tmp;
if (fabs(x) <= 6.575218410636739e+75) {
tmp = t_1;
} else if (fabs(x) <= 2.9174093151562287e+89) {
tmp = t_1 * fma((fabs(x) * fabs(x)), -0.16666666666666666, 1.0);
} else {
tmp = 0.5 * (t_0 - (1.0 / t_0));
}
return copysign(1.0, y) * tmp;
}
function code(x, y) t_0 = exp(abs(y)) t_1 = sinh(abs(y)) tmp = 0.0 if (abs(x) <= 6.575218410636739e+75) tmp = t_1; elseif (abs(x) <= 2.9174093151562287e+89) tmp = Float64(t_1 * fma(Float64(abs(x) * abs(x)), -0.16666666666666666, 1.0)); else tmp = Float64(0.5 * Float64(t_0 - Float64(1.0 / t_0))); end return Float64(copysign(1.0, y) * tmp) end
code[x_, y_] := Block[{t$95$0 = N[Exp[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 6.575218410636739e+75], t$95$1, If[LessEqual[N[Abs[x], $MachinePrecision], 2.9174093151562287e+89], N[(t$95$1 * N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(t$95$0 - N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := e^{\left|y\right|}\\
t_1 := \sinh \left(\left|y\right|\right)\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 6.575218410636739 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\left|x\right| \leq 2.9174093151562287 \cdot 10^{+89}:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(\left|x\right| \cdot \left|x\right|, -0.16666666666666666, 1\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(t\_0 - \frac{1}{t\_0}\right)\\
\end{array}
\end{array}
if x < 6.5752184106367389e75Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Applied rewrites64.8%
if 6.5752184106367389e75 < x < 2.9174093151562287e89Initial program 88.9%
Applied rewrites99.9%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites62.9%
Applied rewrites62.9%
if 2.9174093151562287e89 < x Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
(FPCore (x y)
:precision binary64
:pre TRUE
(let* ((t_0 (sinh (fabs y))))
(*
(copysign 1.0 y)
(if (<= (fabs x) 6.575218410636739e+75)
t_0
(if (<= (fabs x) 2.9174093151562287e+89)
(* t_0 (fma (* (fabs x) (fabs x)) -0.16666666666666666 1.0))
(* (- (exp (fabs y)) (- 1.0 (fabs y))) 0.5))))))double code(double x, double y) {
double t_0 = sinh(fabs(y));
double tmp;
if (fabs(x) <= 6.575218410636739e+75) {
tmp = t_0;
} else if (fabs(x) <= 2.9174093151562287e+89) {
tmp = t_0 * fma((fabs(x) * fabs(x)), -0.16666666666666666, 1.0);
} else {
tmp = (exp(fabs(y)) - (1.0 - fabs(y))) * 0.5;
}
return copysign(1.0, y) * tmp;
}
function code(x, y) t_0 = sinh(abs(y)) tmp = 0.0 if (abs(x) <= 6.575218410636739e+75) tmp = t_0; elseif (abs(x) <= 2.9174093151562287e+89) tmp = Float64(t_0 * fma(Float64(abs(x) * abs(x)), -0.16666666666666666, 1.0)); else tmp = Float64(Float64(exp(abs(y)) - Float64(1.0 - abs(y))) * 0.5); end return Float64(copysign(1.0, y) * tmp) end
code[x_, y_] := Block[{t$95$0 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 6.575218410636739e+75], t$95$0, If[LessEqual[N[Abs[x], $MachinePrecision], 2.9174093151562287e+89], N[(t$95$0 * N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[Abs[y], $MachinePrecision]], $MachinePrecision] - N[(1.0 - N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \sinh \left(\left|y\right|\right)\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 6.575218410636739 \cdot 10^{+75}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\left|x\right| \leq 2.9174093151562287 \cdot 10^{+89}:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(\left|x\right| \cdot \left|x\right|, -0.16666666666666666, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{\left|y\right|} - \left(1 - \left|y\right|\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 6.5752184106367389e75Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Applied rewrites64.8%
if 6.5752184106367389e75 < x < 2.9174093151562287e89Initial program 88.9%
Applied rewrites99.9%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites62.9%
Applied rewrites62.9%
if 2.9174093151562287e89 < x Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Taylor expanded in y around 0
Applied rewrites35.5%
Applied rewrites35.5%
(FPCore (x y) :precision binary64 :pre TRUE (* (copysign 1.0 y) (if (<= (fabs x) 1.3074546278004367e+39) (sinh (fabs y)) (* (- (exp (fabs y)) (- 1.0 (fabs y))) 0.5))))
double code(double x, double y) {
double tmp;
if (fabs(x) <= 1.3074546278004367e+39) {
tmp = sinh(fabs(y));
} else {
tmp = (exp(fabs(y)) - (1.0 - fabs(y))) * 0.5;
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y) {
double tmp;
if (Math.abs(x) <= 1.3074546278004367e+39) {
tmp = Math.sinh(Math.abs(y));
} else {
tmp = (Math.exp(Math.abs(y)) - (1.0 - Math.abs(y))) * 0.5;
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y): tmp = 0 if math.fabs(x) <= 1.3074546278004367e+39: tmp = math.sinh(math.fabs(y)) else: tmp = (math.exp(math.fabs(y)) - (1.0 - math.fabs(y))) * 0.5 return math.copysign(1.0, y) * tmp
function code(x, y) tmp = 0.0 if (abs(x) <= 1.3074546278004367e+39) tmp = sinh(abs(y)); else tmp = Float64(Float64(exp(abs(y)) - Float64(1.0 - abs(y))) * 0.5); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y) tmp = 0.0; if (abs(x) <= 1.3074546278004367e+39) tmp = sinh(abs(y)); else tmp = (exp(abs(y)) - (1.0 - abs(y))) * 0.5; end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 1.3074546278004367e+39], N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision], N[(N[(N[Exp[N[Abs[y], $MachinePrecision]], $MachinePrecision] - N[(1.0 - N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 1.3074546278004367 \cdot 10^{+39}:\\
\;\;\;\;\sinh \left(\left|y\right|\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{\left|y\right|} - \left(1 - \left|y\right|\right)\right) \cdot 0.5\\
\end{array}
if x < 1.3074546278004367e39Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Applied rewrites64.8%
if 1.3074546278004367e39 < x Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Taylor expanded in y around 0
Applied rewrites35.5%
Applied rewrites35.5%
(FPCore (x y)
:precision binary64
:pre TRUE
(*
(copysign 1.0 y)
(if (<= (fabs x) 4.414482953417929e+77)
(sinh (fabs y))
(*
(- (fma (fma 0.5 (fabs y) 1.0) (fabs y) 1.0) (- 1.0 (fabs y)))
0.5))))double code(double x, double y) {
double tmp;
if (fabs(x) <= 4.414482953417929e+77) {
tmp = sinh(fabs(y));
} else {
tmp = (fma(fma(0.5, fabs(y), 1.0), fabs(y), 1.0) - (1.0 - fabs(y))) * 0.5;
}
return copysign(1.0, y) * tmp;
}
function code(x, y) tmp = 0.0 if (abs(x) <= 4.414482953417929e+77) tmp = sinh(abs(y)); else tmp = Float64(Float64(fma(fma(0.5, abs(y), 1.0), abs(y), 1.0) - Float64(1.0 - abs(y))) * 0.5); end return Float64(copysign(1.0, y) * tmp) end
code[x_, y_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 4.414482953417929e+77], N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[(0.5 * N[Abs[y], $MachinePrecision] + 1.0), $MachinePrecision] * N[Abs[y], $MachinePrecision] + 1.0), $MachinePrecision] - N[(1.0 - N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 4.414482953417929 \cdot 10^{+77}:\\
\;\;\;\;\sinh \left(\left|y\right|\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(0.5, \left|y\right|, 1\right), \left|y\right|, 1\right) - \left(1 - \left|y\right|\right)\right) \cdot 0.5\\
\end{array}
if x < 4.414482953417929e77Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Applied rewrites64.8%
if 4.414482953417929e77 < x Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Taylor expanded in y around 0
Applied rewrites35.5%
Taylor expanded in y around 0
Applied rewrites28.3%
Applied rewrites28.3%
(FPCore (x y) :precision binary64 :pre TRUE (if (<= (fabs x) 1.538824596465832e+138) (sinh y) (* (- (- y -1.0) (- 1.0 y)) 0.5)))
double code(double x, double y) {
double tmp;
if (fabs(x) <= 1.538824596465832e+138) {
tmp = sinh(y);
} else {
tmp = ((y - -1.0) - (1.0 - y)) * 0.5;
}
return tmp;
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (abs(x) <= 1.538824596465832d+138) then
tmp = sinh(y)
else
tmp = ((y - (-1.0d0)) - (1.0d0 - y)) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.abs(x) <= 1.538824596465832e+138) {
tmp = Math.sinh(y);
} else {
tmp = ((y - -1.0) - (1.0 - y)) * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if math.fabs(x) <= 1.538824596465832e+138: tmp = math.sinh(y) else: tmp = ((y - -1.0) - (1.0 - y)) * 0.5 return tmp
function code(x, y) tmp = 0.0 if (abs(x) <= 1.538824596465832e+138) tmp = sinh(y); else tmp = Float64(Float64(Float64(y - -1.0) - Float64(1.0 - y)) * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (abs(x) <= 1.538824596465832e+138) tmp = sinh(y); else tmp = ((y - -1.0) - (1.0 - y)) * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Abs[x], $MachinePrecision], 1.538824596465832e+138], N[Sinh[y], $MachinePrecision], N[(N[(N[(y - -1.0), $MachinePrecision] - N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = LET tmp = IF ((abs(x)) <= (1538824596465832064834429787659023318790986286200578955760090637805956879730743687518287917823051291161627589587803539258046338137333956608)) THEN (((1) / (2)) * ((exp(y)) + ((- (1)) / (exp(y))))) ELSE (((y - (-1)) - ((1) - y)) * (5e-1)) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 1.538824596465832 \cdot 10^{+138}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - -1\right) - \left(1 - y\right)\right) \cdot 0.5\\
\end{array}
if x < 1.5388245964658321e138Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Applied rewrites64.8%
if 1.5388245964658321e138 < x Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Taylor expanded in y around 0
Applied rewrites35.5%
Taylor expanded in y around 0
Applied rewrites16.6%
Applied rewrites16.6%
(FPCore (x y) :precision binary64 :pre TRUE (if (<= (fabs x) 9.508742156060054e+42) (* (+ y y) 0.5) (* (- (- y -1.0) (- 1.0 y)) 0.5)))
double code(double x, double y) {
double tmp;
if (fabs(x) <= 9.508742156060054e+42) {
tmp = (y + y) * 0.5;
} else {
tmp = ((y - -1.0) - (1.0 - y)) * 0.5;
}
return tmp;
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (abs(x) <= 9.508742156060054d+42) then
tmp = (y + y) * 0.5d0
else
tmp = ((y - (-1.0d0)) - (1.0d0 - y)) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.abs(x) <= 9.508742156060054e+42) {
tmp = (y + y) * 0.5;
} else {
tmp = ((y - -1.0) - (1.0 - y)) * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if math.fabs(x) <= 9.508742156060054e+42: tmp = (y + y) * 0.5 else: tmp = ((y - -1.0) - (1.0 - y)) * 0.5 return tmp
function code(x, y) tmp = 0.0 if (abs(x) <= 9.508742156060054e+42) tmp = Float64(Float64(y + y) * 0.5); else tmp = Float64(Float64(Float64(y - -1.0) - Float64(1.0 - y)) * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (abs(x) <= 9.508742156060054e+42) tmp = (y + y) * 0.5; else tmp = ((y - -1.0) - (1.0 - y)) * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Abs[x], $MachinePrecision], 9.508742156060054e+42], N[(N[(y + y), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(y - -1.0), $MachinePrecision] - N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = LET tmp = IF ((abs(x)) <= (9508742156060053731629728907426303123128320)) THEN ((y + y) * (5e-1)) ELSE (((y - (-1)) - ((1) - y)) * (5e-1)) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 9.508742156060054 \cdot 10^{+42}:\\
\;\;\;\;\left(y + y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - -1\right) - \left(1 - y\right)\right) \cdot 0.5\\
\end{array}
if x < 9.5087421560600537e42Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Taylor expanded in y around 0
Applied rewrites28.3%
Applied rewrites28.3%
if 9.5087421560600537e42 < x Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Taylor expanded in y around 0
Applied rewrites35.5%
Taylor expanded in y around 0
Applied rewrites16.6%
Applied rewrites16.6%
(FPCore (x y) :precision binary64 :pre TRUE (* (copysign 1.0 y) (if (<= (/ (* (sin x) (sinh (fabs y))) x) 2e-10) (* (+ (fabs y) (fabs y)) 0.5) (/ (* x (fabs y)) x))))
double code(double x, double y) {
double tmp;
if (((sin(x) * sinh(fabs(y))) / x) <= 2e-10) {
tmp = (fabs(y) + fabs(y)) * 0.5;
} else {
tmp = (x * fabs(y)) / x;
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y) {
double tmp;
if (((Math.sin(x) * Math.sinh(Math.abs(y))) / x) <= 2e-10) {
tmp = (Math.abs(y) + Math.abs(y)) * 0.5;
} else {
tmp = (x * Math.abs(y)) / x;
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y): tmp = 0 if ((math.sin(x) * math.sinh(math.fabs(y))) / x) <= 2e-10: tmp = (math.fabs(y) + math.fabs(y)) * 0.5 else: tmp = (x * math.fabs(y)) / x return math.copysign(1.0, y) * tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(sin(x) * sinh(abs(y))) / x) <= 2e-10) tmp = Float64(Float64(abs(y) + abs(y)) * 0.5); else tmp = Float64(Float64(x * abs(y)) / x); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y) tmp = 0.0; if (((sin(x) * sinh(abs(y))) / x) <= 2e-10) tmp = (abs(y) + abs(y)) * 0.5; else tmp = (x * abs(y)) / x; end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 2e-10], N[(N[(N[Abs[y], $MachinePrecision] + N[Abs[y], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(x * N[Abs[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin x \cdot \sinh \left(\left|y\right|\right)}{x} \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\left(\left|y\right| + \left|y\right|\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left|y\right|}{x}\\
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 2.0000000000000001e-10Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Taylor expanded in y around 0
Applied rewrites28.3%
Applied rewrites28.3%
if 2.0000000000000001e-10 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.9%
Taylor expanded in y around 0
Applied rewrites40.0%
Taylor expanded in x around 0
Applied rewrites23.5%
(FPCore (x y) :precision binary64 :pre TRUE (* (+ y y) 0.5))
double code(double x, double y) {
return (y + y) * 0.5;
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y + y) * 0.5d0
end function
public static double code(double x, double y) {
return (y + y) * 0.5;
}
def code(x, y): return (y + y) * 0.5
function code(x, y) return Float64(Float64(y + y) * 0.5) end
function tmp = code(x, y) tmp = (y + y) * 0.5; end
code[x_, y_] := N[(N[(y + y), $MachinePrecision] * 0.5), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = (y + y) * (5e-1) END code
\left(y + y\right) \cdot 0.5
Initial program 88.9%
Taylor expanded in x around 0
Applied rewrites53.1%
Taylor expanded in y around 0
Applied rewrites28.3%
Applied rewrites28.3%
herbie shell --seed 2026092
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
(/ (* (sin x) (sinh y)) x))