
(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 9 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}
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (/ x.re (- x.re))))
(if (<= x.re -5e+102)
(+ (* x.re (* (+ x.re -27.0) (+ x.re x.im))) t_0)
(if (<= x.re 6300.0)
(+ (* (* x.re x.im) (* x.im -3.0)) (pow x.re 3.0))
(+ (* x.re (* (- x.re x.im) (+ x.re x.im))) t_0)))))x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_re / -x_46_re;
double tmp;
if (x_46_re <= -5e+102) {
tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0;
} else if (x_46_re <= 6300.0) {
tmp = ((x_46_re * x_46_im) * (x_46_im * -3.0)) + pow(x_46_re, 3.0);
} else {
tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + t_0;
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: t_0
real(8) :: tmp
t_0 = x_46re / -x_46re
if (x_46re <= (-5d+102)) then
tmp = (x_46re * ((x_46re + (-27.0d0)) * (x_46re + x_46im))) + t_0
else if (x_46re <= 6300.0d0) then
tmp = ((x_46re * x_46im) * (x_46im * (-3.0d0))) + (x_46re ** 3.0d0)
else
tmp = (x_46re * ((x_46re - x_46im) * (x_46re + x_46im))) + t_0
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double t_0 = x_46_re / -x_46_re;
double tmp;
if (x_46_re <= -5e+102) {
tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0;
} else if (x_46_re <= 6300.0) {
tmp = ((x_46_re * x_46_im) * (x_46_im * -3.0)) + Math.pow(x_46_re, 3.0);
} else {
tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + t_0;
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): t_0 = x_46_re / -x_46_re tmp = 0 if x_46_re <= -5e+102: tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0 elif x_46_re <= 6300.0: tmp = ((x_46_re * x_46_im) * (x_46_im * -3.0)) + math.pow(x_46_re, 3.0) else: tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + t_0 return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) t_0 = Float64(x_46_re / Float64(-x_46_re)) tmp = 0.0 if (x_46_re <= -5e+102) tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re + -27.0) * Float64(x_46_re + x_46_im))) + t_0); elseif (x_46_re <= 6300.0) tmp = Float64(Float64(Float64(x_46_re * x_46_im) * Float64(x_46_im * -3.0)) + (x_46_re ^ 3.0)); else tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))) + t_0); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) t_0 = x_46_re / -x_46_re; tmp = 0.0; if (x_46_re <= -5e+102) tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + t_0; elseif (x_46_re <= 6300.0) tmp = ((x_46_re * x_46_im) * (x_46_im * -3.0)) + (x_46_re ^ 3.0); else tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + t_0; end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re / (-x$46$re)), $MachinePrecision]}, If[LessEqual[x$46$re, -5e+102], N[(N[(x$46$re * N[(N[(x$46$re + -27.0), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[x$46$re, 6300.0], N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision] + N[Power[x$46$re, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := \frac{x.re}{-x.re}\\
\mathbf{if}\;x.re \leq -5 \cdot 10^{+102}:\\
\;\;\;\;x.re \cdot \left(\left(x.re + -27\right) \cdot \left(x.re + x.im\right)\right) + t_0\\
\mathbf{elif}\;x.re \leq 6300:\\
\;\;\;\;\left(x.re \cdot x.im\right) \cdot \left(x.im \cdot -3\right) + {x.re}^{3}\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) + t_0\\
\end{array}
\end{array}
if x.re < -5e102Initial program 75.0%
*-commutative75.0%
flip3-+40.9%
associate-*r/40.9%
*-commutative40.9%
count-240.9%
pow240.9%
*-commutative40.9%
*-commutative40.9%
*-commutative40.9%
+-inverses40.9%
Applied egg-rr40.9%
Simplified88.6%
difference-of-squares100.0%
Applied egg-rr100.0%
Simplified93.2%
if -5e102 < x.re < 6300Initial program 88.1%
Simplified88.2%
associate-*r*88.2%
associate-*l*88.1%
+-commutative88.1%
associate-*l*88.2%
associate-*r*88.2%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
fma-udef99.8%
Applied egg-rr99.8%
if 6300 < x.re Initial program 79.2%
*-commutative79.2%
flip3-+30.2%
associate-*r/30.2%
*-commutative30.2%
count-230.2%
pow230.2%
*-commutative30.2%
*-commutative30.2%
*-commutative30.2%
+-inverses30.2%
Applied egg-rr30.2%
Simplified92.5%
difference-of-squares100.0%
*-commutative100.0%
Applied egg-rr100.0%
Final simplification98.7%
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* x.re (* (- x.re x.im) (+ x.re x.im)))))
(if (<=
(-
(* x.re (- (* x.re x.re) (* x.im x.im)))
(* x.im (+ (* x.re x.im) (* x.re x.im))))
2e+281)
(- t_0 (* x.im (* (* x.re x.im) 2.0)))
(+ t_0 (/ x.re (- x.re))))))x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
double tmp;
if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= 2e+281) {
tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) * 2.0));
} else {
tmp = t_0 + (x_46_re / -x_46_re);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: t_0
real(8) :: tmp
t_0 = x_46re * ((x_46re - x_46im) * (x_46re + x_46im))
if (((x_46re * ((x_46re * x_46re) - (x_46im * x_46im))) - (x_46im * ((x_46re * x_46im) + (x_46re * x_46im)))) <= 2d+281) then
tmp = t_0 - (x_46im * ((x_46re * x_46im) * 2.0d0))
else
tmp = t_0 + (x_46re / -x_46re)
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double t_0 = x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im));
double tmp;
if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= 2e+281) {
tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) * 2.0));
} else {
tmp = t_0 + (x_46_re / -x_46_re);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): t_0 = x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im)) tmp = 0 if ((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= 2e+281: tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) * 2.0)) else: tmp = t_0 + (x_46_re / -x_46_re) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) t_0 = Float64(x_46_re * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))) tmp = 0.0 if (Float64(Float64(x_46_re * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) + Float64(x_46_re * x_46_im)))) <= 2e+281) tmp = Float64(t_0 - Float64(x_46_im * Float64(Float64(x_46_re * x_46_im) * 2.0))); else tmp = Float64(t_0 + Float64(x_46_re / Float64(-x_46_re))); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) t_0 = x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im)); tmp = 0.0; if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)))) <= 2e+281) tmp = t_0 - (x_46_im * ((x_46_re * x_46_im) * 2.0)); else tmp = t_0 + (x_46_re / -x_46_re); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x$46$re * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+281], N[(t$95$0 - N[(x$46$im * N[(N[(x$46$re * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(x$46$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)\\
\mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right) \leq 2 \cdot 10^{+281}:\\
\;\;\;\;t_0 - x.im \cdot \left(\left(x.re \cdot x.im\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \frac{x.re}{-x.re}\\
\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)) < 2.0000000000000001e281Initial program 92.7%
difference-of-squares33.1%
*-commutative33.1%
Applied egg-rr92.7%
Taylor expanded in x.re around 0 92.7%
if 2.0000000000000001e281 < (-.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 67.2%
*-commutative67.2%
flip3-+23.5%
associate-*r/23.5%
*-commutative23.5%
count-223.5%
pow223.5%
*-commutative23.5%
*-commutative23.5%
*-commutative23.5%
+-inverses23.5%
Applied egg-rr23.5%
Simplified82.2%
difference-of-squares92.5%
*-commutative92.5%
Applied egg-rr92.5%
Final simplification92.6%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.re -1.75e-41) (not (<= x.re 9e-59))) (+ (* x.re (* (+ x.re -27.0) (+ x.re x.im))) (/ x.re (- x.re))) (* x.im (* x.re -27.0))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -1.75e-41) || !(x_46_re <= 9e-59)) {
tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
} else {
tmp = x_46_im * (x_46_re * -27.0);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46re <= (-1.75d-41)) .or. (.not. (x_46re <= 9d-59))) then
tmp = (x_46re * ((x_46re + (-27.0d0)) * (x_46re + x_46im))) + (x_46re / -x_46re)
else
tmp = x_46im * (x_46re * (-27.0d0))
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -1.75e-41) || !(x_46_re <= 9e-59)) {
tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
} else {
tmp = x_46_im * (x_46_re * -27.0);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if (x_46_re <= -1.75e-41) or not (x_46_re <= 9e-59): tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re) else: tmp = x_46_im * (x_46_re * -27.0) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_re <= -1.75e-41) || !(x_46_re <= 9e-59)) tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re + -27.0) * Float64(x_46_re + x_46_im))) + Float64(x_46_re / Float64(-x_46_re))); else tmp = Float64(x_46_im * Float64(x_46_re * -27.0)); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_re <= -1.75e-41) || ~((x_46_re <= 9e-59))) tmp = (x_46_re * ((x_46_re + -27.0) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re); else tmp = x_46_im * (x_46_re * -27.0); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -1.75e-41], N[Not[LessEqual[x$46$re, 9e-59]], $MachinePrecision]], N[(N[(x$46$re * N[(N[(x$46$re + -27.0), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(x$46$re * -27.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -1.75 \cdot 10^{-41} \lor \neg \left(x.re \leq 9 \cdot 10^{-59}\right):\\
\;\;\;\;x.re \cdot \left(\left(x.re + -27\right) \cdot \left(x.re + x.im\right)\right) + \frac{x.re}{-x.re}\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.re \cdot -27\right)\\
\end{array}
\end{array}
if x.re < -1.75e-41 or 9.00000000000000023e-59 < x.re Initial program 83.4%
*-commutative83.4%
flip3-+35.6%
associate-*r/33.6%
*-commutative33.6%
count-233.6%
pow233.6%
*-commutative33.6%
*-commutative33.6%
*-commutative33.6%
+-inverses33.6%
Applied egg-rr33.6%
Simplified79.8%
difference-of-squares86.4%
Applied egg-rr86.4%
Simplified71.1%
if -1.75e-41 < x.re < 9.00000000000000023e-59Initial program 84.8%
*-commutative84.8%
flip3-+19.1%
associate-*r/18.3%
*-commutative18.3%
count-218.3%
pow218.3%
*-commutative18.3%
*-commutative18.3%
*-commutative18.3%
+-inverses18.3%
Applied egg-rr18.3%
Simplified14.7%
difference-of-squares14.7%
Applied egg-rr14.7%
Simplified3.2%
Taylor expanded in x.re around 0 3.2%
Taylor expanded in x.im around inf 33.1%
*-commutative33.1%
associate-*l*33.1%
Simplified33.1%
Final simplification53.6%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.re -2.1e-114) (not (<= x.re 2.45e-107))) (+ (* x.re (* (- x.re x.im) (+ x.re x.im))) (/ x.re (- x.re))) (* x.im (* x.re -27.0))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -2.1e-114) || !(x_46_re <= 2.45e-107)) {
tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
} else {
tmp = x_46_im * (x_46_re * -27.0);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46re <= (-2.1d-114)) .or. (.not. (x_46re <= 2.45d-107))) then
tmp = (x_46re * ((x_46re - x_46im) * (x_46re + x_46im))) + (x_46re / -x_46re)
else
tmp = x_46im * (x_46re * (-27.0d0))
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -2.1e-114) || !(x_46_re <= 2.45e-107)) {
tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re);
} else {
tmp = x_46_im * (x_46_re * -27.0);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if (x_46_re <= -2.1e-114) or not (x_46_re <= 2.45e-107): tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re) else: tmp = x_46_im * (x_46_re * -27.0) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_re <= -2.1e-114) || !(x_46_re <= 2.45e-107)) tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_re + x_46_im))) + Float64(x_46_re / Float64(-x_46_re))); else tmp = Float64(x_46_im * Float64(x_46_re * -27.0)); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_re <= -2.1e-114) || ~((x_46_re <= 2.45e-107))) tmp = (x_46_re * ((x_46_re - x_46_im) * (x_46_re + x_46_im))) + (x_46_re / -x_46_re); else tmp = x_46_im * (x_46_re * -27.0); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -2.1e-114], N[Not[LessEqual[x$46$re, 2.45e-107]], $MachinePrecision]], N[(N[(x$46$re * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(x$46$re * -27.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -2.1 \cdot 10^{-114} \lor \neg \left(x.re \leq 2.45 \cdot 10^{-107}\right):\\
\;\;\;\;x.re \cdot \left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right) + \frac{x.re}{-x.re}\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.re \cdot -27\right)\\
\end{array}
\end{array}
if x.re < -2.09999999999999993e-114 or 2.4499999999999999e-107 < x.re Initial program 84.8%
*-commutative84.8%
flip3-+37.4%
associate-*r/35.1%
*-commutative35.1%
count-235.1%
pow235.1%
*-commutative35.1%
*-commutative35.1%
*-commutative35.1%
+-inverses35.1%
Applied egg-rr35.1%
Simplified73.5%
difference-of-squares79.0%
*-commutative79.0%
Applied egg-rr79.0%
if -2.09999999999999993e-114 < x.re < 2.4499999999999999e-107Initial program 82.6%
*-commutative82.6%
flip3-+11.3%
associate-*r/11.3%
*-commutative11.3%
count-211.3%
pow211.3%
*-commutative11.3%
*-commutative11.3%
*-commutative11.3%
+-inverses11.3%
Applied egg-rr11.3%
Simplified7.6%
difference-of-squares7.6%
Applied egg-rr7.6%
Simplified3.4%
Taylor expanded in x.re around 0 3.4%
Taylor expanded in x.im around inf 41.2%
*-commutative41.2%
associate-*l*41.2%
Simplified41.2%
Final simplification65.4%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.re -3.7e-16) (not (<= x.re 1.06e+69))) (+ (* x.re (* x.re (- x.re 27.0))) (/ x.re (- x.re))) (* x.im (* x.re -27.0))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -3.7e-16) || !(x_46_re <= 1.06e+69)) {
tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
} else {
tmp = x_46_im * (x_46_re * -27.0);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46re <= (-3.7d-16)) .or. (.not. (x_46re <= 1.06d+69))) then
tmp = (x_46re * (x_46re * (x_46re - 27.0d0))) + (x_46re / -x_46re)
else
tmp = x_46im * (x_46re * (-27.0d0))
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -3.7e-16) || !(x_46_re <= 1.06e+69)) {
tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
} else {
tmp = x_46_im * (x_46_re * -27.0);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if (x_46_re <= -3.7e-16) or not (x_46_re <= 1.06e+69): tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re) else: tmp = x_46_im * (x_46_re * -27.0) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_re <= -3.7e-16) || !(x_46_re <= 1.06e+69)) tmp = Float64(Float64(x_46_re * Float64(x_46_re * Float64(x_46_re - 27.0))) + Float64(x_46_re / Float64(-x_46_re))); else tmp = Float64(x_46_im * Float64(x_46_re * -27.0)); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_re <= -3.7e-16) || ~((x_46_re <= 1.06e+69))) tmp = (x_46_re * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re); else tmp = x_46_im * (x_46_re * -27.0); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -3.7e-16], N[Not[LessEqual[x$46$re, 1.06e+69]], $MachinePrecision]], N[(N[(x$46$re * N[(x$46$re * N[(x$46$re - 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(x$46$re * -27.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -3.7 \cdot 10^{-16} \lor \neg \left(x.re \leq 1.06 \cdot 10^{+69}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + \frac{x.re}{-x.re}\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.re \cdot -27\right)\\
\end{array}
\end{array}
if x.re < -3.7e-16 or 1.06000000000000004e69 < x.re Initial program 80.6%
*-commutative80.6%
flip3-+35.7%
associate-*r/35.7%
*-commutative35.7%
count-235.7%
pow235.7%
*-commutative35.7%
*-commutative35.7%
*-commutative35.7%
+-inverses35.7%
Applied egg-rr35.7%
Simplified87.2%
difference-of-squares94.8%
Applied egg-rr94.8%
Simplified81.9%
Taylor expanded in x.im around 0 71.6%
if -3.7e-16 < x.re < 1.06000000000000004e69Initial program 87.0%
*-commutative87.0%
flip3-+21.4%
associate-*r/18.7%
*-commutative18.7%
count-218.7%
pow218.7%
*-commutative18.7%
*-commutative18.7%
*-commutative18.7%
+-inverses18.7%
Applied egg-rr18.7%
Simplified17.8%
difference-of-squares17.8%
Applied egg-rr17.8%
Simplified3.9%
Taylor expanded in x.re around 0 3.3%
Taylor expanded in x.im around inf 28.9%
*-commutative28.9%
associate-*l*28.9%
Simplified28.9%
Final simplification48.6%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.re 7.2e+160) (* x.im (* x.re -27.0)) (+ (* x.im (* x.re (- x.re 27.0))) (/ x.re (- x.re)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_re <= 7.2e+160) {
tmp = x_46_im * (x_46_re * -27.0);
} else {
tmp = (x_46_im * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re <= 7.2d+160) then
tmp = x_46im * (x_46re * (-27.0d0))
else
tmp = (x_46im * (x_46re * (x_46re - 27.0d0))) + (x_46re / -x_46re)
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_re <= 7.2e+160) {
tmp = x_46_im * (x_46_re * -27.0);
} else {
tmp = (x_46_im * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_re <= 7.2e+160: tmp = x_46_im * (x_46_re * -27.0) else: tmp = (x_46_im * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_re <= 7.2e+160) tmp = Float64(x_46_im * Float64(x_46_re * -27.0)); else tmp = Float64(Float64(x_46_im * Float64(x_46_re * Float64(x_46_re - 27.0))) + Float64(x_46_re / Float64(-x_46_re))); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_re <= 7.2e+160) tmp = x_46_im * (x_46_re * -27.0); else tmp = (x_46_im * (x_46_re * (x_46_re - 27.0))) + (x_46_re / -x_46_re); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, 7.2e+160], N[(x$46$im * N[(x$46$re * -27.0), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im * N[(x$46$re * N[(x$46$re - 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re / (-x$46$re)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq 7.2 \cdot 10^{+160}:\\
\;\;\;\;x.im \cdot \left(x.re \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.re \cdot \left(x.re - 27\right)\right) + \frac{x.re}{-x.re}\\
\end{array}
\end{array}
if x.re < 7.20000000000000042e160Initial program 86.4%
*-commutative86.4%
flip3-+27.6%
associate-*r/26.0%
*-commutative26.0%
count-226.0%
pow226.0%
*-commutative26.0%
*-commutative26.0%
*-commutative26.0%
+-inverses26.0%
Applied egg-rr26.0%
Simplified44.7%
difference-of-squares47.3%
Applied egg-rr47.3%
Simplified32.1%
Taylor expanded in x.re around 0 9.3%
Taylor expanded in x.im around inf 24.7%
*-commutative24.7%
associate-*l*24.7%
Simplified24.7%
if 7.20000000000000042e160 < x.re Initial program 65.5%
*-commutative65.5%
flip3-+31.0%
associate-*r/31.0%
*-commutative31.0%
count-231.0%
pow231.0%
*-commutative31.0%
*-commutative31.0%
*-commutative31.0%
+-inverses31.0%
Applied egg-rr31.0%
Simplified89.7%
difference-of-squares100.0%
Applied egg-rr100.0%
Simplified100.0%
Taylor expanded in x.im around inf 55.2%
Final simplification28.1%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (* -27.0 (* x.re x.im)))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
return -27.0 * (x_46_re * x_46_im);
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (-27.0d0) * (x_46re * x_46im)
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
return -27.0 * (x_46_re * x_46_im);
}
x.im = abs(x.im) def code(x_46_re, x_46_im): return -27.0 * (x_46_re * x_46_im)
x.im = abs(x.im) function code(x_46_re, x_46_im) return Float64(-27.0 * Float64(x_46_re * x_46_im)) end
x.im = abs(x.im) function tmp = code(x_46_re, x_46_im) tmp = -27.0 * (x_46_re * x_46_im); end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := N[(-27.0 * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.im = |x.im|\\
\\
-27 \cdot \left(x.re \cdot x.im\right)
\end{array}
Initial program 84.0%
*-commutative84.0%
flip3-+28.0%
associate-*r/26.6%
*-commutative26.6%
count-226.6%
pow226.6%
*-commutative26.6%
*-commutative26.6%
*-commutative26.6%
+-inverses26.6%
Applied egg-rr26.6%
Simplified49.8%
difference-of-squares53.3%
Applied egg-rr53.3%
Simplified39.8%
Taylor expanded in x.re around 0 10.0%
Taylor expanded in x.im around inf 23.6%
Final simplification23.6%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (* x.im (* x.re -27.0)))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
return x_46_im * (x_46_re * -27.0);
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = x_46im * (x_46re * (-27.0d0))
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
return x_46_im * (x_46_re * -27.0);
}
x.im = abs(x.im) def code(x_46_re, x_46_im): return x_46_im * (x_46_re * -27.0)
x.im = abs(x.im) function code(x_46_re, x_46_im) return Float64(x_46_im * Float64(x_46_re * -27.0)) end
x.im = abs(x.im) function tmp = code(x_46_re, x_46_im) tmp = x_46_im * (x_46_re * -27.0); end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := N[(x$46$im * N[(x$46$re * -27.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.im = |x.im|\\
\\
x.im \cdot \left(x.re \cdot -27\right)
\end{array}
Initial program 84.0%
*-commutative84.0%
flip3-+28.0%
associate-*r/26.6%
*-commutative26.6%
count-226.6%
pow226.6%
*-commutative26.6%
*-commutative26.6%
*-commutative26.6%
+-inverses26.6%
Applied egg-rr26.6%
Simplified49.8%
difference-of-squares53.3%
Applied egg-rr53.3%
Simplified39.8%
Taylor expanded in x.re around 0 10.0%
Taylor expanded in x.im around inf 23.6%
*-commutative23.6%
associate-*l*23.6%
Simplified23.6%
Final simplification23.6%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 -1.0)
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
return -1.0;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = -1.0d0
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
return -1.0;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): return -1.0
x.im = abs(x.im) function code(x_46_re, x_46_im) return -1.0 end
x.im = abs(x.im) function tmp = code(x_46_re, x_46_im) tmp = -1.0; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := -1.0
\begin{array}{l}
x.im = |x.im|\\
\\
-1
\end{array}
Initial program 84.0%
*-commutative84.0%
flip3-+28.0%
associate-*r/26.6%
*-commutative26.6%
count-226.6%
pow226.6%
*-commutative26.6%
*-commutative26.6%
*-commutative26.6%
+-inverses26.6%
Applied egg-rr26.6%
Simplified49.8%
difference-of-squares53.3%
Applied egg-rr53.3%
Simplified39.8%
Taylor expanded in x.re around 0 10.0%
Taylor expanded in x.im around 0 2.7%
Final simplification2.7%
(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 2023292
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
:herbie-target
(+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))