
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
double code(double x) {
return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = mod(exp(x), sqrt(cos(x))) * exp(-x)
end function
def code(x): return math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)
function code(x) return Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
double code(double x) {
return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = mod(exp(x), sqrt(cos(x))) * exp(-x)
end function
def code(x): return math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)
function code(x) return Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (cos x)))
(t_1 (fmod (exp x) t_0))
(t_2 (exp (- x)))
(t_3 (* t_1 t_2)))
(if (<= t_3 0)
(*
(fmod
(*
(/
(- (pow 1 3) (pow (/ -1 x) 3))
(+ (* 1 1) (+ (exp (* (log (* x x)) -1)) (/ -1 x))))
x)
t_0)
t_2)
(if (<= t_3 2)
(/ 1 (/ (exp x) t_1))
(* (fmod 1 (sqrt 1)) (- 1 x))))))double code(double x) {
double t_0 = sqrt(cos(x));
double t_1 = fmod(exp(x), t_0);
double t_2 = exp(-x);
double t_3 = t_1 * t_2;
double tmp;
if (t_3 <= 0.0) {
tmp = fmod((((pow(1.0, 3.0) - pow((-1.0 / x), 3.0)) / ((1.0 * 1.0) + (exp((log((x * x)) * -1.0)) + (-1.0 / x)))) * x), t_0) * t_2;
} else if (t_3 <= 2.0) {
tmp = 1.0 / (exp(x) / t_1);
} else {
tmp = fmod(1.0, sqrt(1.0)) * (1.0 - x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt(cos(x))
t_1 = mod(exp(x), t_0)
t_2 = exp(-x)
t_3 = t_1 * t_2
if (t_3 <= 0.0d0) then
tmp = mod(((((1.0d0 ** 3.0d0) - (((-1.0d0) / x) ** 3.0d0)) / ((1.0d0 * 1.0d0) + (exp((log((x * x)) * (-1.0d0))) + ((-1.0d0) / x)))) * x), t_0) * t_2
else if (t_3 <= 2.0d0) then
tmp = 1.0d0 / (exp(x) / t_1)
else
tmp = mod(1.0d0, sqrt(1.0d0)) * (1.0d0 - x)
end if
code = tmp
end function
def code(x): t_0 = math.sqrt(math.cos(x)) t_1 = math.fmod(math.exp(x), t_0) t_2 = math.exp(-x) t_3 = t_1 * t_2 tmp = 0 if t_3 <= 0.0: tmp = math.fmod((((math.pow(1.0, 3.0) - math.pow((-1.0 / x), 3.0)) / ((1.0 * 1.0) + (math.exp((math.log((x * x)) * -1.0)) + (-1.0 / x)))) * x), t_0) * t_2 elif t_3 <= 2.0: tmp = 1.0 / (math.exp(x) / t_1) else: tmp = math.fmod(1.0, math.sqrt(1.0)) * (1.0 - x) return tmp
function code(x) t_0 = sqrt(cos(x)) t_1 = rem(exp(x), t_0) t_2 = exp(Float64(-x)) t_3 = Float64(t_1 * t_2) tmp = 0.0 if (t_3 <= 0.0) tmp = Float64(rem(Float64(Float64(Float64((1.0 ^ 3.0) - (Float64(-1.0 / x) ^ 3.0)) / Float64(Float64(1.0 * 1.0) + Float64(exp(Float64(log(Float64(x * x)) * -1.0)) + Float64(-1.0 / x)))) * x), t_0) * t_2); elseif (t_3 <= 2.0) tmp = Float64(1.0 / Float64(exp(x) / t_1)); else tmp = Float64(rem(1.0, sqrt(1.0)) * Float64(1.0 - x)); end return tmp end
code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[(-x)], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, 0], N[(N[With[{TMP1 = N[(N[(N[(N[Power[1, 3], $MachinePrecision] - N[Power[N[(-1 / x), $MachinePrecision], 3], $MachinePrecision]), $MachinePrecision] / N[(N[(1 * 1), $MachinePrecision] + N[(N[Exp[N[(N[Log[N[(x * x), $MachinePrecision]], $MachinePrecision] * -1), $MachinePrecision]], $MachinePrecision] + N[(-1 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 2], N[(1 / N[(N[Exp[x], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1, TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 - x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \sqrt{\cos x}\\
t_1 := \left(\left(e^{x}\right) \bmod t\_0\right)\\
t_2 := e^{-x}\\
t_3 := t\_1 \cdot t\_2\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;\left(\left(\frac{{1}^{3} - {\left(\frac{-1}{x}\right)}^{3}}{1 \cdot 1 + \left(e^{\log \left(x \cdot x\right) \cdot -1} + \frac{-1}{x}\right)} \cdot x\right) \bmod t\_0\right) \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\frac{1}{\frac{e^{x}}{t\_1}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod \left(\sqrt{1}\right)\right) \cdot \left(1 - x\right)\\
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0Initial program 12.5%
Taylor expanded in x around 0
lower-+.f6491.4%
Applied rewrites91.4%
lift-+.f64N/A
+-commutativeN/A
sum-to-multN/A
lower-unsound-*.f64N/A
lower-unsound-+.f64N/A
lower-unsound-/.f6491.7%
Applied rewrites91.7%
lift-+.f64N/A
add-flipN/A
flip3--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-pow.f64N/A
lower-unsound-pow.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-unsound-+.f64N/A
lower-unsound-*.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
distribute-rgt-neg-inN/A
*-lft-identityN/A
lower-unsound-+.f64N/A
Applied rewrites91.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
inv-powN/A
pow-to-expN/A
lower-unsound-exp.f64N/A
lower-unsound-*.f64N/A
lower-unsound-log.f64N/A
lower-*.f6492.2%
Applied rewrites92.2%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 12.5%
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
lift-exp.f64N/A
lower-/.f6412.5%
Applied rewrites12.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6412.6%
Applied rewrites12.6%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 12.5%
Taylor expanded in x around 0
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites83.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6483.6%
Applied rewrites83.6%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6483.6%
Applied rewrites83.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (cos x))) (t_1 (sqrt (exp (+ x x)))))
(if (<= (* (fmod (exp x) t_0) (exp (- x))) 2)
(* (fmod t_1 t_0) (/ 1 t_1))
(* (fmod 1 (sqrt 1)) (- 1 x)))))double code(double x) {
double t_0 = sqrt(cos(x));
double t_1 = sqrt(exp((x + x)));
double tmp;
if ((fmod(exp(x), t_0) * exp(-x)) <= 2.0) {
tmp = fmod(t_1, t_0) * (1.0 / t_1);
} else {
tmp = fmod(1.0, sqrt(1.0)) * (1.0 - x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(cos(x))
t_1 = sqrt(exp((x + x)))
if ((mod(exp(x), t_0) * exp(-x)) <= 2.0d0) then
tmp = mod(t_1, t_0) * (1.0d0 / t_1)
else
tmp = mod(1.0d0, sqrt(1.0d0)) * (1.0d0 - x)
end if
code = tmp
end function
def code(x): t_0 = math.sqrt(math.cos(x)) t_1 = math.sqrt(math.exp((x + x))) tmp = 0 if (math.fmod(math.exp(x), t_0) * math.exp(-x)) <= 2.0: tmp = math.fmod(t_1, t_0) * (1.0 / t_1) else: tmp = math.fmod(1.0, math.sqrt(1.0)) * (1.0 - x) return tmp
function code(x) t_0 = sqrt(cos(x)) t_1 = sqrt(exp(Float64(x + x))) tmp = 0.0 if (Float64(rem(exp(x), t_0) * exp(Float64(-x))) <= 2.0) tmp = Float64(rem(t_1, t_0) * Float64(1.0 / t_1)); else tmp = Float64(rem(1.0, sqrt(1.0)) * Float64(1.0 - x)); end return tmp end
code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[Exp[N[(x + x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2], N[(N[With[{TMP1 = t$95$1, TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1, TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 - x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \sqrt{\cos x}\\
t_1 := \sqrt{e^{x + x}}\\
\mathbf{if}\;\left(\left(e^{x}\right) \bmod t\_0\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\left(t\_1 \bmod t\_0\right) \cdot \frac{1}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod \left(\sqrt{1}\right)\right) \cdot \left(1 - x\right)\\
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 12.5%
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
lift-exp.f64N/A
lower-/.f6412.5%
Applied rewrites12.5%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-+.f6412.5%
Applied rewrites12.5%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-+.f6412.5%
Applied rewrites12.5%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 12.5%
Taylor expanded in x around 0
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites83.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6483.6%
Applied rewrites83.6%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6483.6%
Applied rewrites83.6%
(FPCore (x) :precision binary64 (if (<= x 6530219459687219/562949953421312) (* (fmod (sqrt (exp (+ x x))) (sqrt (cos x))) (exp (- x))) (* (fmod 1 (sqrt 1)) (- 1 x))))
double code(double x) {
double tmp;
if (x <= 11.6) {
tmp = fmod(sqrt(exp((x + x))), sqrt(cos(x))) * exp(-x);
} else {
tmp = fmod(1.0, sqrt(1.0)) * (1.0 - x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 11.6d0) then
tmp = mod(sqrt(exp((x + x))), sqrt(cos(x))) * exp(-x)
else
tmp = mod(1.0d0, sqrt(1.0d0)) * (1.0d0 - x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 11.6: tmp = math.fmod(math.sqrt(math.exp((x + x))), math.sqrt(math.cos(x))) * math.exp(-x) else: tmp = math.fmod(1.0, math.sqrt(1.0)) * (1.0 - x) return tmp
function code(x) tmp = 0.0 if (x <= 11.6) tmp = Float64(rem(sqrt(exp(Float64(x + x))), sqrt(cos(x))) * exp(Float64(-x))); else tmp = Float64(rem(1.0, sqrt(1.0)) * Float64(1.0 - x)); end return tmp end
code[x_] := If[LessEqual[x, 6530219459687219/562949953421312], N[(N[With[{TMP1 = N[Sqrt[N[Exp[N[(x + x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1, TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq \frac{6530219459687219}{562949953421312}:\\
\;\;\;\;\left(\left(\sqrt{e^{x + x}}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod \left(\sqrt{1}\right)\right) \cdot \left(1 - x\right)\\
\end{array}
if x < 11.6Initial program 12.5%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-+.f6412.5%
Applied rewrites12.5%
if 11.6 < x Initial program 12.5%
Taylor expanded in x around 0
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites83.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6483.6%
Applied rewrites83.6%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6483.6%
Applied rewrites83.6%
(FPCore (x) :precision binary64 (if (<= x 6530219459687219/562949953421312) (/ (fmod (exp x) (sqrt (cos x))) (exp x)) (* (fmod 1 (sqrt 1)) (- 1 x))))
double code(double x) {
double tmp;
if (x <= 11.6) {
tmp = fmod(exp(x), sqrt(cos(x))) / exp(x);
} else {
tmp = fmod(1.0, sqrt(1.0)) * (1.0 - x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 11.6d0) then
tmp = mod(exp(x), sqrt(cos(x))) / exp(x)
else
tmp = mod(1.0d0, sqrt(1.0d0)) * (1.0d0 - x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 11.6: tmp = math.fmod(math.exp(x), math.sqrt(math.cos(x))) / math.exp(x) else: tmp = math.fmod(1.0, math.sqrt(1.0)) * (1.0 - x) return tmp
function code(x) tmp = 0.0 if (x <= 11.6) tmp = Float64(rem(exp(x), sqrt(cos(x))) / exp(x)); else tmp = Float64(rem(1.0, sqrt(1.0)) * Float64(1.0 - x)); end return tmp end
code[x_] := If[LessEqual[x, 6530219459687219/562949953421312], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1, TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq \frac{6530219459687219}{562949953421312}:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod \left(\sqrt{1}\right)\right) \cdot \left(1 - x\right)\\
\end{array}
if x < 11.6Initial program 12.5%
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
lift-exp.f64N/A
lower-/.f6412.5%
Applied rewrites12.5%
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6412.6%
Applied rewrites12.6%
if 11.6 < x Initial program 12.5%
Taylor expanded in x around 0
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites83.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6483.6%
Applied rewrites83.6%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6483.6%
Applied rewrites83.6%
(FPCore (x) :precision binary64 (if (<= x 6530219459687219/562949953421312) (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) (* (fmod 1 (sqrt 1)) (- 1 x))))
double code(double x) {
double tmp;
if (x <= 11.6) {
tmp = fmod(exp(x), sqrt(cos(x))) * exp(-x);
} else {
tmp = fmod(1.0, sqrt(1.0)) * (1.0 - x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 11.6d0) then
tmp = mod(exp(x), sqrt(cos(x))) * exp(-x)
else
tmp = mod(1.0d0, sqrt(1.0d0)) * (1.0d0 - x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 11.6: tmp = math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x) else: tmp = math.fmod(1.0, math.sqrt(1.0)) * (1.0 - x) return tmp
function code(x) tmp = 0.0 if (x <= 11.6) tmp = Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))); else tmp = Float64(rem(1.0, sqrt(1.0)) * Float64(1.0 - x)); end return tmp end
code[x_] := If[LessEqual[x, 6530219459687219/562949953421312], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1, TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq \frac{6530219459687219}{562949953421312}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod \left(\sqrt{1}\right)\right) \cdot \left(1 - x\right)\\
\end{array}
if x < 11.6Initial program 12.5%
if 11.6 < x Initial program 12.5%
Taylor expanded in x around 0
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites83.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6483.6%
Applied rewrites83.6%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6483.6%
Applied rewrites83.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (* -1/4 (* x x))) (t_1 (exp (- x))))
(if (<= x 6530219459687219/1125899906842624)
(* (fmod (exp x) (* (+ 1 (/ 1 t_0)) t_0)) t_1)
(* (fmod (sqrt (+ 1 (* 2 x))) (sqrt (cos x))) t_1))))double code(double x) {
double t_0 = -0.25 * (x * x);
double t_1 = exp(-x);
double tmp;
if (x <= 5.8) {
tmp = fmod(exp(x), ((1.0 + (1.0 / t_0)) * t_0)) * t_1;
} else {
tmp = fmod(sqrt((1.0 + (2.0 * x))), sqrt(cos(x))) * t_1;
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-0.25d0) * (x * x)
t_1 = exp(-x)
if (x <= 5.8d0) then
tmp = mod(exp(x), ((1.0d0 + (1.0d0 / t_0)) * t_0)) * t_1
else
tmp = mod(sqrt((1.0d0 + (2.0d0 * x))), sqrt(cos(x))) * t_1
end if
code = tmp
end function
def code(x): t_0 = -0.25 * (x * x) t_1 = math.exp(-x) tmp = 0 if x <= 5.8: tmp = math.fmod(math.exp(x), ((1.0 + (1.0 / t_0)) * t_0)) * t_1 else: tmp = math.fmod(math.sqrt((1.0 + (2.0 * x))), math.sqrt(math.cos(x))) * t_1 return tmp
function code(x) t_0 = Float64(-0.25 * Float64(x * x)) t_1 = exp(Float64(-x)) tmp = 0.0 if (x <= 5.8) tmp = Float64(rem(exp(x), Float64(Float64(1.0 + Float64(1.0 / t_0)) * t_0)) * t_1); else tmp = Float64(rem(sqrt(Float64(1.0 + Float64(2.0 * x))), sqrt(cos(x))) * t_1); end return tmp end
code[x_] := Block[{t$95$0 = N[(-1/4 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, 6530219459687219/1125899906842624], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(1 + N[(1 / t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[With[{TMP1 = N[Sqrt[N[(1 + N[(2 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{-1}{4} \cdot \left(x \cdot x\right)\\
t_1 := e^{-x}\\
\mathbf{if}\;x \leq \frac{6530219459687219}{1125899906842624}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\left(1 + \frac{1}{t\_0}\right) \cdot t\_0\right)\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + 2 \cdot x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot t\_1\\
\end{array}
if x < 5.7999999999999998Initial program 12.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6411.7%
Applied rewrites11.7%
lift-+.f64N/A
+-commutativeN/A
sum-to-multN/A
lower-unsound-*.f64N/A
lower-unsound-+.f64N/A
lower-unsound-/.f6411.7%
lift-pow.f64N/A
unpow2N/A
lower-*.f6411.7%
lift-pow.f64N/A
unpow2N/A
lower-*.f6411.7%
Applied rewrites11.7%
if 5.7999999999999998 < x Initial program 12.5%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-+.f6412.5%
Applied rewrites12.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6491.2%
Applied rewrites91.2%
(FPCore (x) :precision binary64 (if (<= x 6530219459687219/1125899906842624) (/ (fmod (exp x) (- (* -1/4 (* x x)) -1)) (exp x)) (* (fmod (sqrt (+ 1 (* 2 x))) (sqrt (cos x))) (exp (- x)))))
double code(double x) {
double tmp;
if (x <= 5.8) {
tmp = fmod(exp(x), ((-0.25 * (x * x)) - -1.0)) / exp(x);
} else {
tmp = fmod(sqrt((1.0 + (2.0 * x))), sqrt(cos(x))) * exp(-x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 5.8d0) then
tmp = mod(exp(x), (((-0.25d0) * (x * x)) - (-1.0d0))) / exp(x)
else
tmp = mod(sqrt((1.0d0 + (2.0d0 * x))), sqrt(cos(x))) * exp(-x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 5.8: tmp = math.fmod(math.exp(x), ((-0.25 * (x * x)) - -1.0)) / math.exp(x) else: tmp = math.fmod(math.sqrt((1.0 + (2.0 * x))), math.sqrt(math.cos(x))) * math.exp(-x) return tmp
function code(x) tmp = 0.0 if (x <= 5.8) tmp = Float64(rem(exp(x), Float64(Float64(-0.25 * Float64(x * x)) - -1.0)) / exp(x)); else tmp = Float64(rem(sqrt(Float64(1.0 + Float64(2.0 * x))), sqrt(cos(x))) * exp(Float64(-x))); end return tmp end
code[x_] := If[LessEqual[x, 6530219459687219/1125899906842624], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(-1/4 * N[(x * x), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = N[Sqrt[N[(1 + N[(2 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq \frac{6530219459687219}{1125899906842624}:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\frac{-1}{4} \cdot \left(x \cdot x\right) - -1\right)\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + 2 \cdot x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}\\
\end{array}
if x < 5.7999999999999998Initial program 12.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6411.7%
Applied rewrites11.7%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
mult-flip-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites11.8%
if 5.7999999999999998 < x Initial program 12.5%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-+.f6412.5%
Applied rewrites12.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6491.2%
Applied rewrites91.2%
(FPCore (x) :precision binary64 (if (<= x 6530219459687219/1125899906842624) (/ (fmod (exp x) (- (* -1/4 (* x x)) -1)) (exp x)) (* (fmod (+ 1 x) (sqrt (cos x))) (exp (- x)))))
double code(double x) {
double tmp;
if (x <= 5.8) {
tmp = fmod(exp(x), ((-0.25 * (x * x)) - -1.0)) / exp(x);
} else {
tmp = fmod((1.0 + x), sqrt(cos(x))) * exp(-x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 5.8d0) then
tmp = mod(exp(x), (((-0.25d0) * (x * x)) - (-1.0d0))) / exp(x)
else
tmp = mod((1.0d0 + x), sqrt(cos(x))) * exp(-x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 5.8: tmp = math.fmod(math.exp(x), ((-0.25 * (x * x)) - -1.0)) / math.exp(x) else: tmp = math.fmod((1.0 + x), math.sqrt(math.cos(x))) * math.exp(-x) return tmp
function code(x) tmp = 0.0 if (x <= 5.8) tmp = Float64(rem(exp(x), Float64(Float64(-0.25 * Float64(x * x)) - -1.0)) / exp(x)); else tmp = Float64(rem(Float64(1.0 + x), sqrt(cos(x))) * exp(Float64(-x))); end return tmp end
code[x_] := If[LessEqual[x, 6530219459687219/1125899906842624], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(-1/4 * N[(x * x), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = N[(1 + x), $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq \frac{6530219459687219}{1125899906842624}:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\frac{-1}{4} \cdot \left(x \cdot x\right) - -1\right)\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}\\
\end{array}
if x < 5.7999999999999998Initial program 12.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6411.7%
Applied rewrites11.7%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
mult-flip-revN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites11.8%
if 5.7999999999999998 < x Initial program 12.5%
Taylor expanded in x around 0
lower-+.f6491.4%
Applied rewrites91.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x 6530219459687219/1125899906842624)
(* (fmod (exp x) (- (* -1/4 (* x x)) -1)) t_0)
(* (fmod (+ 1 x) (sqrt (cos x))) t_0))))double code(double x) {
double t_0 = exp(-x);
double tmp;
if (x <= 5.8) {
tmp = fmod(exp(x), ((-0.25 * (x * x)) - -1.0)) * t_0;
} else {
tmp = fmod((1.0 + x), sqrt(cos(x))) * t_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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (x <= 5.8d0) then
tmp = mod(exp(x), (((-0.25d0) * (x * x)) - (-1.0d0))) * t_0
else
tmp = mod((1.0d0 + x), sqrt(cos(x))) * t_0
end if
code = tmp
end function
def code(x): t_0 = math.exp(-x) tmp = 0 if x <= 5.8: tmp = math.fmod(math.exp(x), ((-0.25 * (x * x)) - -1.0)) * t_0 else: tmp = math.fmod((1.0 + x), math.sqrt(math.cos(x))) * t_0 return tmp
function code(x) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= 5.8) tmp = Float64(rem(exp(x), Float64(Float64(-0.25 * Float64(x * x)) - -1.0)) * t_0); else tmp = Float64(rem(Float64(1.0 + x), sqrt(cos(x))) * t_0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, 6530219459687219/1125899906842624], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(-1/4 * N[(x * x), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[With[{TMP1 = N[(1 + x), $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq \frac{6530219459687219}{1125899906842624}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\frac{-1}{4} \cdot \left(x \cdot x\right) - -1\right)\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot t\_0\\
\end{array}
if x < 5.7999999999999998Initial program 12.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6411.7%
Applied rewrites11.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6411.7%
lift-pow.f64N/A
unpow2N/A
lower-*.f6411.7%
Applied rewrites11.7%
if 5.7999999999999998 < x Initial program 12.5%
Taylor expanded in x around 0
lower-+.f6491.4%
Applied rewrites91.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1 (* x (+ 1 (* x (+ 1/2 (* 1/6 x)))))))
(t_1 (sqrt (cos x))))
(if (<= x 1)
(* (fmod t_0 t_1) (/ 1 t_0))
(* (fmod (+ 1 x) t_1) (exp (- x))))))double code(double x) {
double t_0 = 1.0 + (x * (1.0 + (x * (0.5 + (0.16666666666666666 * x)))));
double t_1 = sqrt(cos(x));
double tmp;
if (x <= 1.0) {
tmp = fmod(t_0, t_1) * (1.0 / t_0);
} else {
tmp = fmod((1.0 + x), t_1) * exp(-x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (0.16666666666666666d0 * x)))))
t_1 = sqrt(cos(x))
if (x <= 1.0d0) then
tmp = mod(t_0, t_1) * (1.0d0 / t_0)
else
tmp = mod((1.0d0 + x), t_1) * exp(-x)
end if
code = tmp
end function
def code(x): t_0 = 1.0 + (x * (1.0 + (x * (0.5 + (0.16666666666666666 * x))))) t_1 = math.sqrt(math.cos(x)) tmp = 0 if x <= 1.0: tmp = math.fmod(t_0, t_1) * (1.0 / t_0) else: tmp = math.fmod((1.0 + x), t_1) * math.exp(-x) return tmp
function code(x) t_0 = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(0.16666666666666666 * x)))))) t_1 = sqrt(cos(x)) tmp = 0.0 if (x <= 1.0) tmp = Float64(rem(t_0, t_1) * Float64(1.0 / t_0)); else tmp = Float64(rem(Float64(1.0 + x), t_1) * exp(Float64(-x))); end return tmp end
code[x_] := Block[{t$95$0 = N[(1 + N[(x * N[(1 + N[(x * N[(1/2 + N[(1/6 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1], N[(N[With[{TMP1 = t$95$0, TMP2 = t$95$1}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = N[(1 + x), $MachinePrecision], TMP2 = t$95$1}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := 1 + x \cdot \left(1 + x \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot x\right)\right)\\
t_1 := \sqrt{\cos x}\\
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left(t\_0 \bmod t\_1\right) \cdot \frac{1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + x\right) \bmod t\_1\right) \cdot e^{-x}\\
\end{array}
if x < 1Initial program 12.5%
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
lift-exp.f64N/A
lower-/.f6412.5%
Applied rewrites12.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6436.9%
Applied rewrites36.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6412.7%
Applied rewrites12.7%
if 1 < x Initial program 12.5%
Taylor expanded in x around 0
lower-+.f6491.4%
Applied rewrites91.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1 (* x (+ 1 (* x (+ 1/2 (* 1/6 x))))))))
(if (<= x 5854679515581645/4503599627370496)
(* (fmod t_0 (sqrt (cos x))) (/ 1 t_0))
(* (fmod (+ 1 x) (sqrt 1)) (exp (- x))))))double code(double x) {
double t_0 = 1.0 + (x * (1.0 + (x * (0.5 + (0.16666666666666666 * x)))));
double tmp;
if (x <= 1.3) {
tmp = fmod(t_0, sqrt(cos(x))) * (1.0 / t_0);
} else {
tmp = fmod((1.0 + x), sqrt(1.0)) * exp(-x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (0.16666666666666666d0 * x)))))
if (x <= 1.3d0) then
tmp = mod(t_0, sqrt(cos(x))) * (1.0d0 / t_0)
else
tmp = mod((1.0d0 + x), sqrt(1.0d0)) * exp(-x)
end if
code = tmp
end function
def code(x): t_0 = 1.0 + (x * (1.0 + (x * (0.5 + (0.16666666666666666 * x))))) tmp = 0 if x <= 1.3: tmp = math.fmod(t_0, math.sqrt(math.cos(x))) * (1.0 / t_0) else: tmp = math.fmod((1.0 + x), math.sqrt(1.0)) * math.exp(-x) return tmp
function code(x) t_0 = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(0.16666666666666666 * x)))))) tmp = 0.0 if (x <= 1.3) tmp = Float64(rem(t_0, sqrt(cos(x))) * Float64(1.0 / t_0)); else tmp = Float64(rem(Float64(1.0 + x), sqrt(1.0)) * exp(Float64(-x))); end return tmp end
code[x_] := Block[{t$95$0 = N[(1 + N[(x * N[(1 + N[(x * N[(1/2 + N[(1/6 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5854679515581645/4503599627370496], N[(N[With[{TMP1 = t$95$0, TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = N[(1 + x), $MachinePrecision], TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := 1 + x \cdot \left(1 + x \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot x\right)\right)\\
\mathbf{if}\;x \leq \frac{5854679515581645}{4503599627370496}:\\
\;\;\;\;\left(t\_0 \bmod \left(\sqrt{\cos x}\right)\right) \cdot \frac{1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + x\right) \bmod \left(\sqrt{1}\right)\right) \cdot e^{-x}\\
\end{array}
if x < 1.3Initial program 12.5%
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
lift-exp.f64N/A
lower-/.f6412.5%
Applied rewrites12.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6436.9%
Applied rewrites36.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6412.7%
Applied rewrites12.7%
if 1.3 < x Initial program 12.5%
Taylor expanded in x around 0
lower-+.f6491.4%
Applied rewrites91.4%
Taylor expanded in x around 0
Applied rewrites91.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1 (* x (+ 1 (* 1/2 x))))))
(if (<= x 5404319552844595/9007199254740992)
(* (fmod t_0 (sqrt (cos x))) (/ 1 t_0))
(* (fmod (+ 1 x) (sqrt 1)) (exp (- x))))))double code(double x) {
double t_0 = 1.0 + (x * (1.0 + (0.5 * x)));
double tmp;
if (x <= 0.6) {
tmp = fmod(t_0, sqrt(cos(x))) * (1.0 / t_0);
} else {
tmp = fmod((1.0 + x), sqrt(1.0)) * exp(-x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (x * (1.0d0 + (0.5d0 * x)))
if (x <= 0.6d0) then
tmp = mod(t_0, sqrt(cos(x))) * (1.0d0 / t_0)
else
tmp = mod((1.0d0 + x), sqrt(1.0d0)) * exp(-x)
end if
code = tmp
end function
def code(x): t_0 = 1.0 + (x * (1.0 + (0.5 * x))) tmp = 0 if x <= 0.6: tmp = math.fmod(t_0, math.sqrt(math.cos(x))) * (1.0 / t_0) else: tmp = math.fmod((1.0 + x), math.sqrt(1.0)) * math.exp(-x) return tmp
function code(x) t_0 = Float64(1.0 + Float64(x * Float64(1.0 + Float64(0.5 * x)))) tmp = 0.0 if (x <= 0.6) tmp = Float64(rem(t_0, sqrt(cos(x))) * Float64(1.0 / t_0)); else tmp = Float64(rem(Float64(1.0 + x), sqrt(1.0)) * exp(Float64(-x))); end return tmp end
code[x_] := Block[{t$95$0 = N[(1 + N[(x * N[(1 + N[(1/2 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5404319552844595/9007199254740992], N[(N[With[{TMP1 = t$95$0, TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = N[(1 + x), $MachinePrecision], TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := 1 + x \cdot \left(1 + \frac{1}{2} \cdot x\right)\\
\mathbf{if}\;x \leq \frac{5404319552844595}{9007199254740992}:\\
\;\;\;\;\left(t\_0 \bmod \left(\sqrt{\cos x}\right)\right) \cdot \frac{1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + x\right) \bmod \left(\sqrt{1}\right)\right) \cdot e^{-x}\\
\end{array}
if x < 0.59999999999999998Initial program 12.5%
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
lift-exp.f64N/A
lower-/.f6412.5%
Applied rewrites12.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6449.9%
Applied rewrites49.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6413.1%
Applied rewrites13.1%
if 0.59999999999999998 < x Initial program 12.5%
Taylor expanded in x around 0
lower-+.f6491.4%
Applied rewrites91.4%
Taylor expanded in x around 0
Applied rewrites91.3%
(FPCore (x) :precision binary64 (if (<= x 5404319552844595/9007199254740992) (* (fmod (+ 1 x) (sqrt (cos x))) (/ 1 (+ 1 x))) (* (fmod (+ 1 x) (sqrt 1)) (exp (- x)))))
double code(double x) {
double tmp;
if (x <= 0.6) {
tmp = fmod((1.0 + x), sqrt(cos(x))) * (1.0 / (1.0 + x));
} else {
tmp = fmod((1.0 + x), sqrt(1.0)) * exp(-x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.6d0) then
tmp = mod((1.0d0 + x), sqrt(cos(x))) * (1.0d0 / (1.0d0 + x))
else
tmp = mod((1.0d0 + x), sqrt(1.0d0)) * exp(-x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 0.6: tmp = math.fmod((1.0 + x), math.sqrt(math.cos(x))) * (1.0 / (1.0 + x)) else: tmp = math.fmod((1.0 + x), math.sqrt(1.0)) * math.exp(-x) return tmp
function code(x) tmp = 0.0 if (x <= 0.6) tmp = Float64(rem(Float64(1.0 + x), sqrt(cos(x))) * Float64(1.0 / Float64(1.0 + x))); else tmp = Float64(rem(Float64(1.0 + x), sqrt(1.0)) * exp(Float64(-x))); end return tmp end
code[x_] := If[LessEqual[x, 5404319552844595/9007199254740992], N[(N[With[{TMP1 = N[(1 + x), $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 / N[(1 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = N[(1 + x), $MachinePrecision], TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq \frac{5404319552844595}{9007199254740992}:\\
\;\;\;\;\left(\left(1 + x\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \frac{1}{1 + x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + x\right) \bmod \left(\sqrt{1}\right)\right) \cdot e^{-x}\\
\end{array}
if x < 0.59999999999999998Initial program 12.5%
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
lift-exp.f64N/A
lower-/.f6412.5%
Applied rewrites12.5%
Taylor expanded in x around 0
lower-+.f6491.4%
Applied rewrites91.4%
Taylor expanded in x around 0
lower-+.f6415.0%
Applied rewrites15.0%
if 0.59999999999999998 < x Initial program 12.5%
Taylor expanded in x around 0
lower-+.f6491.4%
Applied rewrites91.4%
Taylor expanded in x around 0
Applied rewrites91.3%
(FPCore (x) :precision binary64 (* (fmod (+ 1 x) (sqrt 1)) (exp (- x))))
double code(double x) {
return fmod((1.0 + x), sqrt(1.0)) * exp(-x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = mod((1.0d0 + x), sqrt(1.0d0)) * exp(-x)
end function
def code(x): return math.fmod((1.0 + x), math.sqrt(1.0)) * math.exp(-x)
function code(x) return Float64(rem(Float64(1.0 + x), sqrt(1.0)) * exp(Float64(-x))) end
code[x_] := N[(N[With[{TMP1 = N[(1 + x), $MachinePrecision], TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
\left(\left(1 + x\right) \bmod \left(\sqrt{1}\right)\right) \cdot e^{-x}
Initial program 12.5%
Taylor expanded in x around 0
lower-+.f6491.4%
Applied rewrites91.4%
Taylor expanded in x around 0
Applied rewrites91.3%
(FPCore (x) :precision binary64 (* (fmod 1 (sqrt 1)) (- 1 x)))
double code(double x) {
return fmod(1.0, sqrt(1.0)) * (1.0 - x);
}
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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = mod(1.0d0, sqrt(1.0d0)) * (1.0d0 - x)
end function
def code(x): return math.fmod(1.0, math.sqrt(1.0)) * (1.0 - x)
function code(x) return Float64(rem(1.0, sqrt(1.0)) * Float64(1.0 - x)) end
code[x_] := N[(N[With[{TMP1 = 1, TMP2 = N[Sqrt[1], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1 - x), $MachinePrecision]), $MachinePrecision]
\left(1 \bmod \left(\sqrt{1}\right)\right) \cdot \left(1 - x\right)
Initial program 12.5%
Taylor expanded in x around 0
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites83.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6483.6%
Applied rewrites83.6%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6483.6%
Applied rewrites83.6%
herbie shell --seed 2025285 -o generate:evaluate
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))