
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
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(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
e^{re} \cdot \cos im
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
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(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
e^{re} \cdot \cos im
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* (- (* 0.16666666666666666 re) -0.5) re) re)))
(if (<= re 1e+103)
(* (+ 1.0 (/ (- (* t_0 t_0) (* re re)) (- t_0 re))) (cos im))
(*
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* 0.16666666666666666 re))))))
(cos im)))))double code(double re, double im) {
double t_0 = (((0.16666666666666666 * re) - -0.5) * re) * re;
double tmp;
if (re <= 1e+103) {
tmp = (1.0 + (((t_0 * t_0) - (re * re)) / (t_0 - re))) * cos(im);
} else {
tmp = (1.0 + (re * (1.0 + (re * (0.5 + (0.16666666666666666 * re)))))) * cos(im);
}
return tmp;
}
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(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (((0.16666666666666666d0 * re) - (-0.5d0)) * re) * re
if (re <= 1d+103) then
tmp = (1.0d0 + (((t_0 * t_0) - (re * re)) / (t_0 - re))) * cos(im)
else
tmp = (1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (0.16666666666666666d0 * re)))))) * cos(im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (((0.16666666666666666 * re) - -0.5) * re) * re;
double tmp;
if (re <= 1e+103) {
tmp = (1.0 + (((t_0 * t_0) - (re * re)) / (t_0 - re))) * Math.cos(im);
} else {
tmp = (1.0 + (re * (1.0 + (re * (0.5 + (0.16666666666666666 * re)))))) * Math.cos(im);
}
return tmp;
}
def code(re, im): t_0 = (((0.16666666666666666 * re) - -0.5) * re) * re tmp = 0 if re <= 1e+103: tmp = (1.0 + (((t_0 * t_0) - (re * re)) / (t_0 - re))) * math.cos(im) else: tmp = (1.0 + (re * (1.0 + (re * (0.5 + (0.16666666666666666 * re)))))) * math.cos(im) return tmp
function code(re, im) t_0 = Float64(Float64(Float64(Float64(0.16666666666666666 * re) - -0.5) * re) * re) tmp = 0.0 if (re <= 1e+103) tmp = Float64(Float64(1.0 + Float64(Float64(Float64(t_0 * t_0) - Float64(re * re)) / Float64(t_0 - re))) * cos(im)); else tmp = Float64(Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(0.16666666666666666 * re)))))) * cos(im)); end return tmp end
function tmp_2 = code(re, im) t_0 = (((0.16666666666666666 * re) - -0.5) * re) * re; tmp = 0.0; if (re <= 1e+103) tmp = (1.0 + (((t_0 * t_0) - (re * re)) / (t_0 - re))) * cos(im); else tmp = (1.0 + (re * (1.0 + (re * (0.5 + (0.16666666666666666 * re)))))) * cos(im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(N[(0.16666666666666666 * re), $MachinePrecision] - -0.5), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]}, If[LessEqual[re, 1e+103], N[(N[(1.0 + N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(re * re), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(0.16666666666666666 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left(0.16666666666666666 \cdot re - -0.5\right) \cdot re\right) \cdot re\\
\mathbf{if}\;re \leq 10^{+103}:\\
\;\;\;\;\left(1 + \frac{t\_0 \cdot t\_0 - re \cdot re}{t\_0 - re}\right) \cdot \cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re \cdot \left(1 + re \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\right) \cdot \cos im\\
\end{array}
if re < 1e103Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6467.2%
Applied rewrites67.2%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.3%
if 1e103 < re Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6467.2%
Applied rewrites67.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 0.5 (* 0.16666666666666666 re)))
(t_1 (* (exp re) (cos im)))
(t_2 (+ 1.0 (* re (+ 1.0 (* re t_0))))))
(if (<= t_1 (- INFINITY))
(* t_2 (+ 1.0 (* -0.5 (pow im 2.0))))
(if (<= t_1 0.99998)
(* t_2 (cos im))
(-
(+ 1.0 re)
(* -1.0 (* (sqrt (* (* re re) (* re re))) t_0)))))))double code(double re, double im) {
double t_0 = 0.5 + (0.16666666666666666 * re);
double t_1 = exp(re) * cos(im);
double t_2 = 1.0 + (re * (1.0 + (re * t_0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2 * (1.0 + (-0.5 * pow(im, 2.0)));
} else if (t_1 <= 0.99998) {
tmp = t_2 * cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * t_0));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = 0.5 + (0.16666666666666666 * re);
double t_1 = Math.exp(re) * Math.cos(im);
double t_2 = 1.0 + (re * (1.0 + (re * t_0)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_2 * (1.0 + (-0.5 * Math.pow(im, 2.0)));
} else if (t_1 <= 0.99998) {
tmp = t_2 * Math.cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (Math.sqrt(((re * re) * (re * re))) * t_0));
}
return tmp;
}
def code(re, im): t_0 = 0.5 + (0.16666666666666666 * re) t_1 = math.exp(re) * math.cos(im) t_2 = 1.0 + (re * (1.0 + (re * t_0))) tmp = 0 if t_1 <= -math.inf: tmp = t_2 * (1.0 + (-0.5 * math.pow(im, 2.0))) elif t_1 <= 0.99998: tmp = t_2 * math.cos(im) else: tmp = (1.0 + re) - (-1.0 * (math.sqrt(((re * re) * (re * re))) * t_0)) return tmp
function code(re, im) t_0 = Float64(0.5 + Float64(0.16666666666666666 * re)) t_1 = Float64(exp(re) * cos(im)) t_2 = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * t_0)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t_2 * Float64(1.0 + Float64(-0.5 * (im ^ 2.0)))); elseif (t_1 <= 0.99998) tmp = Float64(t_2 * cos(im)); else tmp = Float64(Float64(1.0 + re) - Float64(-1.0 * Float64(sqrt(Float64(Float64(re * re) * Float64(re * re))) * t_0))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 + (0.16666666666666666 * re); t_1 = exp(re) * cos(im); t_2 = 1.0 + (re * (1.0 + (re * t_0))); tmp = 0.0; if (t_1 <= -Inf) tmp = t_2 * (1.0 + (-0.5 * (im ^ 2.0))); elseif (t_1 <= 0.99998) tmp = t_2 * cos(im); else tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * t_0)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 + N[(0.16666666666666666 * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(re * N[(1.0 + N[(re * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(t$95$2 * N[(1.0 + N[(-0.5 * N[Power[im, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.99998], N[(t$95$2 * N[Cos[im], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + re), $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := 0.5 + 0.16666666666666666 \cdot re\\
t_1 := e^{re} \cdot \cos im\\
t_2 := 1 + re \cdot \left(1 + re \cdot t\_0\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2 \cdot \left(1 + -0.5 \cdot {im}^{2}\right)\\
\mathbf{elif}\;t\_1 \leq 0.99998:\\
\;\;\;\;t\_2 \cdot \cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re\right) - -1 \cdot \left(\sqrt{\left(re \cdot re\right) \cdot \left(re \cdot re\right)} \cdot t\_0\right)\\
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6467.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6440.0%
Applied rewrites40.0%
if -inf.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.99997999999999998Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6467.2%
Applied rewrites67.2%
if 0.99997999999999998 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6467.2%
Applied rewrites67.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
Applied rewrites41.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im)))
(t_1 (+ 0.5 (* 0.16666666666666666 re))))
(if (<= t_0 (- INFINITY))
(*
(- (* (- (* 0.5 re) -1.0) re) -1.0)
(- (* (* im im) -0.5) -1.0))
(if (<= t_0 0.99998)
(* (+ 1.0 (* re (+ 1.0 (* re t_1)))) (cos im))
(-
(+ 1.0 re)
(* -1.0 (* (sqrt (* (* re re) (* re re))) t_1)))))))double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double t_1 = 0.5 + (0.16666666666666666 * re);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = (1.0 + (re * (1.0 + (re * t_1)))) * cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * t_1));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(re) * Math.cos(im);
double t_1 = 0.5 + (0.16666666666666666 * re);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = (1.0 + (re * (1.0 + (re * t_1)))) * Math.cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (Math.sqrt(((re * re) * (re * re))) * t_1));
}
return tmp;
}
def code(re, im): t_0 = math.exp(re) * math.cos(im) t_1 = 0.5 + (0.16666666666666666 * re) tmp = 0 if t_0 <= -math.inf: tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0) elif t_0 <= 0.99998: tmp = (1.0 + (re * (1.0 + (re * t_1)))) * math.cos(im) else: tmp = (1.0 + re) - (-1.0 * (math.sqrt(((re * re) * (re * re))) * t_1)) return tmp
function code(re, im) t_0 = Float64(exp(re) * cos(im)) t_1 = Float64(0.5 + Float64(0.16666666666666666 * re)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * re) - -1.0) * re) - -1.0) * Float64(Float64(Float64(im * im) * -0.5) - -1.0)); elseif (t_0 <= 0.99998) tmp = Float64(Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * t_1)))) * cos(im)); else tmp = Float64(Float64(1.0 + re) - Float64(-1.0 * Float64(sqrt(Float64(Float64(re * re) * Float64(re * re))) * t_1))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(re) * cos(im); t_1 = 0.5 + (0.16666666666666666 * re); tmp = 0.0; if (t_0 <= -Inf) tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0); elseif (t_0 <= 0.99998) tmp = (1.0 + (re * (1.0 + (re * t_1)))) * cos(im); else tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * t_1)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 + N[(0.16666666666666666 * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(0.5 * re), $MachinePrecision] - -1.0), $MachinePrecision] * re), $MachinePrecision] - -1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.5), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.99998], N[(N[(1.0 + N[(re * N[(1.0 + N[(re * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + re), $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
t_1 := 0.5 + 0.16666666666666666 \cdot re\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(0.5 \cdot re - -1\right) \cdot re - -1\right) \cdot \left(\left(im \cdot im\right) \cdot -0.5 - -1\right)\\
\mathbf{elif}\;t\_0 \leq 0.99998:\\
\;\;\;\;\left(1 + re \cdot \left(1 + re \cdot t\_1\right)\right) \cdot \cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re\right) - -1 \cdot \left(\sqrt{\left(re \cdot re\right) \cdot \left(re \cdot re\right)} \cdot t\_1\right)\\
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
Taylor expanded in im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6437.6%
Applied rewrites37.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites37.6%
if -inf.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.99997999999999998Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6467.2%
Applied rewrites67.2%
if 0.99997999999999998 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6467.2%
Applied rewrites67.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
Applied rewrites41.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 (- INFINITY))
(*
(- (* (- (* 0.5 re) -1.0) re) -1.0)
(- (* (* im im) -0.5) -1.0))
(if (<= t_0 0.99998)
(* (+ re (- (* (* 0.5 re) re) -1.0)) (cos im))
(-
(+ 1.0 re)
(*
-1.0
(*
(sqrt (* (* re re) (* re re)))
(+ 0.5 (* 0.16666666666666666 re)))))))))double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = (re + (((0.5 * re) * re) - -1.0)) * cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(re) * Math.cos(im);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = (re + (((0.5 * re) * re) - -1.0)) * Math.cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (Math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
def code(re, im): t_0 = math.exp(re) * math.cos(im) tmp = 0 if t_0 <= -math.inf: tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0) elif t_0 <= 0.99998: tmp = (re + (((0.5 * re) * re) - -1.0)) * math.cos(im) else: tmp = (1.0 + re) - (-1.0 * (math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))) return tmp
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * re) - -1.0) * re) - -1.0) * Float64(Float64(Float64(im * im) * -0.5) - -1.0)); elseif (t_0 <= 0.99998) tmp = Float64(Float64(re + Float64(Float64(Float64(0.5 * re) * re) - -1.0)) * cos(im)); else tmp = Float64(Float64(1.0 + re) - Float64(-1.0 * Float64(sqrt(Float64(Float64(re * re) * Float64(re * re))) * Float64(0.5 + Float64(0.16666666666666666 * re))))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(re) * cos(im); tmp = 0.0; if (t_0 <= -Inf) tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0); elseif (t_0 <= 0.99998) tmp = (re + (((0.5 * re) * re) - -1.0)) * cos(im); else tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(0.5 * re), $MachinePrecision] - -1.0), $MachinePrecision] * re), $MachinePrecision] - -1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.5), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.99998], N[(N[(re + N[(N[(N[(0.5 * re), $MachinePrecision] * re), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + re), $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.5 + N[(0.16666666666666666 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(0.5 \cdot re - -1\right) \cdot re - -1\right) \cdot \left(\left(im \cdot im\right) \cdot -0.5 - -1\right)\\
\mathbf{elif}\;t\_0 \leq 0.99998:\\
\;\;\;\;\left(re + \left(\left(0.5 \cdot re\right) \cdot re - -1\right)\right) \cdot \cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re\right) - -1 \cdot \left(\sqrt{\left(re \cdot re\right) \cdot \left(re \cdot re\right)} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\\
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
Taylor expanded in im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6437.6%
Applied rewrites37.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites37.6%
if -inf.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.99997999999999998Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
associate-+l+N/A
lower-+.f64N/A
add-flipN/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval63.2%
Applied rewrites63.2%
if 0.99997999999999998 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6467.2%
Applied rewrites67.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
Applied rewrites41.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 (- INFINITY))
(*
(- (* (- (* 0.5 re) -1.0) re) -1.0)
(- (* (* im im) -0.5) -1.0))
(if (<= t_0 0.99998)
(* (+ 1.0 (* re (+ 1.0 (* 0.5 re)))) (cos im))
(-
(+ 1.0 re)
(*
-1.0
(*
(sqrt (* (* re re) (* re re)))
(+ 0.5 (* 0.16666666666666666 re)))))))))double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = (1.0 + (re * (1.0 + (0.5 * re)))) * cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(re) * Math.cos(im);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = (1.0 + (re * (1.0 + (0.5 * re)))) * Math.cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (Math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
def code(re, im): t_0 = math.exp(re) * math.cos(im) tmp = 0 if t_0 <= -math.inf: tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0) elif t_0 <= 0.99998: tmp = (1.0 + (re * (1.0 + (0.5 * re)))) * math.cos(im) else: tmp = (1.0 + re) - (-1.0 * (math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))) return tmp
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * re) - -1.0) * re) - -1.0) * Float64(Float64(Float64(im * im) * -0.5) - -1.0)); elseif (t_0 <= 0.99998) tmp = Float64(Float64(1.0 + Float64(re * Float64(1.0 + Float64(0.5 * re)))) * cos(im)); else tmp = Float64(Float64(1.0 + re) - Float64(-1.0 * Float64(sqrt(Float64(Float64(re * re) * Float64(re * re))) * Float64(0.5 + Float64(0.16666666666666666 * re))))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(re) * cos(im); tmp = 0.0; if (t_0 <= -Inf) tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0); elseif (t_0 <= 0.99998) tmp = (1.0 + (re * (1.0 + (0.5 * re)))) * cos(im); else tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(0.5 * re), $MachinePrecision] - -1.0), $MachinePrecision] * re), $MachinePrecision] - -1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.5), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.99998], N[(N[(1.0 + N[(re * N[(1.0 + N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + re), $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.5 + N[(0.16666666666666666 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(0.5 \cdot re - -1\right) \cdot re - -1\right) \cdot \left(\left(im \cdot im\right) \cdot -0.5 - -1\right)\\
\mathbf{elif}\;t\_0 \leq 0.99998:\\
\;\;\;\;\left(1 + re \cdot \left(1 + 0.5 \cdot re\right)\right) \cdot \cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re\right) - -1 \cdot \left(\sqrt{\left(re \cdot re\right) \cdot \left(re \cdot re\right)} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\\
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
Taylor expanded in im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6437.6%
Applied rewrites37.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites37.6%
if -inf.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.99997999999999998Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
if 0.99997999999999998 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6467.2%
Applied rewrites67.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
Applied rewrites41.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 (- INFINITY))
(*
(- (* (- (* 0.5 re) -1.0) re) -1.0)
(- (* (* im im) -0.5) -1.0))
(if (<= t_0 0.99998)
(* (+ 1.0 re) (cos im))
(-
(+ 1.0 re)
(*
-1.0
(*
(sqrt (* (* re re) (* re re)))
(+ 0.5 (* 0.16666666666666666 re)))))))))double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = (1.0 + re) * cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(re) * Math.cos(im);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = (1.0 + re) * Math.cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (Math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
def code(re, im): t_0 = math.exp(re) * math.cos(im) tmp = 0 if t_0 <= -math.inf: tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0) elif t_0 <= 0.99998: tmp = (1.0 + re) * math.cos(im) else: tmp = (1.0 + re) - (-1.0 * (math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))) return tmp
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * re) - -1.0) * re) - -1.0) * Float64(Float64(Float64(im * im) * -0.5) - -1.0)); elseif (t_0 <= 0.99998) tmp = Float64(Float64(1.0 + re) * cos(im)); else tmp = Float64(Float64(1.0 + re) - Float64(-1.0 * Float64(sqrt(Float64(Float64(re * re) * Float64(re * re))) * Float64(0.5 + Float64(0.16666666666666666 * re))))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(re) * cos(im); tmp = 0.0; if (t_0 <= -Inf) tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0); elseif (t_0 <= 0.99998) tmp = (1.0 + re) * cos(im); else tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(0.5 * re), $MachinePrecision] - -1.0), $MachinePrecision] * re), $MachinePrecision] - -1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.5), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.99998], N[(N[(1.0 + re), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + re), $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.5 + N[(0.16666666666666666 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(0.5 \cdot re - -1\right) \cdot re - -1\right) \cdot \left(\left(im \cdot im\right) \cdot -0.5 - -1\right)\\
\mathbf{elif}\;t\_0 \leq 0.99998:\\
\;\;\;\;\left(1 + re\right) \cdot \cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re\right) - -1 \cdot \left(\sqrt{\left(re \cdot re\right) \cdot \left(re \cdot re\right)} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\\
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
Taylor expanded in im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6437.6%
Applied rewrites37.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites37.6%
if -inf.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.99997999999999998Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6451.5%
Applied rewrites51.5%
if 0.99997999999999998 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6467.2%
Applied rewrites67.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
Applied rewrites41.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 (- INFINITY))
(*
(- (* (- (* 0.5 re) -1.0) re) -1.0)
(- (* (* im im) -0.5) -1.0))
(if (<= t_0 0.99998)
(cos im)
(-
(+ 1.0 re)
(*
-1.0
(*
(sqrt (* (* re re) (* re re)))
(+ 0.5 (* 0.16666666666666666 re)))))))))double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(re) * Math.cos(im);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else if (t_0 <= 0.99998) {
tmp = Math.cos(im);
} else {
tmp = (1.0 + re) - (-1.0 * (Math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
def code(re, im): t_0 = math.exp(re) * math.cos(im) tmp = 0 if t_0 <= -math.inf: tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0) elif t_0 <= 0.99998: tmp = math.cos(im) else: tmp = (1.0 + re) - (-1.0 * (math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))) return tmp
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * re) - -1.0) * re) - -1.0) * Float64(Float64(Float64(im * im) * -0.5) - -1.0)); elseif (t_0 <= 0.99998) tmp = cos(im); else tmp = Float64(Float64(1.0 + re) - Float64(-1.0 * Float64(sqrt(Float64(Float64(re * re) * Float64(re * re))) * Float64(0.5 + Float64(0.16666666666666666 * re))))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(re) * cos(im); tmp = 0.0; if (t_0 <= -Inf) tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0); elseif (t_0 <= 0.99998) tmp = cos(im); else tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(0.5 * re), $MachinePrecision] - -1.0), $MachinePrecision] * re), $MachinePrecision] - -1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.5), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.99998], N[Cos[im], $MachinePrecision], N[(N[(1.0 + re), $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.5 + N[(0.16666666666666666 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(0.5 \cdot re - -1\right) \cdot re - -1\right) \cdot \left(\left(im \cdot im\right) \cdot -0.5 - -1\right)\\
\mathbf{elif}\;t\_0 \leq 0.99998:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re\right) - -1 \cdot \left(\sqrt{\left(re \cdot re\right) \cdot \left(re \cdot re\right)} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\\
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
Taylor expanded in im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6437.6%
Applied rewrites37.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites37.6%
if -inf.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.99997999999999998Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f6450.7%
Applied rewrites50.7%
if 0.99997999999999998 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6467.2%
Applied rewrites67.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
Applied rewrites41.9%
(FPCore (re im) :precision binary64 (* (/ (* (- re (- -1.0 (* (* (- (* 0.16666666666666666 re) -0.5) re) re))) re) re) (cos im)))
double code(double re, double im) {
return (((re - (-1.0 - ((((0.16666666666666666 * re) - -0.5) * re) * re))) * re) / re) * cos(im);
}
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(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (((re - ((-1.0d0) - ((((0.16666666666666666d0 * re) - (-0.5d0)) * re) * re))) * re) / re) * cos(im)
end function
public static double code(double re, double im) {
return (((re - (-1.0 - ((((0.16666666666666666 * re) - -0.5) * re) * re))) * re) / re) * Math.cos(im);
}
def code(re, im): return (((re - (-1.0 - ((((0.16666666666666666 * re) - -0.5) * re) * re))) * re) / re) * math.cos(im)
function code(re, im) return Float64(Float64(Float64(Float64(re - Float64(-1.0 - Float64(Float64(Float64(Float64(0.16666666666666666 * re) - -0.5) * re) * re))) * re) / re) * cos(im)) end
function tmp = code(re, im) tmp = (((re - (-1.0 - ((((0.16666666666666666 * re) - -0.5) * re) * re))) * re) / re) * cos(im); end
code[re_, im_] := N[(N[(N[(N[(re - N[(-1.0 - N[(N[(N[(N[(0.16666666666666666 * re), $MachinePrecision] - -0.5), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision] / re), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\frac{\left(re - \left(-1 - \left(\left(0.16666666666666666 \cdot re - -0.5\right) \cdot re\right) \cdot re\right)\right) \cdot re}{re} \cdot \cos im
Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6467.2%
Applied rewrites67.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
associate-+l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites67.0%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
*-lft-identityN/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6469.1%
Applied rewrites69.1%
(FPCore (re im)
:precision binary64
(if (<= (* (exp re) (cos im)) -0.05)
(* (- (* (- (* 0.5 re) -1.0) re) -1.0) (- (* (* im im) -0.5) -1.0))
(-
(+ 1.0 re)
(*
-1.0
(*
(sqrt (* (* re re) (* re re)))
(+ 0.5 (* 0.16666666666666666 re)))))))double code(double re, double im) {
double tmp;
if ((exp(re) * cos(im)) <= -0.05) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else {
tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
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(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((exp(re) * cos(im)) <= (-0.05d0)) then
tmp = ((((0.5d0 * re) - (-1.0d0)) * re) - (-1.0d0)) * (((im * im) * (-0.5d0)) - (-1.0d0))
else
tmp = (1.0d0 + re) - ((-1.0d0) * (sqrt(((re * re) * (re * re))) * (0.5d0 + (0.16666666666666666d0 * re))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((Math.exp(re) * Math.cos(im)) <= -0.05) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else {
tmp = (1.0 + re) - (-1.0 * (Math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re))));
}
return tmp;
}
def code(re, im): tmp = 0 if (math.exp(re) * math.cos(im)) <= -0.05: tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0) else: tmp = (1.0 + re) - (-1.0 * (math.sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))) return tmp
function code(re, im) tmp = 0.0 if (Float64(exp(re) * cos(im)) <= -0.05) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * re) - -1.0) * re) - -1.0) * Float64(Float64(Float64(im * im) * -0.5) - -1.0)); else tmp = Float64(Float64(1.0 + re) - Float64(-1.0 * Float64(sqrt(Float64(Float64(re * re) * Float64(re * re))) * Float64(0.5 + Float64(0.16666666666666666 * re))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((exp(re) * cos(im)) <= -0.05) tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0); else tmp = (1.0 + re) - (-1.0 * (sqrt(((re * re) * (re * re))) * (0.5 + (0.16666666666666666 * re)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], -0.05], N[(N[(N[(N[(N[(0.5 * re), $MachinePrecision] - -1.0), $MachinePrecision] * re), $MachinePrecision] - -1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.5), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + re), $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.5 + N[(0.16666666666666666 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \cos im \leq -0.05:\\
\;\;\;\;\left(\left(0.5 \cdot re - -1\right) \cdot re - -1\right) \cdot \left(\left(im \cdot im\right) \cdot -0.5 - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re\right) - -1 \cdot \left(\sqrt{\left(re \cdot re\right) \cdot \left(re \cdot re\right)} \cdot \left(0.5 + 0.16666666666666666 \cdot re\right)\right)\\
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.050000000000000003Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
Taylor expanded in im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6437.6%
Applied rewrites37.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites37.6%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6467.2%
Applied rewrites67.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
lift-pow.f64N/A
pow2N/A
lower-*.f6441.9%
Applied rewrites41.9%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (cos im)) -0.05) (* (- (* (- (* 0.5 re) -1.0) re) -1.0) (- (* (* im im) -0.5) -1.0)) (+ (+ re (* (* (- (* 0.16666666666666666 re) -0.5) re) re)) 1.0)))
double code(double re, double im) {
double tmp;
if ((exp(re) * cos(im)) <= -0.05) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else {
tmp = (re + ((((0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0;
}
return tmp;
}
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(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((exp(re) * cos(im)) <= (-0.05d0)) then
tmp = ((((0.5d0 * re) - (-1.0d0)) * re) - (-1.0d0)) * (((im * im) * (-0.5d0)) - (-1.0d0))
else
tmp = (re + ((((0.16666666666666666d0 * re) - (-0.5d0)) * re) * re)) + 1.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((Math.exp(re) * Math.cos(im)) <= -0.05) {
tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0);
} else {
tmp = (re + ((((0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if (math.exp(re) * math.cos(im)) <= -0.05: tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0) else: tmp = (re + ((((0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0 return tmp
function code(re, im) tmp = 0.0 if (Float64(exp(re) * cos(im)) <= -0.05) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * re) - -1.0) * re) - -1.0) * Float64(Float64(Float64(im * im) * -0.5) - -1.0)); else tmp = Float64(Float64(re + Float64(Float64(Float64(Float64(0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((exp(re) * cos(im)) <= -0.05) tmp = ((((0.5 * re) - -1.0) * re) - -1.0) * (((im * im) * -0.5) - -1.0); else tmp = (re + ((((0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], -0.05], N[(N[(N[(N[(N[(0.5 * re), $MachinePrecision] - -1.0), $MachinePrecision] * re), $MachinePrecision] - -1.0), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.5), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(re + N[(N[(N[(N[(0.16666666666666666 * re), $MachinePrecision] - -0.5), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \cos im \leq -0.05:\\
\;\;\;\;\left(\left(0.5 \cdot re - -1\right) \cdot re - -1\right) \cdot \left(\left(im \cdot im\right) \cdot -0.5 - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re + \left(\left(0.16666666666666666 \cdot re - -0.5\right) \cdot re\right) \cdot re\right) + 1\\
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.050000000000000003Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6463.2%
Applied rewrites63.2%
Taylor expanded in im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6437.6%
Applied rewrites37.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.6%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6437.6%
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites37.6%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6467.2%
Applied rewrites67.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites40.4%
(FPCore (re im) :precision binary64 (+ (+ re (* (* (- (* 0.16666666666666666 re) -0.5) re) re)) 1.0))
double code(double re, double im) {
return (re + ((((0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0;
}
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(re, im)
use fmin_fmax_functions
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (re + ((((0.16666666666666666d0 * re) - (-0.5d0)) * re) * re)) + 1.0d0
end function
public static double code(double re, double im) {
return (re + ((((0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0;
}
def code(re, im): return (re + ((((0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0
function code(re, im) return Float64(Float64(re + Float64(Float64(Float64(Float64(0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0) end
function tmp = code(re, im) tmp = (re + ((((0.16666666666666666 * re) - -0.5) * re) * re)) + 1.0; end
code[re_, im_] := N[(N[(re + N[(N[(N[(N[(0.16666666666666666 * re), $MachinePrecision] - -0.5), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\left(re + \left(\left(0.16666666666666666 \cdot re - -0.5\right) \cdot re\right) \cdot re\right) + 1
Initial program 100.0%
Taylor expanded in re around 0
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6467.2%
Applied rewrites67.2%
Applied rewrites67.2%
Taylor expanded in im around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6440.4%
Applied rewrites40.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites40.4%
herbie shell --seed 2025258
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))