
(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]
\begin{array}{l}
\\
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\end{array}
Herbie found 12 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]
\begin{array}{l}
\\
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -1e-21)
(*
(fmod
(exp x)
(sqrt
(*
(+
0.041666666666666664
(- (/ 1.0 (* (* x x) (* x x))) (/ 0.5 (* x x))))
(exp (* (log (* x x)) 2.0)))))
t_0)
(* (fmod x (fma (* x x) -0.25 1.0)) t_0))))
double code(double x) {
double t_0 = exp(-x);
double tmp;
if (x <= -1e-21) {
tmp = fmod(exp(x), sqrt(((0.041666666666666664 + ((1.0 / ((x * x) * (x * x))) - (0.5 / (x * x)))) * exp((log((x * x)) * 2.0))))) * t_0;
} else {
tmp = fmod(x, fma((x * x), -0.25, 1.0)) * t_0;
}
return tmp;
}
function code(x) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -1e-21) tmp = Float64(rem(exp(x), sqrt(Float64(Float64(0.041666666666666664 + Float64(Float64(1.0 / Float64(Float64(x * x) * Float64(x * x))) - Float64(0.5 / Float64(x * x)))) * exp(Float64(log(Float64(x * x)) * 2.0))))) * t_0); else tmp = Float64(rem(x, fma(Float64(x * x), -0.25, 1.0)) * t_0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -1e-21], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[(0.041666666666666664 + N[(N[(1.0 / N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[Log[N[(x * x), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\left(0.041666666666666664 + \left(\frac{1}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \frac{0.5}{x \cdot x}\right)\right) \cdot e^{\log \left(x \cdot x\right) \cdot 2}}\right)\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if x < -9.99999999999999908e-22Initial program 68.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
negate-subN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6468.5
Applied rewrites68.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
pow2N/A
lift-*.f6476.0
Applied rewrites76.0%
if -9.99999999999999908e-22 < x Initial program 5.5%
Taylor expanded in x around 0
Applied rewrites37.2%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
Taylor expanded in x around 0
lower-+.f6438.2
Applied rewrites38.2%
Taylor expanded in x around inf
Applied rewrites98.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -1e-21)
(*
(fmod
(exp x)
(sqrt (* (/ 1.0 (* (* (* x x) x) x)) (exp (* (log (* x x)) 2.0)))))
t_0)
(* (fmod x (fma (* x x) -0.25 1.0)) t_0))))
double code(double x) {
double t_0 = exp(-x);
double tmp;
if (x <= -1e-21) {
tmp = fmod(exp(x), sqrt(((1.0 / (((x * x) * x) * x)) * exp((log((x * x)) * 2.0))))) * t_0;
} else {
tmp = fmod(x, fma((x * x), -0.25, 1.0)) * t_0;
}
return tmp;
}
function code(x) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -1e-21) tmp = Float64(rem(exp(x), sqrt(Float64(Float64(1.0 / Float64(Float64(Float64(x * x) * x) * x)) * exp(Float64(log(Float64(x * x)) * 2.0))))) * t_0); else tmp = Float64(rem(x, fma(Float64(x * x), -0.25, 1.0)) * t_0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -1e-21], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[(1.0 / N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[Log[N[(x * x), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\frac{1}{\left(\left(x \cdot x\right) \cdot x\right) \cdot x} \cdot e^{\log \left(x \cdot x\right) \cdot 2}}\right)\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if x < -9.99999999999999908e-22Initial program 68.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
negate-subN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6468.5
Applied rewrites68.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
pow2N/A
lift-*.f6476.0
Applied rewrites76.0%
Taylor expanded in x around 0
lower-/.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow2N/A
associate-*r*N/A
pow2N/A
pow3N/A
lower-*.f64N/A
pow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6476.0
Applied rewrites76.0%
if -9.99999999999999908e-22 < x Initial program 5.5%
Taylor expanded in x around 0
Applied rewrites37.2%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
Taylor expanded in x around 0
lower-+.f6438.2
Applied rewrites38.2%
Taylor expanded in x around inf
Applied rewrites98.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -1e-21)
(*
(fmod
(exp x)
(sqrt
(*
(+ (/ (- (/ 1.0 (* x x)) 0.5) (* x x)) 0.041666666666666664)
(* (* (* x x) x) x))))
t_0)
(* (fmod x (fma (* x x) -0.25 1.0)) t_0))))
double code(double x) {
double t_0 = exp(-x);
double tmp;
if (x <= -1e-21) {
tmp = fmod(exp(x), sqrt((((((1.0 / (x * x)) - 0.5) / (x * x)) + 0.041666666666666664) * (((x * x) * x) * x)))) * t_0;
} else {
tmp = fmod(x, fma((x * x), -0.25, 1.0)) * t_0;
}
return tmp;
}
function code(x) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -1e-21) tmp = Float64(rem(exp(x), sqrt(Float64(Float64(Float64(Float64(Float64(1.0 / Float64(x * x)) - 0.5) / Float64(x * x)) + 0.041666666666666664) * Float64(Float64(Float64(x * x) * x) * x)))) * t_0); else tmp = Float64(rem(x, fma(Float64(x * x), -0.25, 1.0)) * t_0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -1e-21], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[(N[(N[(N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\left(\frac{\frac{1}{x \cdot x} - 0.5}{x \cdot x} + 0.041666666666666664\right) \cdot \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right)}\right)\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if x < -9.99999999999999908e-22Initial program 68.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
negate-subN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6468.5
Applied rewrites68.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.6%
Applied rewrites68.6%
if -9.99999999999999908e-22 < x Initial program 5.5%
Taylor expanded in x around 0
Applied rewrites37.2%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
Taylor expanded in x around 0
lower-+.f6438.2
Applied rewrites38.2%
Taylor expanded in x around inf
Applied rewrites98.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -1e-21)
(*
(fmod (exp x) (sqrt (* (/ 1.0 (* (* (* x x) x) x)) (* (* x x) (* x x)))))
t_0)
(* (fmod x (fma (* x x) -0.25 1.0)) t_0))))
double code(double x) {
double t_0 = exp(-x);
double tmp;
if (x <= -1e-21) {
tmp = fmod(exp(x), sqrt(((1.0 / (((x * x) * x) * x)) * ((x * x) * (x * x))))) * t_0;
} else {
tmp = fmod(x, fma((x * x), -0.25, 1.0)) * t_0;
}
return tmp;
}
function code(x) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -1e-21) tmp = Float64(rem(exp(x), sqrt(Float64(Float64(1.0 / Float64(Float64(Float64(x * x) * x) * x)) * Float64(Float64(x * x) * Float64(x * x))))) * t_0); else tmp = Float64(rem(x, fma(Float64(x * x), -0.25, 1.0)) * t_0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -1e-21], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[(1.0 / N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\frac{1}{\left(\left(x \cdot x\right) \cdot x\right) \cdot x} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)}\right)\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if x < -9.99999999999999908e-22Initial program 68.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
negate-subN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6468.5
Applied rewrites68.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.6%
Taylor expanded in x around 0
lower-/.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow2N/A
associate-*r*N/A
pow2N/A
pow3N/A
lower-*.f64N/A
pow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6468.7
Applied rewrites68.7%
if -9.99999999999999908e-22 < x Initial program 5.5%
Taylor expanded in x around 0
Applied rewrites37.2%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
Taylor expanded in x around 0
lower-+.f6438.2
Applied rewrites38.2%
Taylor expanded in x around inf
Applied rewrites98.6%
(FPCore (x) :precision binary64 (if (<= x -1e-21) (* (fmod (exp x) 1.0) (/ 1.0 (exp x))) (* (fmod x (fma (* x x) -0.25 1.0)) (exp (- x)))))
double code(double x) {
double tmp;
if (x <= -1e-21) {
tmp = fmod(exp(x), 1.0) * (1.0 / exp(x));
} else {
tmp = fmod(x, fma((x * x), -0.25, 1.0)) * exp(-x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= -1e-21) tmp = Float64(rem(exp(x), 1.0) * Float64(1.0 / exp(x))); else tmp = Float64(rem(x, fma(Float64(x * x), -0.25, 1.0)) * exp(Float64(-x))); end return tmp end
code[x_] := If[LessEqual[x, -1e-21], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod 1\right) \cdot \frac{1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \cdot e^{-x}\\
\end{array}
\end{array}
if x < -9.99999999999999908e-22Initial program 68.5%
Taylor expanded in x around 0
Applied rewrites68.5%
lift-exp.f64N/A
lift-neg.f64N/A
exp-negN/A
lower-/.f64N/A
lift-exp.f6468.6
Applied rewrites68.6%
if -9.99999999999999908e-22 < x Initial program 5.5%
Taylor expanded in x around 0
Applied rewrites37.2%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
Taylor expanded in x around 0
lower-+.f6438.2
Applied rewrites38.2%
Taylor expanded in x around inf
Applied rewrites98.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -1e-21)
(* (fmod (exp x) 1.0) t_0)
(* (fmod x (fma (* x x) -0.25 1.0)) t_0))))
double code(double x) {
double t_0 = exp(-x);
double tmp;
if (x <= -1e-21) {
tmp = fmod(exp(x), 1.0) * t_0;
} else {
tmp = fmod(x, fma((x * x), -0.25, 1.0)) * t_0;
}
return tmp;
}
function code(x) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -1e-21) tmp = Float64(rem(exp(x), 1.0) * t_0); else tmp = Float64(rem(x, fma(Float64(x * x), -0.25, 1.0)) * t_0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -1e-21], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod 1\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if x < -9.99999999999999908e-22Initial program 68.5%
Taylor expanded in x around 0
Applied rewrites68.5%
if -9.99999999999999908e-22 < x Initial program 5.5%
Taylor expanded in x around 0
Applied rewrites37.2%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
Taylor expanded in x around 0
lower-+.f6438.2
Applied rewrites38.2%
Taylor expanded in x around inf
Applied rewrites98.6%
(FPCore (x) :precision binary64 (if (<= x -1e-21) (* (fmod (exp x) 1.0) (fma (fma 0.5 x -1.0) x 1.0)) (* (fmod x (fma (* x x) -0.25 1.0)) (exp (- x)))))
double code(double x) {
double tmp;
if (x <= -1e-21) {
tmp = fmod(exp(x), 1.0) * fma(fma(0.5, x, -1.0), x, 1.0);
} else {
tmp = fmod(x, fma((x * x), -0.25, 1.0)) * exp(-x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= -1e-21) tmp = Float64(rem(exp(x), 1.0) * fma(fma(0.5, x, -1.0), x, 1.0)); else tmp = Float64(rem(x, fma(Float64(x * x), -0.25, 1.0)) * exp(Float64(-x))); end return tmp end
code[x_] := If[LessEqual[x, -1e-21], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(N[(0.5 * x + -1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.5, x, -1\right), x, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \cdot e^{-x}\\
\end{array}
\end{array}
if x < -9.99999999999999908e-22Initial program 68.5%
Taylor expanded in x around 0
Applied rewrites68.5%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
negate-subN/A
metadata-evalN/A
lower-fma.f6457.6
Applied rewrites57.6%
if -9.99999999999999908e-22 < x Initial program 5.5%
Taylor expanded in x around 0
Applied rewrites37.2%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
Taylor expanded in x around 0
lower-+.f6438.2
Applied rewrites38.2%
Taylor expanded in x around inf
Applied rewrites98.6%
(FPCore (x) :precision binary64 (if (<= x -1e-21) (* (fmod (exp x) 1.0) (- 1.0 x)) (* (fmod x (fma (* x x) -0.25 1.0)) (exp (- x)))))
double code(double x) {
double tmp;
if (x <= -1e-21) {
tmp = fmod(exp(x), 1.0) * (1.0 - x);
} else {
tmp = fmod(x, fma((x * x), -0.25, 1.0)) * exp(-x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= -1e-21) tmp = Float64(rem(exp(x), 1.0) * Float64(1.0 - x)); else tmp = Float64(rem(x, fma(Float64(x * x), -0.25, 1.0)) * exp(Float64(-x))); end return tmp end
code[x_] := If[LessEqual[x, -1e-21], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod 1\right) \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod \left(\mathsf{fma}\left(x \cdot x, -0.25, 1\right)\right)\right) \cdot e^{-x}\\
\end{array}
\end{array}
if x < -9.99999999999999908e-22Initial program 68.5%
Taylor expanded in x around 0
mul-1-negN/A
negate-subN/A
lower--.f6453.0
Applied rewrites53.0%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6453.0
Applied rewrites53.0%
Taylor expanded in x around 0
Applied rewrites53.0%
if -9.99999999999999908e-22 < x Initial program 5.5%
Taylor expanded in x around 0
Applied rewrites37.2%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
Taylor expanded in x around 0
lower-+.f6438.2
Applied rewrites38.2%
Taylor expanded in x around inf
Applied rewrites98.6%
(FPCore (x) :precision binary64 (if (<= x 0.6) (* (fmod (exp x) 1.0) (- 1.0 x)) (* (fmod 1.0 (* (* x x) -0.25)) (exp (- x)))))
double code(double x) {
double tmp;
if (x <= 0.6) {
tmp = fmod(exp(x), 1.0) * (1.0 - x);
} else {
tmp = fmod(1.0, ((x * x) * -0.25)) * 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(exp(x), 1.0d0) * (1.0d0 - x)
else
tmp = mod(1.0d0, ((x * x) * (-0.25d0))) * exp(-x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 0.6: tmp = math.fmod(math.exp(x), 1.0) * (1.0 - x) else: tmp = math.fmod(1.0, ((x * x) * -0.25)) * math.exp(-x) return tmp
function code(x) tmp = 0.0 if (x <= 0.6) tmp = Float64(rem(exp(x), 1.0) * Float64(1.0 - x)); else tmp = Float64(rem(1.0, Float64(Float64(x * x) * -0.25)) * exp(Float64(-x))); end return tmp end
code[x_] := If[LessEqual[x, 0.6], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1.0, TMP2 = N[(N[(x * x), $MachinePrecision] * -0.25), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.6:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod 1\right) \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod \left(\left(x \cdot x\right) \cdot -0.25\right)\right) \cdot e^{-x}\\
\end{array}
\end{array}
if x < 0.599999999999999978Initial program 12.6%
Taylor expanded in x around 0
mul-1-negN/A
negate-subN/A
lower--.f6411.0
Applied rewrites11.0%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6410.9
Applied rewrites10.9%
Taylor expanded in x around 0
Applied rewrites10.7%
if 0.599999999999999978 < x Initial program 0.5%
Taylor expanded in x around 0
Applied rewrites99.5%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6499.5
Applied rewrites99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6499.5
Applied rewrites99.5%
(FPCore (x) :precision binary64 (if (<= x 1.0) (* (fmod (exp x) 1.0) (- 1.0 x)) (* (fmod 1.0 1.0) 1.0)))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = fmod(exp(x), 1.0) * (1.0 - x);
} else {
tmp = fmod(1.0, 1.0) * 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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = mod(exp(x), 1.0d0) * (1.0d0 - x)
else
tmp = mod(1.0d0, 1.0d0) * 1.0d0
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 1.0: tmp = math.fmod(math.exp(x), 1.0) * (1.0 - x) else: tmp = math.fmod(1.0, 1.0) * 1.0 return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(rem(exp(x), 1.0) * Float64(1.0 - x)); else tmp = Float64(rem(1.0, 1.0) * 1.0); end return tmp end
code[x_] := If[LessEqual[x, 1.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod 1\right) \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right) \cdot 1\\
\end{array}
\end{array}
if x < 1Initial program 12.7%
Taylor expanded in x around 0
mul-1-negN/A
negate-subN/A
lower--.f6411.0
Applied rewrites11.0%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6411.0
Applied rewrites11.0%
Taylor expanded in x around 0
Applied rewrites10.7%
if 1 < x Initial program 0.2%
Taylor expanded in x around 0
Applied rewrites99.7%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites99.6%
Taylor expanded in x around 0
Applied rewrites99.6%
(FPCore (x) :precision binary64 (if (<= x 10.0) (* (fmod (exp x) 1.0) 1.0) (* (fmod 1.0 1.0) 1.0)))
double code(double x) {
double tmp;
if (x <= 10.0) {
tmp = fmod(exp(x), 1.0) * 1.0;
} else {
tmp = fmod(1.0, 1.0) * 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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 10.0d0) then
tmp = mod(exp(x), 1.0d0) * 1.0d0
else
tmp = mod(1.0d0, 1.0d0) * 1.0d0
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 10.0: tmp = math.fmod(math.exp(x), 1.0) * 1.0 else: tmp = math.fmod(1.0, 1.0) * 1.0 return tmp
function code(x) tmp = 0.0 if (x <= 10.0) tmp = Float64(rem(exp(x), 1.0) * 1.0); else tmp = Float64(rem(1.0, 1.0) * 1.0); end return tmp end
code[x_] := If[LessEqual[x, 10.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod 1\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right) \cdot 1\\
\end{array}
\end{array}
if x < 10Initial program 12.8%
Taylor expanded in x around 0
Applied rewrites11.9%
Taylor expanded in x around 0
Applied rewrites9.6%
if 10 < x Initial program 0.1%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
(FPCore (x) :precision binary64 (* (fmod 1.0 1.0) 1.0))
double code(double x) {
return fmod(1.0, 1.0) * 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(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = mod(1.0d0, 1.0d0) * 1.0d0
end function
def code(x): return math.fmod(1.0, 1.0) * 1.0
function code(x) return Float64(rem(1.0, 1.0) * 1.0) end
code[x_] := N[(N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(1 \bmod 1\right) \cdot 1
\end{array}
Initial program 8.7%
Taylor expanded in x around 0
Applied rewrites35.6%
Taylor expanded in x around 0
cos-neg-revN/A
lift-neg.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6435.6
Applied rewrites35.6%
Taylor expanded in x around 0
Applied rewrites35.3%
Taylor expanded in x around 0
Applied rewrites35.3%
herbie shell --seed 2025110
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))