
(FPCore (x.re x.im) :precision binary64 (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (((x_46re * x_46re) - (x_46im * x_46im)) * x_46re) - (((x_46re * x_46im) + (x_46im * x_46re)) * x_46im)
end function
public static double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im)
function code(x_46_re, x_46_im) return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_im)) end
function tmp = code(x_46_re, x_46_im) tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im); end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im) :precision binary64 (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (((x_46re * x_46re) - (x_46im * x_46im)) * x_46re) - (((x_46re * x_46im) + (x_46im * x_46re)) * x_46im)
end function
public static double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im)
function code(x_46_re, x_46_im) return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_im)) end
function tmp = code(x_46_re, x_46_im) tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im); end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\end{array}
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(*
x.re_s
(if (<= x.re_m 5e+95)
(fma (* x.re_m x.im) (* x.im -3.0) (pow x.re_m 3.0))
(if (<= x.re_m 1.35e+154)
(- (* x.re_m (- (* x.re_m x.re_m) (* x.im x.im))) 0.5)
(* x.re_m x.re_m)))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 5e+95) {
tmp = fma((x_46_re_m * x_46_im), (x_46_im * -3.0), pow(x_46_re_m, 3.0));
} else if (x_46_re_m <= 1.35e+154) {
tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 5e+95) tmp = fma(Float64(x_46_re_m * x_46_im), Float64(x_46_im * -3.0), (x_46_re_m ^ 3.0)); elseif (x_46_re_m <= 1.35e+154) tmp = Float64(Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) - 0.5); else tmp = Float64(x_46_re_m * x_46_re_m); end return Float64(x_46_re_s * tmp) end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 5e+95], N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision] + N[Power[x$46$re$95$m, 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re$95$m, 1.35e+154], N[(N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision], N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \leq 5 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(x.re\_m \cdot x.im, x.im \cdot -3, {x.re\_m}^{3}\right)\\
\mathbf{elif}\;x.re\_m \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) - 0.5\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot x.re\_m\\
\end{array}
\end{array}
if x.re < 5.00000000000000025e95Initial program 85.4%
Simplified82.7%
associate-*r*82.7%
associate-*l*83.2%
+-commutative83.2%
associate-*l*82.7%
associate-*r*82.7%
associate-*r*89.2%
fma-define92.0%
Applied egg-rr92.0%
if 5.00000000000000025e95 < x.re < 1.35000000000000003e154Initial program 88.2%
*-commutative88.2%
*-commutative88.2%
flip-+0.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
metadata-eval0.0%
associate-*r/0.0%
metadata-eval0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Applied egg-rr100.0%
if 1.35000000000000003e154 < x.re Initial program 54.5%
Simplified54.5%
associate-*r*54.5%
associate-*l*54.5%
+-commutative54.5%
associate-*l*54.5%
associate-*r*54.5%
associate-*r*54.5%
fma-define59.1%
Applied egg-rr59.1%
Applied egg-rr77.3%
Final simplification91.3%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(let* ((t_0 (* x.re_m (- (* x.re_m x.re_m) (* x.im x.im)))))
(*
x.re_s
(if (<= (- t_0 (* x.im (+ (* x.re_m x.im) (* x.re_m x.im)))) -5e-324)
(- t_0 (* x.im (* (* x.re_m x.im) 2.0)))
(pow x.re_m 3.0)))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im));
double tmp;
if ((t_0 - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= -5e-324) {
tmp = t_0 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
} else {
tmp = pow(x_46_re_m, 3.0);
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: t_0
real(8) :: tmp
t_0 = x_46re_m * ((x_46re_m * x_46re_m) - (x_46im * x_46im))
if ((t_0 - (x_46im * ((x_46re_m * x_46im) + (x_46re_m * x_46im)))) <= (-5d-324)) then
tmp = t_0 - (x_46im * ((x_46re_m * x_46im) * 2.0d0))
else
tmp = x_46re_m ** 3.0d0
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im));
double tmp;
if ((t_0 - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= -5e-324) {
tmp = t_0 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
} else {
tmp = Math.pow(x_46_re_m, 3.0);
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): t_0 = x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) tmp = 0 if (t_0 - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= -5e-324: tmp = t_0 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0)) else: tmp = math.pow(x_46_re_m, 3.0) return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) t_0 = Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) tmp = 0.0 if (Float64(t_0 - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_re_m * x_46_im)))) <= -5e-324) tmp = Float64(t_0 - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) * 2.0))); else tmp = x_46_re_m ^ 3.0; end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) t_0 = x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)); tmp = 0.0; if ((t_0 - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= -5e-324) tmp = t_0 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0)); else tmp = x_46_re_m ^ 3.0; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[N[(t$95$0 - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-324], N[(t$95$0 - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[x$46$re$95$m, 3.0], $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
\begin{array}{l}
t_0 := x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right)\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 - x.im \cdot \left(x.re\_m \cdot x.im + x.re\_m \cdot x.im\right) \leq -5 \cdot 10^{-324}:\\
\;\;\;\;t\_0 - x.im \cdot \left(\left(x.re\_m \cdot x.im\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;{x.re\_m}^{3}\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < -4.94066e-324Initial program 91.7%
*-un-lft-identity91.7%
*-commutative91.7%
*-un-lft-identity91.7%
distribute-rgt-out91.7%
metadata-eval91.7%
Applied egg-rr91.7%
if -4.94066e-324 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) Initial program 78.1%
Simplified75.1%
Taylor expanded in x.re around inf 64.8%
Final simplification74.4%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(*
x.re_s
(if (<= x.re_m 5e+99)
(+ (pow x.re_m 3.0) (* -3.0 (* x.im (* x.re_m x.im))))
(if (<= x.re_m 1.35e+154)
(- (* x.re_m (- (* x.re_m x.re_m) (* x.im x.im))) 0.5)
(* x.re_m x.re_m)))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 5e+99) {
tmp = pow(x_46_re_m, 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
} else if (x_46_re_m <= 1.35e+154) {
tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re_m <= 5d+99) then
tmp = (x_46re_m ** 3.0d0) + ((-3.0d0) * (x_46im * (x_46re_m * x_46im)))
else if (x_46re_m <= 1.35d+154) then
tmp = (x_46re_m * ((x_46re_m * x_46re_m) - (x_46im * x_46im))) - 0.5d0
else
tmp = x_46re_m * x_46re_m
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 5e+99) {
tmp = Math.pow(x_46_re_m, 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
} else if (x_46_re_m <= 1.35e+154) {
tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): tmp = 0 if x_46_re_m <= 5e+99: tmp = math.pow(x_46_re_m, 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im))) elif x_46_re_m <= 1.35e+154: tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5 else: tmp = x_46_re_m * x_46_re_m return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 5e+99) tmp = Float64((x_46_re_m ^ 3.0) + Float64(-3.0 * Float64(x_46_im * Float64(x_46_re_m * x_46_im)))); elseif (x_46_re_m <= 1.35e+154) tmp = Float64(Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) - 0.5); else tmp = Float64(x_46_re_m * x_46_re_m); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0; if (x_46_re_m <= 5e+99) tmp = (x_46_re_m ^ 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im))); elseif (x_46_re_m <= 1.35e+154) tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5; else tmp = x_46_re_m * x_46_re_m; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 5e+99], N[(N[Power[x$46$re$95$m, 3.0], $MachinePrecision] + N[(-3.0 * N[(x$46$im * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re$95$m, 1.35e+154], N[(N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision], N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \leq 5 \cdot 10^{+99}:\\
\;\;\;\;{x.re\_m}^{3} + -3 \cdot \left(x.im \cdot \left(x.re\_m \cdot x.im\right)\right)\\
\mathbf{elif}\;x.re\_m \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) - 0.5\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot x.re\_m\\
\end{array}
\end{array}
if x.re < 5.00000000000000008e99Initial program 85.4%
Simplified83.2%
add-sqr-sqrt54.0%
pow254.0%
*-commutative54.0%
sqrt-prod35.1%
sqrt-prod21.1%
add-sqr-sqrt38.5%
Applied egg-rr38.5%
unpow238.5%
*-commutative38.5%
associate-*r*38.6%
associate-*r*38.6%
add-sqr-sqrt89.2%
Applied egg-rr89.2%
if 5.00000000000000008e99 < x.re < 1.35000000000000003e154Initial program 88.2%
*-commutative88.2%
*-commutative88.2%
flip-+0.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
metadata-eval0.0%
associate-*r/0.0%
metadata-eval0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Applied egg-rr100.0%
if 1.35000000000000003e154 < x.re Initial program 54.5%
Simplified54.5%
associate-*r*54.5%
associate-*l*54.5%
+-commutative54.5%
associate-*l*54.5%
associate-*r*54.5%
associate-*r*54.5%
fma-define59.1%
Applied egg-rr59.1%
Applied egg-rr77.3%
Final simplification88.9%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(let* ((t_0 (* x.re_m (- (* x.re_m x.re_m) (* x.im x.im)))))
(*
x.re_s
(if (<= (- t_0 (* x.im (+ (* x.re_m x.im) (* x.re_m x.im)))) INFINITY)
(- t_0 (* x.im (* (* x.re_m x.im) 2.0)))
(* x.re_m x.re_m)))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im));
double tmp;
if ((t_0 - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= ((double) INFINITY)) {
tmp = t_0 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im));
double tmp;
if ((t_0 - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): t_0 = x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) tmp = 0 if (t_0 - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= math.inf: tmp = t_0 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0)) else: tmp = x_46_re_m * x_46_re_m return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) t_0 = Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) tmp = 0.0 if (Float64(t_0 - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_re_m * x_46_im)))) <= Inf) tmp = Float64(t_0 - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) * 2.0))); else tmp = Float64(x_46_re_m * x_46_re_m); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) t_0 = x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)); tmp = 0.0; if ((t_0 - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= Inf) tmp = t_0 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0)); else tmp = x_46_re_m * x_46_re_m; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[N[(t$95$0 - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
\begin{array}{l}
t_0 := x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right)\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 - x.im \cdot \left(x.re\_m \cdot x.im + x.re\_m \cdot x.im\right) \leq \infty:\\
\;\;\;\;t\_0 - x.im \cdot \left(\left(x.re\_m \cdot x.im\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot x.re\_m\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < +inf.0Initial program 94.0%
*-un-lft-identity94.0%
*-commutative94.0%
*-un-lft-identity94.0%
distribute-rgt-out94.0%
metadata-eval94.0%
Applied egg-rr94.0%
if +inf.0 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) Initial program 0.0%
Simplified0.0%
associate-*r*0.0%
associate-*l*0.0%
+-commutative0.0%
associate-*l*0.0%
associate-*r*0.0%
associate-*r*0.0%
fma-define30.0%
Applied egg-rr30.0%
Applied egg-rr23.9%
Final simplification85.8%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(*
x.re_s
(if (<= x.re_m 0.00036)
(- (* (* x.re_m x.im) -27.0) (* x.im (* (* x.re_m x.im) 2.0)))
(if (<= x.re_m 1.35e+154)
(- (* x.re_m (- (* x.re_m x.re_m) (* x.im x.im))) 0.5)
(* x.re_m x.re_m)))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 0.00036) {
tmp = ((x_46_re_m * x_46_im) * -27.0) - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
} else if (x_46_re_m <= 1.35e+154) {
tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re_m <= 0.00036d0) then
tmp = ((x_46re_m * x_46im) * (-27.0d0)) - (x_46im * ((x_46re_m * x_46im) * 2.0d0))
else if (x_46re_m <= 1.35d+154) then
tmp = (x_46re_m * ((x_46re_m * x_46re_m) - (x_46im * x_46im))) - 0.5d0
else
tmp = x_46re_m * x_46re_m
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 0.00036) {
tmp = ((x_46_re_m * x_46_im) * -27.0) - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
} else if (x_46_re_m <= 1.35e+154) {
tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): tmp = 0 if x_46_re_m <= 0.00036: tmp = ((x_46_re_m * x_46_im) * -27.0) - (x_46_im * ((x_46_re_m * x_46_im) * 2.0)) elif x_46_re_m <= 1.35e+154: tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5 else: tmp = x_46_re_m * x_46_re_m return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 0.00036) tmp = Float64(Float64(Float64(x_46_re_m * x_46_im) * -27.0) - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) * 2.0))); elseif (x_46_re_m <= 1.35e+154) tmp = Float64(Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) - 0.5); else tmp = Float64(x_46_re_m * x_46_re_m); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0; if (x_46_re_m <= 0.00036) tmp = ((x_46_re_m * x_46_im) * -27.0) - (x_46_im * ((x_46_re_m * x_46_im) * 2.0)); elseif (x_46_re_m <= 1.35e+154) tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5; else tmp = x_46_re_m * x_46_re_m; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 0.00036], N[(N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * -27.0), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re$95$m, 1.35e+154], N[(N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision], N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \leq 0.00036:\\
\;\;\;\;\left(x.re\_m \cdot x.im\right) \cdot -27 - x.im \cdot \left(\left(x.re\_m \cdot x.im\right) \cdot 2\right)\\
\mathbf{elif}\;x.re\_m \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) - 0.5\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot x.re\_m\\
\end{array}
\end{array}
if x.re < 3.60000000000000023e-4Initial program 83.9%
difference-of-squares84.9%
Applied egg-rr84.9%
Simplified44.0%
Taylor expanded in x.re around 0 31.9%
*-un-lft-identity83.9%
*-commutative83.9%
*-un-lft-identity83.9%
distribute-rgt-out83.9%
metadata-eval83.9%
Applied egg-rr31.9%
if 3.60000000000000023e-4 < x.re < 1.35000000000000003e154Initial program 94.6%
*-commutative94.6%
*-commutative94.6%
flip-+0.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
metadata-eval0.0%
associate-*r/0.0%
metadata-eval0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Applied egg-rr97.7%
if 1.35000000000000003e154 < x.re Initial program 54.5%
Simplified54.5%
associate-*r*54.5%
associate-*l*54.5%
+-commutative54.5%
associate-*l*54.5%
associate-*r*54.5%
associate-*r*54.5%
fma-define59.1%
Applied egg-rr59.1%
Applied egg-rr77.3%
Final simplification45.6%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(*
x.re_s
(if (<= x.re_m 0.00036)
(* x.im (* x.re_m (+ -27.0 (* x.im -2.0))))
(if (<= x.re_m 1.35e+154)
(- (* x.re_m (- (* x.re_m x.re_m) (* x.im x.im))) 0.5)
(* x.re_m x.re_m)))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 0.00036) {
tmp = x_46_im * (x_46_re_m * (-27.0 + (x_46_im * -2.0)));
} else if (x_46_re_m <= 1.35e+154) {
tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re_m <= 0.00036d0) then
tmp = x_46im * (x_46re_m * ((-27.0d0) + (x_46im * (-2.0d0))))
else if (x_46re_m <= 1.35d+154) then
tmp = (x_46re_m * ((x_46re_m * x_46re_m) - (x_46im * x_46im))) - 0.5d0
else
tmp = x_46re_m * x_46re_m
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 0.00036) {
tmp = x_46_im * (x_46_re_m * (-27.0 + (x_46_im * -2.0)));
} else if (x_46_re_m <= 1.35e+154) {
tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): tmp = 0 if x_46_re_m <= 0.00036: tmp = x_46_im * (x_46_re_m * (-27.0 + (x_46_im * -2.0))) elif x_46_re_m <= 1.35e+154: tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5 else: tmp = x_46_re_m * x_46_re_m return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 0.00036) tmp = Float64(x_46_im * Float64(x_46_re_m * Float64(-27.0 + Float64(x_46_im * -2.0)))); elseif (x_46_re_m <= 1.35e+154) tmp = Float64(Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) - 0.5); else tmp = Float64(x_46_re_m * x_46_re_m); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0; if (x_46_re_m <= 0.00036) tmp = x_46_im * (x_46_re_m * (-27.0 + (x_46_im * -2.0))); elseif (x_46_re_m <= 1.35e+154) tmp = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - 0.5; else tmp = x_46_re_m * x_46_re_m; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 0.00036], N[(x$46$im * N[(x$46$re$95$m * N[(-27.0 + N[(x$46$im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re$95$m, 1.35e+154], N[(N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision], N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \leq 0.00036:\\
\;\;\;\;x.im \cdot \left(x.re\_m \cdot \left(-27 + x.im \cdot -2\right)\right)\\
\mathbf{elif}\;x.re\_m \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) - 0.5\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot x.re\_m\\
\end{array}
\end{array}
if x.re < 3.60000000000000023e-4Initial program 83.9%
difference-of-squares84.9%
Applied egg-rr84.9%
Simplified44.0%
Taylor expanded in x.re around 0 31.9%
Taylor expanded in x.im around 0 34.0%
associate-*r*34.0%
distribute-rgt-out34.0%
*-commutative34.0%
Simplified34.0%
if 3.60000000000000023e-4 < x.re < 1.35000000000000003e154Initial program 94.6%
*-commutative94.6%
*-commutative94.6%
flip-+0.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
metadata-eval0.0%
associate-*r/0.0%
metadata-eval0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Applied egg-rr97.7%
if 1.35000000000000003e154 < x.re Initial program 54.5%
Simplified54.5%
associate-*r*54.5%
associate-*l*54.5%
+-commutative54.5%
associate-*l*54.5%
associate-*r*54.5%
associate-*r*54.5%
fma-define59.1%
Applied egg-rr59.1%
Applied egg-rr77.3%
Final simplification47.2%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(*
x.re_s
(if (<= x.re_m 7.5e-114)
(- x.re_m x.re_m)
(if (<= x.re_m 2.3e+147) (* (* x.re_m x.im) -27.0) (* x.re_m x.re_m)))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 7.5e-114) {
tmp = x_46_re_m - x_46_re_m;
} else if (x_46_re_m <= 2.3e+147) {
tmp = (x_46_re_m * x_46_im) * -27.0;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re_m <= 7.5d-114) then
tmp = x_46re_m - x_46re_m
else if (x_46re_m <= 2.3d+147) then
tmp = (x_46re_m * x_46im) * (-27.0d0)
else
tmp = x_46re_m * x_46re_m
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 7.5e-114) {
tmp = x_46_re_m - x_46_re_m;
} else if (x_46_re_m <= 2.3e+147) {
tmp = (x_46_re_m * x_46_im) * -27.0;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): tmp = 0 if x_46_re_m <= 7.5e-114: tmp = x_46_re_m - x_46_re_m elif x_46_re_m <= 2.3e+147: tmp = (x_46_re_m * x_46_im) * -27.0 else: tmp = x_46_re_m * x_46_re_m return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 7.5e-114) tmp = Float64(x_46_re_m - x_46_re_m); elseif (x_46_re_m <= 2.3e+147) tmp = Float64(Float64(x_46_re_m * x_46_im) * -27.0); else tmp = Float64(x_46_re_m * x_46_re_m); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0; if (x_46_re_m <= 7.5e-114) tmp = x_46_re_m - x_46_re_m; elseif (x_46_re_m <= 2.3e+147) tmp = (x_46_re_m * x_46_im) * -27.0; else tmp = x_46_re_m * x_46_re_m; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 7.5e-114], N[(x$46$re$95$m - x$46$re$95$m), $MachinePrecision], If[LessEqual[x$46$re$95$m, 2.3e+147], N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * -27.0), $MachinePrecision], N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \leq 7.5 \cdot 10^{-114}:\\
\;\;\;\;x.re\_m - x.re\_m\\
\mathbf{elif}\;x.re\_m \leq 2.3 \cdot 10^{+147}:\\
\;\;\;\;\left(x.re\_m \cdot x.im\right) \cdot -27\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot x.re\_m\\
\end{array}
\end{array}
if x.re < 7.5000000000000002e-114Initial program 83.1%
Simplified80.3%
associate-*r*80.3%
associate-*l*80.3%
+-commutative80.3%
associate-*l*80.3%
associate-*r*80.3%
associate-*r*86.7%
fma-define90.2%
Applied egg-rr90.2%
Applied egg-rr25.4%
if 7.5000000000000002e-114 < x.re < 2.2999999999999999e147Initial program 92.9%
difference-of-squares92.9%
Applied egg-rr92.9%
Simplified59.1%
Taylor expanded in x.re around 0 24.9%
Taylor expanded in x.im around 0 10.1%
if 2.2999999999999999e147 < x.re Initial program 60.0%
Simplified60.0%
associate-*r*60.0%
associate-*l*60.0%
+-commutative60.0%
associate-*l*60.0%
associate-*r*60.0%
associate-*r*60.0%
fma-define64.0%
Applied egg-rr64.0%
Applied egg-rr69.7%
Final simplification26.4%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(*
x.re_s
(if (<= x.re_m 1.2e+147)
(* x.im (* x.re_m (+ -27.0 (* x.im -2.0))))
(* x.re_m x.re_m))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 1.2e+147) {
tmp = x_46_im * (x_46_re_m * (-27.0 + (x_46_im * -2.0)));
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re_m <= 1.2d+147) then
tmp = x_46im * (x_46re_m * ((-27.0d0) + (x_46im * (-2.0d0))))
else
tmp = x_46re_m * x_46re_m
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 1.2e+147) {
tmp = x_46_im * (x_46_re_m * (-27.0 + (x_46_im * -2.0)));
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): tmp = 0 if x_46_re_m <= 1.2e+147: tmp = x_46_im * (x_46_re_m * (-27.0 + (x_46_im * -2.0))) else: tmp = x_46_re_m * x_46_re_m return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 1.2e+147) tmp = Float64(x_46_im * Float64(x_46_re_m * Float64(-27.0 + Float64(x_46_im * -2.0)))); else tmp = Float64(x_46_re_m * x_46_re_m); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0; if (x_46_re_m <= 1.2e+147) tmp = x_46_im * (x_46_re_m * (-27.0 + (x_46_im * -2.0))); else tmp = x_46_re_m * x_46_re_m; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 1.2e+147], N[(x$46$im * N[(x$46$re$95$m * N[(-27.0 + N[(x$46$im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \leq 1.2 \cdot 10^{+147}:\\
\;\;\;\;x.im \cdot \left(x.re\_m \cdot \left(-27 + x.im \cdot -2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot x.re\_m\\
\end{array}
\end{array}
if x.re < 1.20000000000000001e147Initial program 85.5%
difference-of-squares86.3%
Applied egg-rr86.3%
Simplified49.3%
Taylor expanded in x.re around 0 30.8%
Taylor expanded in x.im around 0 33.8%
associate-*r*33.8%
distribute-rgt-out33.8%
*-commutative33.8%
Simplified33.8%
if 1.20000000000000001e147 < x.re Initial program 60.0%
Simplified60.0%
associate-*r*60.0%
associate-*l*60.0%
+-commutative60.0%
associate-*l*60.0%
associate-*r*60.0%
associate-*r*60.0%
fma-define64.0%
Applied egg-rr64.0%
Applied egg-rr69.7%
x.re\_m = (fabs.f64 x.re) x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re) (FPCore (x.re_s x.re_m x.im) :precision binary64 (* x.re_s (if (<= x.re_m 5.8e-45) (- x.re_m x.re_m) (* x.re_m x.re_m))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 5.8e-45) {
tmp = x_46_re_m - x_46_re_m;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re_m <= 5.8d-45) then
tmp = x_46re_m - x_46re_m
else
tmp = x_46re_m * x_46re_m
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 5.8e-45) {
tmp = x_46_re_m - x_46_re_m;
} else {
tmp = x_46_re_m * x_46_re_m;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): tmp = 0 if x_46_re_m <= 5.8e-45: tmp = x_46_re_m - x_46_re_m else: tmp = x_46_re_m * x_46_re_m return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 5.8e-45) tmp = Float64(x_46_re_m - x_46_re_m); else tmp = Float64(x_46_re_m * x_46_re_m); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0; if (x_46_re_m <= 5.8e-45) tmp = x_46_re_m - x_46_re_m; else tmp = x_46_re_m * x_46_re_m; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 5.8e-45], N[(x$46$re$95$m - x$46$re$95$m), $MachinePrecision], N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \leq 5.8 \cdot 10^{-45}:\\
\;\;\;\;x.re\_m - x.re\_m\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot x.re\_m\\
\end{array}
\end{array}
if x.re < 5.8e-45Initial program 83.4%
Simplified80.3%
associate-*r*80.3%
associate-*l*80.8%
+-commutative80.8%
associate-*l*80.3%
associate-*r*80.3%
associate-*r*87.7%
fma-define90.9%
Applied egg-rr90.9%
Applied egg-rr23.8%
if 5.8e-45 < x.re Initial program 81.7%
Simplified77.2%
associate-*r*77.2%
associate-*l*77.2%
+-commutative77.2%
associate-*l*77.2%
associate-*r*77.2%
associate-*r*77.2%
fma-define81.8%
Applied egg-rr81.8%
Applied egg-rr29.2%
x.re\_m = (fabs.f64 x.re) x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re) (FPCore (x.re_s x.re_m x.im) :precision binary64 (* x.re_s (* x.re_m x.re_m)))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * (x_46_re_m * x_46_re_m);
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
code = x_46re_s * (x_46re_m * x_46re_m)
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * (x_46_re_m * x_46_re_m);
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): return x_46_re_s * (x_46_re_m * x_46_re_m)
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) return Float64(x_46_re_s * Float64(x_46_re_m * x_46_re_m)) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp = code(x_46_re_s, x_46_re_m, x_46_im) tmp = x_46_re_s * (x_46_re_m * x_46_re_m); end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \left(x.re\_m \cdot x.re\_m\right)
\end{array}
Initial program 83.0%
Simplified79.5%
associate-*r*79.5%
associate-*l*79.9%
+-commutative79.9%
associate-*l*79.5%
associate-*r*79.5%
associate-*r*85.0%
fma-define88.5%
Applied egg-rr88.5%
Applied egg-rr22.1%
x.re\_m = (fabs.f64 x.re) x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re) (FPCore (x.re_s x.re_m x.im) :precision binary64 (* x.re_s x.re_m))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * x_46_re_m;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
code = x_46re_s * x_46re_m
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * x_46_re_m;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): return x_46_re_s * x_46_re_m
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) return Float64(x_46_re_s * x_46_re_m) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp = code(x_46_re_s, x_46_re_m, x_46_im) tmp = x_46_re_s * x_46_re_m; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * x$46$re$95$m), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot x.re\_m
\end{array}
Initial program 83.0%
Simplified79.5%
associate-*r*79.5%
associate-*l*79.9%
+-commutative79.9%
associate-*l*79.5%
associate-*r*79.5%
associate-*r*85.0%
fma-define88.5%
Applied egg-rr88.5%
Applied egg-rr2.0%
expm1-undefine2.0%
rem-exp-log4.1%
Simplified4.1%
Taylor expanded in x.re around inf 4.5%
x.re\_m = (fabs.f64 x.re) x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re) (FPCore (x.re_s x.re_m x.im) :precision binary64 (* x.re_s -1.0))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * -1.0;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
code = x_46re_s * (-1.0d0)
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * -1.0;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): return x_46_re_s * -1.0
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) return Float64(x_46_re_s * -1.0) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp = code(x_46_re_s, x_46_re_m, x_46_im) tmp = x_46_re_s * -1.0; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * -1.0), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot -1
\end{array}
Initial program 83.0%
Simplified79.5%
associate-*r*79.5%
associate-*l*79.9%
+-commutative79.9%
associate-*l*79.5%
associate-*r*79.5%
associate-*r*85.0%
fma-define88.5%
Applied egg-rr88.5%
Applied egg-rr2.0%
expm1-undefine2.0%
rem-exp-log4.1%
Simplified4.1%
Taylor expanded in x.re around 0 2.8%
(FPCore (x.re x.im) :precision binary64 (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im)))))
double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)));
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = ((x_46re * x_46re) * (x_46re - x_46im)) + ((x_46re * x_46im) * (x_46re - (3.0d0 * x_46im)))
end function
public static double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)));
}
def code(x_46_re, x_46_im): return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)))
function code(x_46_re, x_46_im) return Float64(Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re - x_46_im)) + Float64(Float64(x_46_re * x_46_im) * Float64(x_46_re - Float64(3.0 * x_46_im)))) end
function tmp = code(x_46_re, x_46_im) tmp = ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im))); end
code[x$46$re_, x$46$im_] := N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(x$46$re - N[(3.0 * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right)
\end{array}
herbie shell --seed 2024181
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
:alt
(! :herbie-platform default (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3 x.im)))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))