
(FPCore (z0) :precision binary64 (sin (* PI (+ z0 z0))))
double code(double z0) {
return sin((((double) M_PI) * (z0 + z0)));
}
public static double code(double z0) {
return Math.sin((Math.PI * (z0 + z0)));
}
def code(z0): return math.sin((math.pi * (z0 + z0)))
function code(z0) return sin(Float64(pi * Float64(z0 + z0))) end
function tmp = code(z0) tmp = sin((pi * (z0 + z0))); end
code[z0_] := N[Sin[N[(Pi * N[(z0 + z0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin \left(\pi \cdot \left(z0 + z0\right)\right)
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0) :precision binary64 (sin (* PI (+ z0 z0))))
double code(double z0) {
return sin((((double) M_PI) * (z0 + z0)));
}
public static double code(double z0) {
return Math.sin((Math.PI * (z0 + z0)));
}
def code(z0): return math.sin((math.pi * (z0 + z0)))
function code(z0) return sin(Float64(pi * Float64(z0 + z0))) end
function tmp = code(z0) tmp = sin((pi * (z0 + z0))); end
code[z0_] := N[Sin[N[(Pi * N[(z0 + z0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin \left(\pi \cdot \left(z0 + z0\right)\right)
(FPCore (z0)
:precision binary64
(let* ((t_0 (* PI (fabs z0))))
(*
(copysign 1.0 z0)
(if (<= (fabs z0) 28000000000000.0)
(sin (* (* 2.9291837751230467 (fabs z0)) 2.1450293971110255))
(*
2.0
(/
(- (cos (- (* 0.5 PI) t_0)) (cos (+ (* 0.5 PI) t_0)))
2.0))))))double code(double z0) {
double t_0 = ((double) M_PI) * fabs(z0);
double tmp;
if (fabs(z0) <= 28000000000000.0) {
tmp = sin(((2.9291837751230467 * fabs(z0)) * 2.1450293971110255));
} else {
tmp = 2.0 * ((cos(((0.5 * ((double) M_PI)) - t_0)) - cos(((0.5 * ((double) M_PI)) + t_0))) / 2.0);
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z0) {
double t_0 = Math.PI * Math.abs(z0);
double tmp;
if (Math.abs(z0) <= 28000000000000.0) {
tmp = Math.sin(((2.9291837751230467 * Math.abs(z0)) * 2.1450293971110255));
} else {
tmp = 2.0 * ((Math.cos(((0.5 * Math.PI) - t_0)) - Math.cos(((0.5 * Math.PI) + t_0))) / 2.0);
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z0): t_0 = math.pi * math.fabs(z0) tmp = 0 if math.fabs(z0) <= 28000000000000.0: tmp = math.sin(((2.9291837751230467 * math.fabs(z0)) * 2.1450293971110255)) else: tmp = 2.0 * ((math.cos(((0.5 * math.pi) - t_0)) - math.cos(((0.5 * math.pi) + t_0))) / 2.0) return math.copysign(1.0, z0) * tmp
function code(z0) t_0 = Float64(pi * abs(z0)) tmp = 0.0 if (abs(z0) <= 28000000000000.0) tmp = sin(Float64(Float64(2.9291837751230467 * abs(z0)) * 2.1450293971110255)); else tmp = Float64(2.0 * Float64(Float64(cos(Float64(Float64(0.5 * pi) - t_0)) - cos(Float64(Float64(0.5 * pi) + t_0))) / 2.0)); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z0) t_0 = pi * abs(z0); tmp = 0.0; if (abs(z0) <= 28000000000000.0) tmp = sin(((2.9291837751230467 * abs(z0)) * 2.1450293971110255)); else tmp = 2.0 * ((cos(((0.5 * pi) - t_0)) - cos(((0.5 * pi) + t_0))) / 2.0); end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z0_] := Block[{t$95$0 = N[(Pi * N[Abs[z0], $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], 28000000000000.0], N[Sin[N[(N[(2.9291837751230467 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * 2.1450293971110255), $MachinePrecision]], $MachinePrecision], N[(2.0 * N[(N[(N[Cos[N[(N[(0.5 * Pi), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] - N[Cos[N[(N[(0.5 * Pi), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \pi \cdot \left|z0\right|\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 28000000000000:\\
\;\;\;\;\sin \left(\left(2.9291837751230467 \cdot \left|z0\right|\right) \cdot 2.1450293971110255\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\cos \left(0.5 \cdot \pi - t\_0\right) - \cos \left(0.5 \cdot \pi + t\_0\right)}{2}\\
\end{array}
\end{array}
if z0 < 2.8e13Initial program 53.4%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Evaluated real constant53.4%
Evaluated real constant53.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.4%
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval53.4%
Applied rewrites53.4%
if 2.8e13 < z0 Initial program 53.4%
lift-sin.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
count-2N/A
sin-2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
rem-log-expN/A
pow-expN/A
lift-PI.f64N/A
remove-double-negN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
lower-unsound-/.f32N/A
lower-/.f32N/A
neg-logN/A
Applied rewrites53.4%
lift-*.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lift-sin.f64N/A
sin-multN/A
lower-/.f64N/A
Applied rewrites7.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-PI.f644.8%
Applied rewrites4.8%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-PI.f6450.7%
Applied rewrites50.7%
(FPCore (z0)
:precision binary64
(let* ((t_0 (* PI (fabs z0)))
(t_1 (* (* (* (fabs z0) (fabs z0)) PI) PI)))
(*
(copysign 1.0 z0)
(if (<= (fabs z0) 6e+16)
(sin (* (* 2.9291837751230467 (fabs z0)) 2.1450293971110255))
(if (<= (fabs z0) 4.3e+153)
(sin
(/ 0.0 (+ (* t_0 1.0) (/ (* (* (- PI) (fabs z0)) t_1) t_1))))
(sin
(*
(* (fabs z0) (* t_0 (/ 1.0 t_1)))
(* PI (* (+ (fabs z0) (fabs z0)) PI)))))))))double code(double z0) {
double t_0 = ((double) M_PI) * fabs(z0);
double t_1 = ((fabs(z0) * fabs(z0)) * ((double) M_PI)) * ((double) M_PI);
double tmp;
if (fabs(z0) <= 6e+16) {
tmp = sin(((2.9291837751230467 * fabs(z0)) * 2.1450293971110255));
} else if (fabs(z0) <= 4.3e+153) {
tmp = sin((0.0 / ((t_0 * 1.0) + (((-((double) M_PI) * fabs(z0)) * t_1) / t_1))));
} else {
tmp = sin(((fabs(z0) * (t_0 * (1.0 / t_1))) * (((double) M_PI) * ((fabs(z0) + fabs(z0)) * ((double) M_PI)))));
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z0) {
double t_0 = Math.PI * Math.abs(z0);
double t_1 = ((Math.abs(z0) * Math.abs(z0)) * Math.PI) * Math.PI;
double tmp;
if (Math.abs(z0) <= 6e+16) {
tmp = Math.sin(((2.9291837751230467 * Math.abs(z0)) * 2.1450293971110255));
} else if (Math.abs(z0) <= 4.3e+153) {
tmp = Math.sin((0.0 / ((t_0 * 1.0) + (((-Math.PI * Math.abs(z0)) * t_1) / t_1))));
} else {
tmp = Math.sin(((Math.abs(z0) * (t_0 * (1.0 / t_1))) * (Math.PI * ((Math.abs(z0) + Math.abs(z0)) * Math.PI))));
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z0): t_0 = math.pi * math.fabs(z0) t_1 = ((math.fabs(z0) * math.fabs(z0)) * math.pi) * math.pi tmp = 0 if math.fabs(z0) <= 6e+16: tmp = math.sin(((2.9291837751230467 * math.fabs(z0)) * 2.1450293971110255)) elif math.fabs(z0) <= 4.3e+153: tmp = math.sin((0.0 / ((t_0 * 1.0) + (((-math.pi * math.fabs(z0)) * t_1) / t_1)))) else: tmp = math.sin(((math.fabs(z0) * (t_0 * (1.0 / t_1))) * (math.pi * ((math.fabs(z0) + math.fabs(z0)) * math.pi)))) return math.copysign(1.0, z0) * tmp
function code(z0) t_0 = Float64(pi * abs(z0)) t_1 = Float64(Float64(Float64(abs(z0) * abs(z0)) * pi) * pi) tmp = 0.0 if (abs(z0) <= 6e+16) tmp = sin(Float64(Float64(2.9291837751230467 * abs(z0)) * 2.1450293971110255)); elseif (abs(z0) <= 4.3e+153) tmp = sin(Float64(0.0 / Float64(Float64(t_0 * 1.0) + Float64(Float64(Float64(Float64(-pi) * abs(z0)) * t_1) / t_1)))); else tmp = sin(Float64(Float64(abs(z0) * Float64(t_0 * Float64(1.0 / t_1))) * Float64(pi * Float64(Float64(abs(z0) + abs(z0)) * pi)))); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z0) t_0 = pi * abs(z0); t_1 = ((abs(z0) * abs(z0)) * pi) * pi; tmp = 0.0; if (abs(z0) <= 6e+16) tmp = sin(((2.9291837751230467 * abs(z0)) * 2.1450293971110255)); elseif (abs(z0) <= 4.3e+153) tmp = sin((0.0 / ((t_0 * 1.0) + (((-pi * abs(z0)) * t_1) / t_1)))); else tmp = sin(((abs(z0) * (t_0 * (1.0 / t_1))) * (pi * ((abs(z0) + abs(z0)) * pi)))); end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z0_] := Block[{t$95$0 = N[(Pi * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Abs[z0], $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $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], 6e+16], N[Sin[N[(N[(2.9291837751230467 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * 2.1450293971110255), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 4.3e+153], N[Sin[N[(0.0 / N[(N[(t$95$0 * 1.0), $MachinePrecision] + N[(N[(N[((-Pi) * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[N[(N[(N[Abs[z0], $MachinePrecision] * N[(t$95$0 * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(N[(N[Abs[z0], $MachinePrecision] + N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \pi \cdot \left|z0\right|\\
t_1 := \left(\left(\left|z0\right| \cdot \left|z0\right|\right) \cdot \pi\right) \cdot \pi\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 6 \cdot 10^{+16}:\\
\;\;\;\;\sin \left(\left(2.9291837751230467 \cdot \left|z0\right|\right) \cdot 2.1450293971110255\right)\\
\mathbf{elif}\;\left|z0\right| \leq 4.3 \cdot 10^{+153}:\\
\;\;\;\;\sin \left(\frac{0}{t\_0 \cdot 1 + \frac{\left(\left(-\pi\right) \cdot \left|z0\right|\right) \cdot t\_1}{t\_1}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left(\left|z0\right| \cdot \left(t\_0 \cdot \frac{1}{t\_1}\right)\right) \cdot \left(\pi \cdot \left(\left(\left|z0\right| + \left|z0\right|\right) \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
if z0 < 6e16Initial program 53.4%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Evaluated real constant53.4%
Evaluated real constant53.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.4%
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval53.4%
Applied rewrites53.4%
if 6e16 < z0 < 4.2999999999999998e153Initial program 53.4%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Applied rewrites9.5%
if 4.2999999999999998e153 < z0 Initial program 53.4%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Applied rewrites19.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites27.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6452.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6452.3%
Applied rewrites52.3%
(FPCore (z0)
:precision binary64
(*
(copysign 1.0 z0)
(if (<= (fabs z0) 1200.0)
(sin (* 6.283185307179586 (fabs z0)))
(sin
(*
(*
(fabs z0)
(*
(* PI (fabs z0))
(/ 1.0 (* (* (* (fabs z0) (fabs z0)) PI) PI))))
(* PI (* (+ (fabs z0) (fabs z0)) PI)))))))double code(double z0) {
double tmp;
if (fabs(z0) <= 1200.0) {
tmp = sin((6.283185307179586 * fabs(z0)));
} else {
tmp = sin(((fabs(z0) * ((((double) M_PI) * fabs(z0)) * (1.0 / (((fabs(z0) * fabs(z0)) * ((double) M_PI)) * ((double) M_PI))))) * (((double) M_PI) * ((fabs(z0) + fabs(z0)) * ((double) M_PI)))));
}
return copysign(1.0, z0) * tmp;
}
public static double code(double z0) {
double tmp;
if (Math.abs(z0) <= 1200.0) {
tmp = Math.sin((6.283185307179586 * Math.abs(z0)));
} else {
tmp = Math.sin(((Math.abs(z0) * ((Math.PI * Math.abs(z0)) * (1.0 / (((Math.abs(z0) * Math.abs(z0)) * Math.PI) * Math.PI)))) * (Math.PI * ((Math.abs(z0) + Math.abs(z0)) * Math.PI))));
}
return Math.copySign(1.0, z0) * tmp;
}
def code(z0): tmp = 0 if math.fabs(z0) <= 1200.0: tmp = math.sin((6.283185307179586 * math.fabs(z0))) else: tmp = math.sin(((math.fabs(z0) * ((math.pi * math.fabs(z0)) * (1.0 / (((math.fabs(z0) * math.fabs(z0)) * math.pi) * math.pi)))) * (math.pi * ((math.fabs(z0) + math.fabs(z0)) * math.pi)))) return math.copysign(1.0, z0) * tmp
function code(z0) tmp = 0.0 if (abs(z0) <= 1200.0) tmp = sin(Float64(6.283185307179586 * abs(z0))); else tmp = sin(Float64(Float64(abs(z0) * Float64(Float64(pi * abs(z0)) * Float64(1.0 / Float64(Float64(Float64(abs(z0) * abs(z0)) * pi) * pi)))) * Float64(pi * Float64(Float64(abs(z0) + abs(z0)) * pi)))); end return Float64(copysign(1.0, z0) * tmp) end
function tmp_2 = code(z0) tmp = 0.0; if (abs(z0) <= 1200.0) tmp = sin((6.283185307179586 * abs(z0))); else tmp = sin(((abs(z0) * ((pi * abs(z0)) * (1.0 / (((abs(z0) * abs(z0)) * pi) * pi)))) * (pi * ((abs(z0) + abs(z0)) * pi)))); end tmp_2 = (sign(z0) * abs(1.0)) * tmp; end
code[z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 1200.0], N[Sin[N[(6.283185307179586 * N[Abs[z0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[N[(N[(N[Abs[z0], $MachinePrecision] * N[(N[(Pi * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(N[(N[Abs[z0], $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(N[(N[Abs[z0], $MachinePrecision] + N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 1200:\\
\;\;\;\;\sin \left(6.283185307179586 \cdot \left|z0\right|\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left(\left|z0\right| \cdot \left(\left(\pi \cdot \left|z0\right|\right) \cdot \frac{1}{\left(\left(\left|z0\right| \cdot \left|z0\right|\right) \cdot \pi\right) \cdot \pi}\right)\right) \cdot \left(\pi \cdot \left(\left(\left|z0\right| + \left|z0\right|\right) \cdot \pi\right)\right)\right)\\
\end{array}
if z0 < 1200Initial program 53.4%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Evaluated real constant53.4%
Evaluated real constant53.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-+.f64N/A
count-2N/A
associate-*r*N/A
lower-*.f64N/A
metadata-evalN/A
metadata-eval53.4%
Applied rewrites53.4%
if 1200 < z0 Initial program 53.4%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Applied rewrites19.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites27.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6452.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6452.3%
Applied rewrites52.3%
(FPCore (z0) :precision binary64 (sin (* (* 2.9291837751230467 z0) 2.1450293971110255)))
double code(double z0) {
return sin(((2.9291837751230467 * z0) * 2.1450293971110255));
}
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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sin(((2.9291837751230467d0 * z0) * 2.1450293971110255d0))
end function
public static double code(double z0) {
return Math.sin(((2.9291837751230467 * z0) * 2.1450293971110255));
}
def code(z0): return math.sin(((2.9291837751230467 * z0) * 2.1450293971110255))
function code(z0) return sin(Float64(Float64(2.9291837751230467 * z0) * 2.1450293971110255)) end
function tmp = code(z0) tmp = sin(((2.9291837751230467 * z0) * 2.1450293971110255)); end
code[z0_] := N[Sin[N[(N[(2.9291837751230467 * z0), $MachinePrecision] * 2.1450293971110255), $MachinePrecision]], $MachinePrecision]
\sin \left(\left(2.9291837751230467 \cdot z0\right) \cdot 2.1450293971110255\right)
Initial program 53.4%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Evaluated real constant53.4%
Evaluated real constant53.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.4%
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval53.4%
Applied rewrites53.4%
(FPCore (z0) :precision binary64 (sin (* 6.283185307179586 z0)))
double code(double z0) {
return sin((6.283185307179586 * 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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sin((6.283185307179586d0 * z0))
end function
public static double code(double z0) {
return Math.sin((6.283185307179586 * z0));
}
def code(z0): return math.sin((6.283185307179586 * z0))
function code(z0) return sin(Float64(6.283185307179586 * z0)) end
function tmp = code(z0) tmp = sin((6.283185307179586 * z0)); end
code[z0_] := N[Sin[N[(6.283185307179586 * z0), $MachinePrecision]], $MachinePrecision]
\sin \left(6.283185307179586 \cdot z0\right)
Initial program 53.4%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Evaluated real constant53.4%
Evaluated real constant53.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-+.f64N/A
count-2N/A
associate-*r*N/A
lower-*.f64N/A
metadata-evalN/A
metadata-eval53.4%
Applied rewrites53.4%
(FPCore (z0) :precision binary64 (* z0 (- (+ PI PI) (* 1.3333333333333333 (* (* (* z0 z0) PI) (* PI PI))))))
double code(double z0) {
return z0 * ((((double) M_PI) + ((double) M_PI)) - (1.3333333333333333 * (((z0 * z0) * ((double) M_PI)) * (((double) M_PI) * ((double) M_PI)))));
}
public static double code(double z0) {
return z0 * ((Math.PI + Math.PI) - (1.3333333333333333 * (((z0 * z0) * Math.PI) * (Math.PI * Math.PI))));
}
def code(z0): return z0 * ((math.pi + math.pi) - (1.3333333333333333 * (((z0 * z0) * math.pi) * (math.pi * math.pi))))
function code(z0) return Float64(z0 * Float64(Float64(pi + pi) - Float64(1.3333333333333333 * Float64(Float64(Float64(z0 * z0) * pi) * Float64(pi * pi))))) end
function tmp = code(z0) tmp = z0 * ((pi + pi) - (1.3333333333333333 * (((z0 * z0) * pi) * (pi * pi)))); end
code[z0_] := N[(z0 * N[(N[(Pi + Pi), $MachinePrecision] - N[(1.3333333333333333 * N[(N[(N[(z0 * z0), $MachinePrecision] * Pi), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
z0 \cdot \left(\left(\pi + \pi\right) - 1.3333333333333333 \cdot \left(\left(\left(z0 \cdot z0\right) \cdot \pi\right) \cdot \left(\pi \cdot \pi\right)\right)\right)
Initial program 53.4%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-PI.f6451.1%
Applied rewrites51.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
metadata-eval51.1%
lift-*.f64N/A
lift-pow.f64N/A
cube-multN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
(FPCore (z0) :precision binary64 (* (+ z0 z0) PI))
double code(double z0) {
return (z0 + z0) * ((double) M_PI);
}
public static double code(double z0) {
return (z0 + z0) * Math.PI;
}
def code(z0): return (z0 + z0) * math.pi
function code(z0) return Float64(Float64(z0 + z0) * pi) end
function tmp = code(z0) tmp = (z0 + z0) * pi; end
code[z0_] := N[(N[(z0 + z0), $MachinePrecision] * Pi), $MachinePrecision]
\left(z0 + z0\right) \cdot \pi
Initial program 53.4%
lift-sin.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
count-2N/A
sin-2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
rem-log-expN/A
pow-expN/A
lift-PI.f64N/A
remove-double-negN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
lower-unsound-/.f32N/A
lower-/.f32N/A
neg-logN/A
Applied rewrites53.4%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6451.1%
Applied rewrites51.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
count-2N/A
lift-+.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
herbie shell --seed 2025250
(FPCore (z0)
:name "(sin (* PI (+ z0 z0)))"
:precision binary64
(sin (* PI (+ z0 z0))))