
(FPCore (z1 z0) :precision binary64 (let* ((t_0 (* (* z1 PI) z0))) (/ (sin t_0) (* (* t_0 z0) PI))))
double code(double z1, double z0) {
double t_0 = (z1 * ((double) M_PI)) * z0;
return sin(t_0) / ((t_0 * z0) * ((double) M_PI));
}
public static double code(double z1, double z0) {
double t_0 = (z1 * Math.PI) * z0;
return Math.sin(t_0) / ((t_0 * z0) * Math.PI);
}
def code(z1, z0): t_0 = (z1 * math.pi) * z0 return math.sin(t_0) / ((t_0 * z0) * math.pi)
function code(z1, z0) t_0 = Float64(Float64(z1 * pi) * z0) return Float64(sin(t_0) / Float64(Float64(t_0 * z0) * pi)) end
function tmp = code(z1, z0) t_0 = (z1 * pi) * z0; tmp = sin(t_0) / ((t_0 * z0) * pi); end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(z1 * Pi), $MachinePrecision] * z0), $MachinePrecision]}, N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[(t$95$0 * z0), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(z1 \cdot \pi\right) \cdot z0\\
\frac{\sin t\_0}{\left(t\_0 \cdot z0\right) \cdot \pi}
\end{array}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z1 z0) :precision binary64 (let* ((t_0 (* (* z1 PI) z0))) (/ (sin t_0) (* (* t_0 z0) PI))))
double code(double z1, double z0) {
double t_0 = (z1 * ((double) M_PI)) * z0;
return sin(t_0) / ((t_0 * z0) * ((double) M_PI));
}
public static double code(double z1, double z0) {
double t_0 = (z1 * Math.PI) * z0;
return Math.sin(t_0) / ((t_0 * z0) * Math.PI);
}
def code(z1, z0): t_0 = (z1 * math.pi) * z0 return math.sin(t_0) / ((t_0 * z0) * math.pi)
function code(z1, z0) t_0 = Float64(Float64(z1 * pi) * z0) return Float64(sin(t_0) / Float64(Float64(t_0 * z0) * pi)) end
function tmp = code(z1, z0) t_0 = (z1 * pi) * z0; tmp = sin(t_0) / ((t_0 * z0) * pi); end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(z1 * Pi), $MachinePrecision] * z0), $MachinePrecision]}, N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[(t$95$0 * z0), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(z1 \cdot \pi\right) \cdot z0\\
\frac{\sin t\_0}{\left(t\_0 \cdot z0\right) \cdot \pi}
\end{array}
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (* (fabs z0) (* PI (fabs z1))))
(t_1 (* (* (fabs z1) PI) (fabs z0)))
(t_2 (* (* t_1 (fabs z0)) PI))
(t_3 (/ (sin t_1) t_2))
(t_4 (* (fabs z0) (fabs z1))))
(*
(copysign 1.0 z0)
(if (<= t_3 1e-174)
(/
(/
(+
(sin (- (* 0.5 PI) (+ (* PI (+ t_4 0.5)) PI)))
(sin (* t_4 PI)))
2.0)
t_2)
(if (<= t_3 INFINITY)
(/ (/ (sin t_0) (* (fabs z0) PI)) t_0)
(/ (sin PI) t_2))))))double code(double z1, double z0) {
double t_0 = fabs(z0) * (((double) M_PI) * fabs(z1));
double t_1 = (fabs(z1) * ((double) M_PI)) * fabs(z0);
double t_2 = (t_1 * fabs(z0)) * ((double) M_PI);
double t_3 = sin(t_1) / t_2;
double t_4 = fabs(z0) * fabs(z1);
double tmp;
if (t_3 <= 1e-174) {
tmp = ((sin(((0.5 * ((double) M_PI)) - ((((double) M_PI) * (t_4 + 0.5)) + ((double) M_PI)))) + sin((t_4 * ((double) M_PI)))) / 2.0) / t_2;
} else if (t_3 <= ((double) INFINITY)) {
tmp = (sin(t_0) / (fabs(z0) * ((double) M_PI))) / t_0;
} else {
tmp = sin(((double) M_PI)) / t_2;
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = Math.abs(z0) * (Math.PI * Math.abs(z1));
double t_1 = (Math.abs(z1) * Math.PI) * Math.abs(z0);
double t_2 = (t_1 * Math.abs(z0)) * Math.PI;
double t_3 = Math.sin(t_1) / t_2;
double t_4 = Math.abs(z0) * Math.abs(z1);
double tmp;
if (t_3 <= 1e-174) {
tmp = ((Math.sin(((0.5 * Math.PI) - ((Math.PI * (t_4 + 0.5)) + Math.PI))) + Math.sin((t_4 * Math.PI))) / 2.0) / t_2;
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = (Math.sin(t_0) / (Math.abs(z0) * Math.PI)) / t_0;
} else {
tmp = Math.sin(Math.PI) / t_2;
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0): t_0 = math.fabs(z0) * (math.pi * math.fabs(z1)) t_1 = (math.fabs(z1) * math.pi) * math.fabs(z0) t_2 = (t_1 * math.fabs(z0)) * math.pi t_3 = math.sin(t_1) / t_2 t_4 = math.fabs(z0) * math.fabs(z1) tmp = 0 if t_3 <= 1e-174: tmp = ((math.sin(((0.5 * math.pi) - ((math.pi * (t_4 + 0.5)) + math.pi))) + math.sin((t_4 * math.pi))) / 2.0) / t_2 elif t_3 <= math.inf: tmp = (math.sin(t_0) / (math.fabs(z0) * math.pi)) / t_0 else: tmp = math.sin(math.pi) / t_2 return math.copysign(1.0, z0) * tmp
function code(z1, z0) t_0 = Float64(abs(z0) * Float64(pi * abs(z1))) t_1 = Float64(Float64(abs(z1) * pi) * abs(z0)) t_2 = Float64(Float64(t_1 * abs(z0)) * pi) t_3 = Float64(sin(t_1) / t_2) t_4 = Float64(abs(z0) * abs(z1)) tmp = 0.0 if (t_3 <= 1e-174) tmp = Float64(Float64(Float64(sin(Float64(Float64(0.5 * pi) - Float64(Float64(pi * Float64(t_4 + 0.5)) + pi))) + sin(Float64(t_4 * pi))) / 2.0) / t_2); elseif (t_3 <= Inf) tmp = Float64(Float64(sin(t_0) / Float64(abs(z0) * pi)) / t_0); else tmp = Float64(sin(pi) / t_2); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z1, z0) t_0 = abs(z0) * (pi * abs(z1)); t_1 = (abs(z1) * pi) * abs(z0); t_2 = (t_1 * abs(z0)) * pi; t_3 = sin(t_1) / t_2; t_4 = abs(z0) * abs(z1); tmp = 0.0; if (t_3 <= 1e-174) tmp = ((sin(((0.5 * pi) - ((pi * (t_4 + 0.5)) + pi))) + sin((t_4 * pi))) / 2.0) / t_2; elseif (t_3 <= Inf) tmp = (sin(t_0) / (abs(z0) * pi)) / t_0; else tmp = sin(pi) / t_2; end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(N[Abs[z0], $MachinePrecision] * N[(Pi * N[Abs[z1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[t$95$1], $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[z0], $MachinePrecision] * N[Abs[z1], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 1e-174], N[(N[(N[(N[Sin[N[(N[(0.5 * Pi), $MachinePrecision] - N[(N[(Pi * N[(t$95$4 + 0.5), $MachinePrecision]), $MachinePrecision] + Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Sin[N[(t$95$4 * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / t$95$2), $MachinePrecision]]]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \left|z0\right| \cdot \left(\pi \cdot \left|z1\right|\right)\\
t_1 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\
t_2 := \left(t\_1 \cdot \left|z0\right|\right) \cdot \pi\\
t_3 := \frac{\sin t\_1}{t\_2}\\
t_4 := \left|z0\right| \cdot \left|z1\right|\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq 10^{-174}:\\
\;\;\;\;\frac{\frac{\sin \left(0.5 \cdot \pi - \left(\pi \cdot \left(t\_4 + 0.5\right) + \pi\right)\right) + \sin \left(t\_4 \cdot \pi\right)}{2}}{t\_2}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\frac{\frac{\sin t\_0}{\left|z0\right| \cdot \pi}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{t\_2}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 (*.f64 (*.f64 z1 (PI.f64)) z0)) (*.f64 (*.f64 (*.f64 (*.f64 z1 (PI.f64)) z0) z0) (PI.f64))) < 1e-174Initial program 42.7%
*-rgt-identityN/A
lift-sin.f64N/A
sin-PI/2N/A
sin-multN/A
lower-/.f64N/A
Applied rewrites18.7%
Applied rewrites37.8%
if 1e-174 < (/.f64 (sin.f64 (*.f64 (*.f64 z1 (PI.f64)) z0)) (*.f64 (*.f64 (*.f64 (*.f64 z1 (PI.f64)) z0) z0) (PI.f64))) < +inf.0Initial program 42.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6453.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.7%
Applied rewrites53.7%
if +inf.0 < (/.f64 (sin.f64 (*.f64 (*.f64 z1 (PI.f64)) z0)) (*.f64 (*.f64 (*.f64 (*.f64 z1 (PI.f64)) z0) z0) (PI.f64))) Initial program 42.7%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
cos-+PI/2-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
Applied rewrites18.5%
Taylor expanded in z1 around 0
lower-PI.f6429.5%
Applied rewrites29.5%
(FPCore (z1 z0) :precision binary64 (* (copysign 1.0 z0) (if (<= (fabs z0) 8.6e-7) (/ 1.0 (* (fabs z0) PI)) (/ 1.0 (log (exp (* PI (fabs z0))))))))
double code(double z1, double z0) {
double tmp;
if (fabs(z0) <= 8.6e-7) {
tmp = 1.0 / (fabs(z0) * ((double) M_PI));
} else {
tmp = 1.0 / log(exp((((double) M_PI) * fabs(z0))));
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
double tmp;
if (Math.abs(z0) <= 8.6e-7) {
tmp = 1.0 / (Math.abs(z0) * Math.PI);
} else {
tmp = 1.0 / Math.log(Math.exp((Math.PI * Math.abs(z0))));
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0): tmp = 0 if math.fabs(z0) <= 8.6e-7: tmp = 1.0 / (math.fabs(z0) * math.pi) else: tmp = 1.0 / math.log(math.exp((math.pi * math.fabs(z0)))) return math.copysign(1.0, z0) * tmp
function code(z1, z0) tmp = 0.0 if (abs(z0) <= 8.6e-7) tmp = Float64(1.0 / Float64(abs(z0) * pi)); else tmp = Float64(1.0 / log(exp(Float64(pi * abs(z0))))); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z1, z0) tmp = 0.0; if (abs(z0) <= 8.6e-7) tmp = 1.0 / (abs(z0) * pi); else tmp = 1.0 / log(exp((pi * abs(z0)))); end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z1_, z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 8.6e-7], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Log[N[Exp[N[(Pi * N[Abs[z0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 8.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\log \left(e^{\pi \cdot \left|z0\right|}\right)}\\
\end{array}
if z0 < 8.6000000000000002e-7Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
if 8.6000000000000002e-7 < z0 Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
lift-*.f64N/A
lift-PI.f64N/A
add-log-expN/A
log-pow-revN/A
lower-log.f64N/A
lift-PI.f64N/A
pow-expN/A
*-commutativeN/A
lift-*.f64N/A
lower-exp.f6438.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6438.3%
Applied rewrites38.3%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (* (fabs z0) (* PI (fabs z1)))))
(*
(copysign 1.0 z0)
(if (<= (fabs z0) 3.7e-53)
(/ 1.0 (* (fabs z0) PI))
(if (<= (fabs z0) 3.5e+152)
(* (/ (sin t_0) PI) (/ 1.0 (* t_0 (fabs z0))))
(/
(* 0.5 (cos (- (* 0.5 PI))))
(* (* (* (* (fabs z1) PI) (fabs z0)) (fabs z0)) PI)))))))double code(double z1, double z0) {
double t_0 = fabs(z0) * (((double) M_PI) * fabs(z1));
double tmp;
if (fabs(z0) <= 3.7e-53) {
tmp = 1.0 / (fabs(z0) * ((double) M_PI));
} else if (fabs(z0) <= 3.5e+152) {
tmp = (sin(t_0) / ((double) M_PI)) * (1.0 / (t_0 * fabs(z0)));
} else {
tmp = (0.5 * cos(-(0.5 * ((double) M_PI)))) / ((((fabs(z1) * ((double) M_PI)) * fabs(z0)) * fabs(z0)) * ((double) M_PI));
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = Math.abs(z0) * (Math.PI * Math.abs(z1));
double tmp;
if (Math.abs(z0) <= 3.7e-53) {
tmp = 1.0 / (Math.abs(z0) * Math.PI);
} else if (Math.abs(z0) <= 3.5e+152) {
tmp = (Math.sin(t_0) / Math.PI) * (1.0 / (t_0 * Math.abs(z0)));
} else {
tmp = (0.5 * Math.cos(-(0.5 * Math.PI))) / ((((Math.abs(z1) * Math.PI) * Math.abs(z0)) * Math.abs(z0)) * Math.PI);
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0): t_0 = math.fabs(z0) * (math.pi * math.fabs(z1)) tmp = 0 if math.fabs(z0) <= 3.7e-53: tmp = 1.0 / (math.fabs(z0) * math.pi) elif math.fabs(z0) <= 3.5e+152: tmp = (math.sin(t_0) / math.pi) * (1.0 / (t_0 * math.fabs(z0))) else: tmp = (0.5 * math.cos(-(0.5 * math.pi))) / ((((math.fabs(z1) * math.pi) * math.fabs(z0)) * math.fabs(z0)) * math.pi) return math.copysign(1.0, z0) * tmp
function code(z1, z0) t_0 = Float64(abs(z0) * Float64(pi * abs(z1))) tmp = 0.0 if (abs(z0) <= 3.7e-53) tmp = Float64(1.0 / Float64(abs(z0) * pi)); elseif (abs(z0) <= 3.5e+152) tmp = Float64(Float64(sin(t_0) / pi) * Float64(1.0 / Float64(t_0 * abs(z0)))); else tmp = Float64(Float64(0.5 * cos(Float64(-Float64(0.5 * pi)))) / Float64(Float64(Float64(Float64(abs(z1) * pi) * abs(z0)) * abs(z0)) * pi)); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z1, z0) t_0 = abs(z0) * (pi * abs(z1)); tmp = 0.0; if (abs(z0) <= 3.7e-53) tmp = 1.0 / (abs(z0) * pi); elseif (abs(z0) <= 3.5e+152) tmp = (sin(t_0) / pi) * (1.0 / (t_0 * abs(z0))); else tmp = (0.5 * cos(-(0.5 * pi))) / ((((abs(z1) * pi) * abs(z0)) * abs(z0)) * pi); end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(N[Abs[z0], $MachinePrecision] * N[(Pi * N[Abs[z1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 3.7e-53], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[(N[Sin[t$95$0], $MachinePrecision] / Pi), $MachinePrecision] * N[(1.0 / N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Cos[(-N[(0.5 * Pi), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|z0\right| \cdot \left(\pi \cdot \left|z1\right|\right)\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 3.7 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\
\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{\pi} \cdot \frac{1}{t\_0 \cdot \left|z0\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}{\left(\left(\left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\right) \cdot \left|z0\right|\right) \cdot \pi}\\
\end{array}
\end{array}
if z0 < 3.6999999999999998e-53Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
if 3.6999999999999998e-53 < z0 < 3.4999999999999998e152Initial program 42.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6441.7%
Applied rewrites41.7%
if 3.4999999999999998e152 < z0 Initial program 42.7%
*-rgt-identityN/A
lift-sin.f64N/A
sin-PI/2N/A
sin-multN/A
lower-/.f64N/A
Applied rewrites18.7%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-PI.f6429.5%
Applied rewrites29.5%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (* (* (fabs z1) PI) (fabs z0)))
(t_1 (* (* t_0 (fabs z0)) PI)))
(*
(copysign 1.0 z0)
(if (<= (fabs z0) 1.6e-53)
(/ 1.0 (* (fabs z0) PI))
(if (<= (fabs z0) 3.5e+152)
(/ (sin t_0) t_1)
(/ (* 0.5 (cos (- (* 0.5 PI)))) t_1))))))double code(double z1, double z0) {
double t_0 = (fabs(z1) * ((double) M_PI)) * fabs(z0);
double t_1 = (t_0 * fabs(z0)) * ((double) M_PI);
double tmp;
if (fabs(z0) <= 1.6e-53) {
tmp = 1.0 / (fabs(z0) * ((double) M_PI));
} else if (fabs(z0) <= 3.5e+152) {
tmp = sin(t_0) / t_1;
} else {
tmp = (0.5 * cos(-(0.5 * ((double) M_PI)))) / t_1;
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = (Math.abs(z1) * Math.PI) * Math.abs(z0);
double t_1 = (t_0 * Math.abs(z0)) * Math.PI;
double tmp;
if (Math.abs(z0) <= 1.6e-53) {
tmp = 1.0 / (Math.abs(z0) * Math.PI);
} else if (Math.abs(z0) <= 3.5e+152) {
tmp = Math.sin(t_0) / t_1;
} else {
tmp = (0.5 * Math.cos(-(0.5 * Math.PI))) / t_1;
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0): t_0 = (math.fabs(z1) * math.pi) * math.fabs(z0) t_1 = (t_0 * math.fabs(z0)) * math.pi tmp = 0 if math.fabs(z0) <= 1.6e-53: tmp = 1.0 / (math.fabs(z0) * math.pi) elif math.fabs(z0) <= 3.5e+152: tmp = math.sin(t_0) / t_1 else: tmp = (0.5 * math.cos(-(0.5 * math.pi))) / t_1 return math.copysign(1.0, z0) * tmp
function code(z1, z0) t_0 = Float64(Float64(abs(z1) * pi) * abs(z0)) t_1 = Float64(Float64(t_0 * abs(z0)) * pi) tmp = 0.0 if (abs(z0) <= 1.6e-53) tmp = Float64(1.0 / Float64(abs(z0) * pi)); elseif (abs(z0) <= 3.5e+152) tmp = Float64(sin(t_0) / t_1); else tmp = Float64(Float64(0.5 * cos(Float64(-Float64(0.5 * pi)))) / t_1); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z1, z0) t_0 = (abs(z1) * pi) * abs(z0); t_1 = (t_0 * abs(z0)) * pi; tmp = 0.0; if (abs(z0) <= 1.6e-53) tmp = 1.0 / (abs(z0) * pi); elseif (abs(z0) <= 3.5e+152) tmp = sin(t_0) / t_1; else tmp = (0.5 * cos(-(0.5 * pi))) / t_1; end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 1.6e-53], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[Sin[t$95$0], $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(0.5 * N[Cos[(-N[(0.5 * Pi), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\
t_1 := \left(t\_0 \cdot \left|z0\right|\right) \cdot \pi\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\
\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}{t\_1}\\
\end{array}
\end{array}
if z0 < 1.6e-53Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
if 1.6e-53 < z0 < 3.4999999999999998e152Initial program 42.7%
if 3.4999999999999998e152 < z0 Initial program 42.7%
*-rgt-identityN/A
lift-sin.f64N/A
sin-PI/2N/A
sin-multN/A
lower-/.f64N/A
Applied rewrites18.7%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-PI.f6429.5%
Applied rewrites29.5%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (* (* (fabs z1) PI) (fabs z0)))
(t_1 (* (* t_0 (fabs z0)) PI)))
(*
(copysign 1.0 z0)
(if (<= (fabs z0) 1.6e-53)
(/ 1.0 (* (fabs z0) PI))
(if (<= (fabs z0) 3.5e+152)
(/ (sin t_0) t_1)
(/ (sin PI) t_1))))))double code(double z1, double z0) {
double t_0 = (fabs(z1) * ((double) M_PI)) * fabs(z0);
double t_1 = (t_0 * fabs(z0)) * ((double) M_PI);
double tmp;
if (fabs(z0) <= 1.6e-53) {
tmp = 1.0 / (fabs(z0) * ((double) M_PI));
} else if (fabs(z0) <= 3.5e+152) {
tmp = sin(t_0) / t_1;
} else {
tmp = sin(((double) M_PI)) / t_1;
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = (Math.abs(z1) * Math.PI) * Math.abs(z0);
double t_1 = (t_0 * Math.abs(z0)) * Math.PI;
double tmp;
if (Math.abs(z0) <= 1.6e-53) {
tmp = 1.0 / (Math.abs(z0) * Math.PI);
} else if (Math.abs(z0) <= 3.5e+152) {
tmp = Math.sin(t_0) / t_1;
} else {
tmp = Math.sin(Math.PI) / t_1;
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0): t_0 = (math.fabs(z1) * math.pi) * math.fabs(z0) t_1 = (t_0 * math.fabs(z0)) * math.pi tmp = 0 if math.fabs(z0) <= 1.6e-53: tmp = 1.0 / (math.fabs(z0) * math.pi) elif math.fabs(z0) <= 3.5e+152: tmp = math.sin(t_0) / t_1 else: tmp = math.sin(math.pi) / t_1 return math.copysign(1.0, z0) * tmp
function code(z1, z0) t_0 = Float64(Float64(abs(z1) * pi) * abs(z0)) t_1 = Float64(Float64(t_0 * abs(z0)) * pi) tmp = 0.0 if (abs(z0) <= 1.6e-53) tmp = Float64(1.0 / Float64(abs(z0) * pi)); elseif (abs(z0) <= 3.5e+152) tmp = Float64(sin(t_0) / t_1); else tmp = Float64(sin(pi) / t_1); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z1, z0) t_0 = (abs(z1) * pi) * abs(z0); t_1 = (t_0 * abs(z0)) * pi; tmp = 0.0; if (abs(z0) <= 1.6e-53) tmp = 1.0 / (abs(z0) * pi); elseif (abs(z0) <= 3.5e+152) tmp = sin(t_0) / t_1; else tmp = sin(pi) / t_1; end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 1.6e-53], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[Sin[t$95$0], $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / t$95$1), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\
t_1 := \left(t\_0 \cdot \left|z0\right|\right) \cdot \pi\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\
\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{t\_1}\\
\end{array}
\end{array}
if z0 < 1.6e-53Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
if 1.6e-53 < z0 < 3.4999999999999998e152Initial program 42.7%
if 3.4999999999999998e152 < z0 Initial program 42.7%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
cos-+PI/2-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
Applied rewrites18.5%
Taylor expanded in z1 around 0
lower-PI.f6429.5%
Applied rewrites29.5%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (* (* (fabs z1) PI) (fabs z0))) (t_1 (* (fabs z0) PI)))
(*
(copysign 1.0 z0)
(if (<= (fabs z0) 1.6e-53)
(/ 1.0 t_1)
(if (<= (fabs z0) 3.5e+152)
(/ (sin t_0) (* (* (fabs z0) (* PI (fabs z1))) t_1))
(/ (sin PI) (* (* t_0 (fabs z0)) PI)))))))double code(double z1, double z0) {
double t_0 = (fabs(z1) * ((double) M_PI)) * fabs(z0);
double t_1 = fabs(z0) * ((double) M_PI);
double tmp;
if (fabs(z0) <= 1.6e-53) {
tmp = 1.0 / t_1;
} else if (fabs(z0) <= 3.5e+152) {
tmp = sin(t_0) / ((fabs(z0) * (((double) M_PI) * fabs(z1))) * t_1);
} else {
tmp = sin(((double) M_PI)) / ((t_0 * fabs(z0)) * ((double) M_PI));
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = (Math.abs(z1) * Math.PI) * Math.abs(z0);
double t_1 = Math.abs(z0) * Math.PI;
double tmp;
if (Math.abs(z0) <= 1.6e-53) {
tmp = 1.0 / t_1;
} else if (Math.abs(z0) <= 3.5e+152) {
tmp = Math.sin(t_0) / ((Math.abs(z0) * (Math.PI * Math.abs(z1))) * t_1);
} else {
tmp = Math.sin(Math.PI) / ((t_0 * Math.abs(z0)) * Math.PI);
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0): t_0 = (math.fabs(z1) * math.pi) * math.fabs(z0) t_1 = math.fabs(z0) * math.pi tmp = 0 if math.fabs(z0) <= 1.6e-53: tmp = 1.0 / t_1 elif math.fabs(z0) <= 3.5e+152: tmp = math.sin(t_0) / ((math.fabs(z0) * (math.pi * math.fabs(z1))) * t_1) else: tmp = math.sin(math.pi) / ((t_0 * math.fabs(z0)) * math.pi) return math.copysign(1.0, z0) * tmp
function code(z1, z0) t_0 = Float64(Float64(abs(z1) * pi) * abs(z0)) t_1 = Float64(abs(z0) * pi) tmp = 0.0 if (abs(z0) <= 1.6e-53) tmp = Float64(1.0 / t_1); elseif (abs(z0) <= 3.5e+152) tmp = Float64(sin(t_0) / Float64(Float64(abs(z0) * Float64(pi * abs(z1))) * t_1)); else tmp = Float64(sin(pi) / Float64(Float64(t_0 * abs(z0)) * pi)); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z1, z0) t_0 = (abs(z1) * pi) * abs(z0); t_1 = abs(z0) * pi; tmp = 0.0; if (abs(z0) <= 1.6e-53) tmp = 1.0 / t_1; elseif (abs(z0) <= 3.5e+152) tmp = sin(t_0) / ((abs(z0) * (pi * abs(z1))) * t_1); else tmp = sin(pi) / ((t_0 * abs(z0)) * pi); end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 1.6e-53], N[(1.0 / t$95$1), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[(N[Abs[z0], $MachinePrecision] * N[(Pi * N[Abs[z1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\
t_1 := \left|z0\right| \cdot \pi\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{t\_1}\\
\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{\left(\left|z0\right| \cdot \left(\pi \cdot \left|z1\right|\right)\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{\left(t\_0 \cdot \left|z0\right|\right) \cdot \pi}\\
\end{array}
\end{array}
if z0 < 1.6e-53Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
if 1.6e-53 < z0 < 3.4999999999999998e152Initial program 42.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6442.7%
Applied rewrites42.7%
if 3.4999999999999998e152 < z0 Initial program 42.7%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
cos-+PI/2-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
Applied rewrites18.5%
Taylor expanded in z1 around 0
lower-PI.f6429.5%
Applied rewrites29.5%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (* (* (fabs z0) (fabs z1)) PI)))
(*
(copysign 1.0 z0)
(if (<= (fabs z0) 1.6e-53)
(/ 1.0 (* (fabs z0) PI))
(if (<= (fabs z0) 3.5e+152)
(/ (sin t_0) (* (* t_0 (fabs z0)) PI))
(/
(sin PI)
(* (* (* (* (fabs z1) PI) (fabs z0)) (fabs z0)) PI)))))))double code(double z1, double z0) {
double t_0 = (fabs(z0) * fabs(z1)) * ((double) M_PI);
double tmp;
if (fabs(z0) <= 1.6e-53) {
tmp = 1.0 / (fabs(z0) * ((double) M_PI));
} else if (fabs(z0) <= 3.5e+152) {
tmp = sin(t_0) / ((t_0 * fabs(z0)) * ((double) M_PI));
} else {
tmp = sin(((double) M_PI)) / ((((fabs(z1) * ((double) M_PI)) * fabs(z0)) * fabs(z0)) * ((double) M_PI));
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
double t_0 = (Math.abs(z0) * Math.abs(z1)) * Math.PI;
double tmp;
if (Math.abs(z0) <= 1.6e-53) {
tmp = 1.0 / (Math.abs(z0) * Math.PI);
} else if (Math.abs(z0) <= 3.5e+152) {
tmp = Math.sin(t_0) / ((t_0 * Math.abs(z0)) * Math.PI);
} else {
tmp = Math.sin(Math.PI) / ((((Math.abs(z1) * Math.PI) * Math.abs(z0)) * Math.abs(z0)) * Math.PI);
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0): t_0 = (math.fabs(z0) * math.fabs(z1)) * math.pi tmp = 0 if math.fabs(z0) <= 1.6e-53: tmp = 1.0 / (math.fabs(z0) * math.pi) elif math.fabs(z0) <= 3.5e+152: tmp = math.sin(t_0) / ((t_0 * math.fabs(z0)) * math.pi) else: tmp = math.sin(math.pi) / ((((math.fabs(z1) * math.pi) * math.fabs(z0)) * math.fabs(z0)) * math.pi) return math.copysign(1.0, z0) * tmp
function code(z1, z0) t_0 = Float64(Float64(abs(z0) * abs(z1)) * pi) tmp = 0.0 if (abs(z0) <= 1.6e-53) tmp = Float64(1.0 / Float64(abs(z0) * pi)); elseif (abs(z0) <= 3.5e+152) tmp = Float64(sin(t_0) / Float64(Float64(t_0 * abs(z0)) * pi)); else tmp = Float64(sin(pi) / Float64(Float64(Float64(Float64(abs(z1) * pi) * abs(z0)) * abs(z0)) * pi)); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z1, z0) t_0 = (abs(z0) * abs(z1)) * pi; tmp = 0.0; if (abs(z0) <= 1.6e-53) tmp = 1.0 / (abs(z0) * pi); elseif (abs(z0) <= 3.5e+152) tmp = sin(t_0) / ((t_0 * abs(z0)) * pi); else tmp = sin(pi) / ((((abs(z1) * pi) * abs(z0)) * abs(z0)) * pi); end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[Abs[z0], $MachinePrecision] * N[Abs[z1], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 1.6e-53], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / N[(N[(N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(\left|z0\right| \cdot \left|z1\right|\right) \cdot \pi\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\
\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{\left(t\_0 \cdot \left|z0\right|\right) \cdot \pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{\left(\left(\left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\right) \cdot \left|z0\right|\right) \cdot \pi}\\
\end{array}
\end{array}
if z0 < 1.6e-53Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
if 1.6e-53 < z0 < 3.4999999999999998e152Initial program 42.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6442.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6442.7%
Applied rewrites42.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6442.6%
Applied rewrites42.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f6442.7%
Applied rewrites42.7%
if 3.4999999999999998e152 < z0 Initial program 42.7%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
cos-+PI/2-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
Applied rewrites18.5%
Taylor expanded in z1 around 0
lower-PI.f6429.5%
Applied rewrites29.5%
(FPCore (z1 z0) :precision binary64 (* (copysign 1.0 z0) (if (<= (fabs z0) 3e+63) (/ 1.0 (* (fabs z0) PI)) (/ (sin PI) (* (* (* (* (fabs z1) PI) (fabs z0)) (fabs z0)) PI)))))
double code(double z1, double z0) {
double tmp;
if (fabs(z0) <= 3e+63) {
tmp = 1.0 / (fabs(z0) * ((double) M_PI));
} else {
tmp = sin(((double) M_PI)) / ((((fabs(z1) * ((double) M_PI)) * fabs(z0)) * fabs(z0)) * ((double) M_PI));
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
double tmp;
if (Math.abs(z0) <= 3e+63) {
tmp = 1.0 / (Math.abs(z0) * Math.PI);
} else {
tmp = Math.sin(Math.PI) / ((((Math.abs(z1) * Math.PI) * Math.abs(z0)) * Math.abs(z0)) * Math.PI);
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0): tmp = 0 if math.fabs(z0) <= 3e+63: tmp = 1.0 / (math.fabs(z0) * math.pi) else: tmp = math.sin(math.pi) / ((((math.fabs(z1) * math.pi) * math.fabs(z0)) * math.fabs(z0)) * math.pi) return math.copysign(1.0, z0) * tmp
function code(z1, z0) tmp = 0.0 if (abs(z0) <= 3e+63) tmp = Float64(1.0 / Float64(abs(z0) * pi)); else tmp = Float64(sin(pi) / Float64(Float64(Float64(Float64(abs(z1) * pi) * abs(z0)) * abs(z0)) * pi)); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z1, z0) tmp = 0.0; if (abs(z0) <= 3e+63) tmp = 1.0 / (abs(z0) * pi); else tmp = sin(pi) / ((((abs(z1) * pi) * abs(z0)) * abs(z0)) * pi); end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z1_, z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 3e+63], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / N[(N[(N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 3 \cdot 10^{+63}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{\left(\left(\left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\right) \cdot \left|z0\right|\right) \cdot \pi}\\
\end{array}
if z0 < 3e63Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
if 3e63 < z0 Initial program 42.7%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
cos-+PI/2-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
Applied rewrites18.5%
Taylor expanded in z1 around 0
lower-PI.f6429.5%
Applied rewrites29.5%
(FPCore (z1 z0) :precision binary64 (/ 2.0 (* (* PI z0) 2.0)))
double code(double z1, double z0) {
return 2.0 / ((((double) M_PI) * z0) * 2.0);
}
public static double code(double z1, double z0) {
return 2.0 / ((Math.PI * z0) * 2.0);
}
def code(z1, z0): return 2.0 / ((math.pi * z0) * 2.0)
function code(z1, z0) return Float64(2.0 / Float64(Float64(pi * z0) * 2.0)) end
function tmp = code(z1, z0) tmp = 2.0 / ((pi * z0) * 2.0); end
code[z1_, z0_] := N[(2.0 / N[(N[(Pi * z0), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]
\frac{2}{\left(\pi \cdot z0\right) \cdot 2}
Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
*-lft-identityN/A
*-commutativeN/A
lift-/.f64N/A
cosh-0-revN/A
cosh-defN/A
metadata-evalN/A
cosh-0-revN/A
cosh-undef-revN/A
frac-timesN/A
cosh-undef-revN/A
cosh-0-revN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
cosh-0-revN/A
cosh-undef-revN/A
lower-/.f64N/A
cosh-undef-revN/A
cosh-0-revN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites51.8%
(FPCore (z1 z0) :precision binary64 (/ 1.0 (* z0 PI)))
double code(double z1, double z0) {
return 1.0 / (z0 * ((double) M_PI));
}
public static double code(double z1, double z0) {
return 1.0 / (z0 * Math.PI);
}
def code(z1, z0): return 1.0 / (z0 * math.pi)
function code(z1, z0) return Float64(1.0 / Float64(z0 * pi)) end
function tmp = code(z1, z0) tmp = 1.0 / (z0 * pi); end
code[z1_, z0_] := N[(1.0 / N[(z0 * Pi), $MachinePrecision]), $MachinePrecision]
\frac{1}{z0 \cdot \pi}
Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
(FPCore (z1 z0) :precision binary64 (/ 0.3183098861837907 z0))
double code(double z1, double z0) {
return 0.3183098861837907 / z0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = 0.3183098861837907d0 / z0
end function
public static double code(double z1, double z0) {
return 0.3183098861837907 / z0;
}
def code(z1, z0): return 0.3183098861837907 / z0
function code(z1, z0) return Float64(0.3183098861837907 / z0) end
function tmp = code(z1, z0) tmp = 0.3183098861837907 / z0; end
code[z1_, z0_] := N[(0.3183098861837907 / z0), $MachinePrecision]
\frac{0.3183098861837907}{z0}
Initial program 42.7%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.7%
Applied rewrites51.7%
*-lft-identityN/A
*-commutativeN/A
lift-/.f64N/A
cosh-0-revN/A
cosh-defN/A
metadata-evalN/A
cosh-0-revN/A
cosh-undef-revN/A
frac-timesN/A
cosh-undef-revN/A
cosh-0-revN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
cosh-0-revN/A
cosh-undef-revN/A
lower-/.f64N/A
cosh-undef-revN/A
cosh-0-revN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites51.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6451.6%
Applied rewrites51.6%
Evaluated real constant51.6%
herbie shell --seed 2025250
(FPCore (z1 z0)
:name "(/ (sin (* (* z1 PI) z0)) (* (* (* (* z1 PI) z0) z0) PI))"
:precision binary64
(/ (sin (* (* z1 PI) z0)) (* (* (* (* z1 PI) z0) z0) PI)))