
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (fma x (fabs eps) x)))
(*
0.5
(-
(exp (- (* x (- 1.0 (fabs eps)))))
(*
-1.0
(*
(sqrt (sqrt (pow 0.36787944117144233 t_0)))
(sqrt (exp (fma (- -1.0 (fabs eps)) x (/ t_0 -2.0))))))))))double code(double x, double eps) {
double t_0 = fma(x, fabs(eps), x);
return 0.5 * (exp(-(x * (1.0 - fabs(eps)))) - (-1.0 * (sqrt(sqrt(pow(0.36787944117144233, t_0))) * sqrt(exp(fma((-1.0 - fabs(eps)), x, (t_0 / -2.0)))))));
}
function code(x, eps) t_0 = fma(x, abs(eps), x) return Float64(0.5 * Float64(exp(Float64(-Float64(x * Float64(1.0 - abs(eps))))) - Float64(-1.0 * Float64(sqrt(sqrt((0.36787944117144233 ^ t_0))) * sqrt(exp(fma(Float64(-1.0 - abs(eps)), x, Float64(t_0 / -2.0)))))))) end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[Abs[eps], $MachinePrecision] + x), $MachinePrecision]}, N[(0.5 * N[(N[Exp[(-N[(x * N[(1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[Sqrt[N[Power[0.36787944117144233, t$95$0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Exp[N[(N[(-1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision] * x + N[(t$95$0 / -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, \left|\varepsilon\right|, x\right)\\
0.5 \cdot \left(e^{-x \cdot \left(1 - \left|\varepsilon\right|\right)} - -1 \cdot \left(\sqrt{\sqrt{{0.36787944117144233}^{t\_0}}} \cdot \sqrt{e^{\mathsf{fma}\left(-1 - \left|\varepsilon\right|, x, \frac{t\_0}{-2}\right)}}\right)\right)
\end{array}
Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Applied rewrites99.0%
lift-exp.f64N/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-neg-outN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
associate-*l*N/A
lift-*.f64N/A
lift-+.f64N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6499.0%
lift-+.f64N/A
lift-*.f64N/A
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lift-fma.f6499.0%
Applied rewrites99.0%
Evaluated real constant99.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- -1.0 (fabs eps))))
(*
0.5
(-
(exp (- (* x (- 1.0 (fabs eps)))))
(*
-1.0
(*
(sqrt (sqrt (exp (* t_0 x))))
(sqrt (exp (fma t_0 x (/ (fma x (fabs eps) x) -2.0))))))))))double code(double x, double eps) {
double t_0 = -1.0 - fabs(eps);
return 0.5 * (exp(-(x * (1.0 - fabs(eps)))) - (-1.0 * (sqrt(sqrt(exp((t_0 * x)))) * sqrt(exp(fma(t_0, x, (fma(x, fabs(eps), x) / -2.0)))))));
}
function code(x, eps) t_0 = Float64(-1.0 - abs(eps)) return Float64(0.5 * Float64(exp(Float64(-Float64(x * Float64(1.0 - abs(eps))))) - Float64(-1.0 * Float64(sqrt(sqrt(exp(Float64(t_0 * x)))) * sqrt(exp(fma(t_0, x, Float64(fma(x, abs(eps), x) / -2.0)))))))) end
code[x_, eps_] := Block[{t$95$0 = N[(-1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision]}, N[(0.5 * N[(N[Exp[(-N[(x * N[(1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[Sqrt[N[Exp[N[(t$95$0 * x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Exp[N[(t$95$0 * x + N[(N[(x * N[Abs[eps], $MachinePrecision] + x), $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := -1 - \left|\varepsilon\right|\\
0.5 \cdot \left(e^{-x \cdot \left(1 - \left|\varepsilon\right|\right)} - -1 \cdot \left(\sqrt{\sqrt{e^{t\_0 \cdot x}}} \cdot \sqrt{e^{\mathsf{fma}\left(t\_0, x, \frac{\mathsf{fma}\left(x, \left|\varepsilon\right|, x\right)}{-2}\right)}}\right)\right)
\end{array}
Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Applied rewrites99.0%
(FPCore (x eps) :precision binary64 (* 0.5 (- (exp (- (* x (- 1.0 eps)))) (* -1.0 (exp (- (* x (+ 1.0 eps))))))))
double code(double x, double eps) {
return 0.5 * (exp(-(x * (1.0 - eps))) - (-1.0 * exp(-(x * (1.0 + eps)))));
}
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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.5d0 * (exp(-(x * (1.0d0 - eps))) - ((-1.0d0) * exp(-(x * (1.0d0 + eps)))))
end function
public static double code(double x, double eps) {
return 0.5 * (Math.exp(-(x * (1.0 - eps))) - (-1.0 * Math.exp(-(x * (1.0 + eps)))));
}
def code(x, eps): return 0.5 * (math.exp(-(x * (1.0 - eps))) - (-1.0 * math.exp(-(x * (1.0 + eps)))))
function code(x, eps) return Float64(0.5 * Float64(exp(Float64(-Float64(x * Float64(1.0 - eps)))) - Float64(-1.0 * exp(Float64(-Float64(x * Float64(1.0 + eps))))))) end
function tmp = code(x, eps) tmp = 0.5 * (exp(-(x * (1.0 - eps))) - (-1.0 * exp(-(x * (1.0 + eps))))); end
code[x_, eps_] := N[(0.5 * N[(N[Exp[(-N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] - N[(-1.0 * N[Exp[(-N[(x * N[(1.0 + eps), $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1 \cdot e^{-x \cdot \left(1 + \varepsilon\right)}\right)
Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -2.5e+44)
(* 0.5 (- t_0 -1.0))
(if (<= x -4e-300)
(*
(+ (exp (* (- -1.0 (fabs eps)) x)) (fma (- (fabs eps) 1.0) x 1.0))
0.5)
(if (<= x 1.08e+257)
(* 0.5 (- (exp (* (fabs eps) x)) -1.0))
(* 0.5 (- t_0 (* -1.0 t_0))))))))double code(double x, double eps) {
double t_0 = exp(-x);
double tmp;
if (x <= -2.5e+44) {
tmp = 0.5 * (t_0 - -1.0);
} else if (x <= -4e-300) {
tmp = (exp(((-1.0 - fabs(eps)) * x)) + fma((fabs(eps) - 1.0), x, 1.0)) * 0.5;
} else if (x <= 1.08e+257) {
tmp = 0.5 * (exp((fabs(eps) * x)) - -1.0);
} else {
tmp = 0.5 * (t_0 - (-1.0 * t_0));
}
return tmp;
}
function code(x, eps) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -2.5e+44) tmp = Float64(0.5 * Float64(t_0 - -1.0)); elseif (x <= -4e-300) tmp = Float64(Float64(exp(Float64(Float64(-1.0 - abs(eps)) * x)) + fma(Float64(abs(eps) - 1.0), x, 1.0)) * 0.5); elseif (x <= 1.08e+257) tmp = Float64(0.5 * Float64(exp(Float64(abs(eps) * x)) - -1.0)); else tmp = Float64(0.5 * Float64(t_0 - Float64(-1.0 * t_0))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -2.5e+44], N[(0.5 * N[(t$95$0 - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4e-300], N[(N[(N[Exp[N[(N[(-1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Abs[eps], $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 1.08e+257], N[(0.5 * N[(N[Exp[N[(N[Abs[eps], $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(t$95$0 - N[(-1.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(t\_0 - -1\right)\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-300}:\\
\;\;\;\;\left(e^{\left(-1 - \left|\varepsilon\right|\right) \cdot x} + \mathsf{fma}\left(\left|\varepsilon\right| - 1, x, 1\right)\right) \cdot 0.5\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+257}:\\
\;\;\;\;0.5 \cdot \left(e^{\left|\varepsilon\right| \cdot x} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(t\_0 - -1 \cdot t\_0\right)\\
\end{array}
if x < -2.4999999999999998e44Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around 0
lower-exp.f64N/A
lower-neg.f6456.6%
Applied rewrites56.6%
if -2.4999999999999998e44 < x < -4.0000000000000001e-300Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6464.0%
Applied rewrites64.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.0%
Applied rewrites64.0%
if -4.0000000000000001e-300 < x < 1.07999999999999998e257Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around inf
lower-*.f6464.2%
Applied rewrites64.2%
if 1.07999999999999998e257 < x Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in eps around 0
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f6470.5%
Applied rewrites70.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs eps))))
(if (<= x -2.5e+44)
(* 0.5 (- (exp (- x)) -1.0))
(if (<= x -4e-300)
(*
(+ (exp (* (- -1.0 (fabs eps)) x)) (fma (- (fabs eps) 1.0) x 1.0))
0.5)
(if (<= x 1.08e+257)
(* 0.5 (- (exp (* (fabs eps) x)) -1.0))
(/ (- (+ 1.0 t_0) (- t_0 1.0)) 2.0))))))double code(double x, double eps) {
double t_0 = 1.0 / fabs(eps);
double tmp;
if (x <= -2.5e+44) {
tmp = 0.5 * (exp(-x) - -1.0);
} else if (x <= -4e-300) {
tmp = (exp(((-1.0 - fabs(eps)) * x)) + fma((fabs(eps) - 1.0), x, 1.0)) * 0.5;
} else if (x <= 1.08e+257) {
tmp = 0.5 * (exp((fabs(eps) * x)) - -1.0);
} else {
tmp = ((1.0 + t_0) - (t_0 - 1.0)) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(1.0 / abs(eps)) tmp = 0.0 if (x <= -2.5e+44) tmp = Float64(0.5 * Float64(exp(Float64(-x)) - -1.0)); elseif (x <= -4e-300) tmp = Float64(Float64(exp(Float64(Float64(-1.0 - abs(eps)) * x)) + fma(Float64(abs(eps) - 1.0), x, 1.0)) * 0.5); elseif (x <= 1.08e+257) tmp = Float64(0.5 * Float64(exp(Float64(abs(eps) * x)) - -1.0)); else tmp = Float64(Float64(Float64(1.0 + t_0) - Float64(t_0 - 1.0)) / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 / N[Abs[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e+44], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4e-300], N[(N[(N[Exp[N[(N[(-1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Abs[eps], $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 1.08e+257], N[(0.5 * N[(N[Exp[N[(N[Abs[eps], $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$0), $MachinePrecision] - N[(t$95$0 - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{1}{\left|\varepsilon\right|}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(e^{-x} - -1\right)\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-300}:\\
\;\;\;\;\left(e^{\left(-1 - \left|\varepsilon\right|\right) \cdot x} + \mathsf{fma}\left(\left|\varepsilon\right| - 1, x, 1\right)\right) \cdot 0.5\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+257}:\\
\;\;\;\;0.5 \cdot \left(e^{\left|\varepsilon\right| \cdot x} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + t\_0\right) - \left(t\_0 - 1\right)}{2}\\
\end{array}
if x < -2.4999999999999998e44Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around 0
lower-exp.f64N/A
lower-neg.f6456.6%
Applied rewrites56.6%
if -2.4999999999999998e44 < x < -4.0000000000000001e-300Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6464.0%
Applied rewrites64.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.0%
Applied rewrites64.0%
if -4.0000000000000001e-300 < x < 1.07999999999999998e257Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around inf
lower-*.f6464.2%
Applied rewrites64.2%
if 1.07999999999999998e257 < x Initial program 74.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f6439.2%
Applied rewrites39.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-/.f6431.9%
Applied rewrites31.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs eps))))
(if (<= x -4e-300)
(* 0.5 (- (exp (- x)) -1.0))
(if (<= x 1.08e+257)
(* 0.5 (- (exp (* (fabs eps) x)) -1.0))
(/ (- (+ 1.0 t_0) (- t_0 1.0)) 2.0)))))double code(double x, double eps) {
double t_0 = 1.0 / fabs(eps);
double tmp;
if (x <= -4e-300) {
tmp = 0.5 * (exp(-x) - -1.0);
} else if (x <= 1.08e+257) {
tmp = 0.5 * (exp((fabs(eps) * x)) - -1.0);
} else {
tmp = ((1.0 + t_0) - (t_0 - 1.0)) / 2.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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / abs(eps)
if (x <= (-4d-300)) then
tmp = 0.5d0 * (exp(-x) - (-1.0d0))
else if (x <= 1.08d+257) then
tmp = 0.5d0 * (exp((abs(eps) * x)) - (-1.0d0))
else
tmp = ((1.0d0 + t_0) - (t_0 - 1.0d0)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 1.0 / Math.abs(eps);
double tmp;
if (x <= -4e-300) {
tmp = 0.5 * (Math.exp(-x) - -1.0);
} else if (x <= 1.08e+257) {
tmp = 0.5 * (Math.exp((Math.abs(eps) * x)) - -1.0);
} else {
tmp = ((1.0 + t_0) - (t_0 - 1.0)) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = 1.0 / math.fabs(eps) tmp = 0 if x <= -4e-300: tmp = 0.5 * (math.exp(-x) - -1.0) elif x <= 1.08e+257: tmp = 0.5 * (math.exp((math.fabs(eps) * x)) - -1.0) else: tmp = ((1.0 + t_0) - (t_0 - 1.0)) / 2.0 return tmp
function code(x, eps) t_0 = Float64(1.0 / abs(eps)) tmp = 0.0 if (x <= -4e-300) tmp = Float64(0.5 * Float64(exp(Float64(-x)) - -1.0)); elseif (x <= 1.08e+257) tmp = Float64(0.5 * Float64(exp(Float64(abs(eps) * x)) - -1.0)); else tmp = Float64(Float64(Float64(1.0 + t_0) - Float64(t_0 - 1.0)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = 1.0 / abs(eps); tmp = 0.0; if (x <= -4e-300) tmp = 0.5 * (exp(-x) - -1.0); elseif (x <= 1.08e+257) tmp = 0.5 * (exp((abs(eps) * x)) - -1.0); else tmp = ((1.0 + t_0) - (t_0 - 1.0)) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 / N[Abs[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e-300], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.08e+257], N[(0.5 * N[(N[Exp[N[(N[Abs[eps], $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$0), $MachinePrecision] - N[(t$95$0 - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{1}{\left|\varepsilon\right|}\\
\mathbf{if}\;x \leq -4 \cdot 10^{-300}:\\
\;\;\;\;0.5 \cdot \left(e^{-x} - -1\right)\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+257}:\\
\;\;\;\;0.5 \cdot \left(e^{\left|\varepsilon\right| \cdot x} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + t\_0\right) - \left(t\_0 - 1\right)}{2}\\
\end{array}
if x < -4.0000000000000001e-300Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around 0
lower-exp.f64N/A
lower-neg.f6456.6%
Applied rewrites56.6%
if -4.0000000000000001e-300 < x < 1.07999999999999998e257Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around inf
lower-*.f6464.2%
Applied rewrites64.2%
if 1.07999999999999998e257 < x Initial program 74.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f6439.2%
Applied rewrites39.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-/.f6431.9%
Applied rewrites31.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (- (+ 1.0 (/ 1.0 eps)) (- (/ 1.0 eps) 1.0)) 2.0)))
(if (<= x 3e-9)
(* 0.5 (- (exp (- x)) -1.0))
(if (<= x 1.35e+158)
t_0
(if (<= x 1.08e+257)
(* 0.5 (- (+ 1.0 (* x (- (* 0.5 x) 1.0))) -1.0))
t_0)))))double code(double x, double eps) {
double t_0 = ((1.0 + (1.0 / eps)) - ((1.0 / eps) - 1.0)) / 2.0;
double tmp;
if (x <= 3e-9) {
tmp = 0.5 * (exp(-x) - -1.0);
} else if (x <= 1.35e+158) {
tmp = t_0;
} else if (x <= 1.08e+257) {
tmp = 0.5 * ((1.0 + (x * ((0.5 * x) - 1.0))) - -1.0);
} else {
tmp = 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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = ((1.0d0 + (1.0d0 / eps)) - ((1.0d0 / eps) - 1.0d0)) / 2.0d0
if (x <= 3d-9) then
tmp = 0.5d0 * (exp(-x) - (-1.0d0))
else if (x <= 1.35d+158) then
tmp = t_0
else if (x <= 1.08d+257) then
tmp = 0.5d0 * ((1.0d0 + (x * ((0.5d0 * x) - 1.0d0))) - (-1.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = ((1.0 + (1.0 / eps)) - ((1.0 / eps) - 1.0)) / 2.0;
double tmp;
if (x <= 3e-9) {
tmp = 0.5 * (Math.exp(-x) - -1.0);
} else if (x <= 1.35e+158) {
tmp = t_0;
} else if (x <= 1.08e+257) {
tmp = 0.5 * ((1.0 + (x * ((0.5 * x) - 1.0))) - -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = ((1.0 + (1.0 / eps)) - ((1.0 / eps) - 1.0)) / 2.0 tmp = 0 if x <= 3e-9: tmp = 0.5 * (math.exp(-x) - -1.0) elif x <= 1.35e+158: tmp = t_0 elif x <= 1.08e+257: tmp = 0.5 * ((1.0 + (x * ((0.5 * x) - 1.0))) - -1.0) else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) - Float64(Float64(1.0 / eps) - 1.0)) / 2.0) tmp = 0.0 if (x <= 3e-9) tmp = Float64(0.5 * Float64(exp(Float64(-x)) - -1.0)); elseif (x <= 1.35e+158) tmp = t_0; elseif (x <= 1.08e+257) tmp = Float64(0.5 * Float64(Float64(1.0 + Float64(x * Float64(Float64(0.5 * x) - 1.0))) - -1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = ((1.0 + (1.0 / eps)) - ((1.0 / eps) - 1.0)) / 2.0; tmp = 0.0; if (x <= 3e-9) tmp = 0.5 * (exp(-x) - -1.0); elseif (x <= 1.35e+158) tmp = t_0; elseif (x <= 1.08e+257) tmp = 0.5 * ((1.0 + (x * ((0.5 * x) - 1.0))) - -1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, 3e-9], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35e+158], t$95$0, If[LessEqual[x, 1.08e+257], N[(0.5 * N[(N[(1.0 + N[(x * N[(N[(0.5 * x), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{\left(1 + \frac{1}{\varepsilon}\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2}\\
\mathbf{if}\;x \leq 3 \cdot 10^{-9}:\\
\;\;\;\;0.5 \cdot \left(e^{-x} - -1\right)\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+257}:\\
\;\;\;\;0.5 \cdot \left(\left(1 + x \cdot \left(0.5 \cdot x - 1\right)\right) - -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < 2.99999999999999998e-9Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around 0
lower-exp.f64N/A
lower-neg.f6456.6%
Applied rewrites56.6%
if 2.99999999999999998e-9 < x < 1.34999999999999989e158 or 1.07999999999999998e257 < x Initial program 74.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f6439.2%
Applied rewrites39.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-/.f6431.9%
Applied rewrites31.9%
if 1.34999999999999989e158 < x < 1.07999999999999998e257Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around 0
lower-exp.f64N/A
lower-neg.f6456.6%
Applied rewrites56.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6456.8%
Applied rewrites56.8%
(FPCore (x eps)
:precision binary64
(if (<= x 1.3e-229)
(* 0.5 (- (exp (- x)) -1.0))
(if (<= x 1.9e+154)
(* 0.5 (- (+ 1.0 (* x (- (fabs eps) 1.0))) -1.0))
(* 0.5 (- (+ 1.0 (* x (- (* 0.5 x) 1.0))) -1.0)))))double code(double x, double eps) {
double tmp;
if (x <= 1.3e-229) {
tmp = 0.5 * (exp(-x) - -1.0);
} else if (x <= 1.9e+154) {
tmp = 0.5 * ((1.0 + (x * (fabs(eps) - 1.0))) - -1.0);
} else {
tmp = 0.5 * ((1.0 + (x * ((0.5 * x) - 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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1.3d-229) then
tmp = 0.5d0 * (exp(-x) - (-1.0d0))
else if (x <= 1.9d+154) then
tmp = 0.5d0 * ((1.0d0 + (x * (abs(eps) - 1.0d0))) - (-1.0d0))
else
tmp = 0.5d0 * ((1.0d0 + (x * ((0.5d0 * x) - 1.0d0))) - (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1.3e-229) {
tmp = 0.5 * (Math.exp(-x) - -1.0);
} else if (x <= 1.9e+154) {
tmp = 0.5 * ((1.0 + (x * (Math.abs(eps) - 1.0))) - -1.0);
} else {
tmp = 0.5 * ((1.0 + (x * ((0.5 * x) - 1.0))) - -1.0);
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.3e-229: tmp = 0.5 * (math.exp(-x) - -1.0) elif x <= 1.9e+154: tmp = 0.5 * ((1.0 + (x * (math.fabs(eps) - 1.0))) - -1.0) else: tmp = 0.5 * ((1.0 + (x * ((0.5 * x) - 1.0))) - -1.0) return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.3e-229) tmp = Float64(0.5 * Float64(exp(Float64(-x)) - -1.0)); elseif (x <= 1.9e+154) tmp = Float64(0.5 * Float64(Float64(1.0 + Float64(x * Float64(abs(eps) - 1.0))) - -1.0)); else tmp = Float64(0.5 * Float64(Float64(1.0 + Float64(x * Float64(Float64(0.5 * x) - 1.0))) - -1.0)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.3e-229) tmp = 0.5 * (exp(-x) - -1.0); elseif (x <= 1.9e+154) tmp = 0.5 * ((1.0 + (x * (abs(eps) - 1.0))) - -1.0); else tmp = 0.5 * ((1.0 + (x * ((0.5 * x) - 1.0))) - -1.0); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.3e-229], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e+154], N[(0.5 * N[(N[(1.0 + N[(x * N[(N[Abs[eps], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(1.0 + N[(x * N[(N[(0.5 * x), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{-229}:\\
\;\;\;\;0.5 \cdot \left(e^{-x} - -1\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot \left(\left(1 + x \cdot \left(\left|\varepsilon\right| - 1\right)\right) - -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(1 + x \cdot \left(0.5 \cdot x - 1\right)\right) - -1\right)\\
\end{array}
if x < 1.3000000000000001e-229Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around 0
lower-exp.f64N/A
lower-neg.f6456.6%
Applied rewrites56.6%
if 1.3000000000000001e-229 < x < 1.8999999999999999e154Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6449.5%
Applied rewrites49.5%
if 1.8999999999999999e154 < x Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around 0
lower-exp.f64N/A
lower-neg.f6456.6%
Applied rewrites56.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6456.8%
Applied rewrites56.8%
(FPCore (x eps) :precision binary64 (if (<= x 1.3e-229) (* 0.5 (- (exp (- x)) -1.0)) (* 0.5 (- (+ 1.0 (* x (- (fabs eps) 1.0))) -1.0))))
double code(double x, double eps) {
double tmp;
if (x <= 1.3e-229) {
tmp = 0.5 * (exp(-x) - -1.0);
} else {
tmp = 0.5 * ((1.0 + (x * (fabs(eps) - 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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1.3d-229) then
tmp = 0.5d0 * (exp(-x) - (-1.0d0))
else
tmp = 0.5d0 * ((1.0d0 + (x * (abs(eps) - 1.0d0))) - (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1.3e-229) {
tmp = 0.5 * (Math.exp(-x) - -1.0);
} else {
tmp = 0.5 * ((1.0 + (x * (Math.abs(eps) - 1.0))) - -1.0);
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.3e-229: tmp = 0.5 * (math.exp(-x) - -1.0) else: tmp = 0.5 * ((1.0 + (x * (math.fabs(eps) - 1.0))) - -1.0) return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.3e-229) tmp = Float64(0.5 * Float64(exp(Float64(-x)) - -1.0)); else tmp = Float64(0.5 * Float64(Float64(1.0 + Float64(x * Float64(abs(eps) - 1.0))) - -1.0)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.3e-229) tmp = 0.5 * (exp(-x) - -1.0); else tmp = 0.5 * ((1.0 + (x * (abs(eps) - 1.0))) - -1.0); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.3e-229], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(1.0 + N[(x * N[(N[Abs[eps], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{-229}:\\
\;\;\;\;0.5 \cdot \left(e^{-x} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(1 + x \cdot \left(\left|\varepsilon\right| - 1\right)\right) - -1\right)\\
\end{array}
if x < 1.3000000000000001e-229Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in eps around 0
lower-exp.f64N/A
lower-neg.f6456.6%
Applied rewrites56.6%
if 1.3000000000000001e-229 < x Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6449.5%
Applied rewrites49.5%
(FPCore (x eps) :precision binary64 (if (<= x 1.3e-229) (/ (- (* 1.0 1.0) (* x x)) (+ 1.0 x)) (* 0.5 (- (+ 1.0 (* x (- (fabs eps) 1.0))) -1.0))))
double code(double x, double eps) {
double tmp;
if (x <= 1.3e-229) {
tmp = ((1.0 * 1.0) - (x * x)) / (1.0 + x);
} else {
tmp = 0.5 * ((1.0 + (x * (fabs(eps) - 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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1.3d-229) then
tmp = ((1.0d0 * 1.0d0) - (x * x)) / (1.0d0 + x)
else
tmp = 0.5d0 * ((1.0d0 + (x * (abs(eps) - 1.0d0))) - (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1.3e-229) {
tmp = ((1.0 * 1.0) - (x * x)) / (1.0 + x);
} else {
tmp = 0.5 * ((1.0 + (x * (Math.abs(eps) - 1.0))) - -1.0);
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.3e-229: tmp = ((1.0 * 1.0) - (x * x)) / (1.0 + x) else: tmp = 0.5 * ((1.0 + (x * (math.fabs(eps) - 1.0))) - -1.0) return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.3e-229) tmp = Float64(Float64(Float64(1.0 * 1.0) - Float64(x * x)) / Float64(1.0 + x)); else tmp = Float64(0.5 * Float64(Float64(1.0 + Float64(x * Float64(abs(eps) - 1.0))) - -1.0)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.3e-229) tmp = ((1.0 * 1.0) - (x * x)) / (1.0 + x); else tmp = 0.5 * ((1.0 + (x * (abs(eps) - 1.0))) - -1.0); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.3e-229], N[(N[(N[(1.0 * 1.0), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(1.0 + N[(x * N[(N[Abs[eps], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{-229}:\\
\;\;\;\;\frac{1 \cdot 1 - x \cdot x}{1 + x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(1 + x \cdot \left(\left|\varepsilon\right| - 1\right)\right) - -1\right)\\
\end{array}
if x < 1.3000000000000001e-229Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6443.0%
Applied rewrites43.0%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
flip--N/A
lower-unsound-/.f64N/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-*.f64N/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-*.f64N/A
mul-1-negN/A
remove-double-negN/A
lower-unsound-+.f6449.1%
Applied rewrites49.1%
if 1.3000000000000001e-229 < x Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6449.5%
Applied rewrites49.5%
(FPCore (x eps) :precision binary64 (if (<= x 1.3e-229) (- 1.0 x) (* 0.5 (- (+ 1.0 (* x (- (fabs eps) 1.0))) -1.0))))
double code(double x, double eps) {
double tmp;
if (x <= 1.3e-229) {
tmp = 1.0 - x;
} else {
tmp = 0.5 * ((1.0 + (x * (fabs(eps) - 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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1.3d-229) then
tmp = 1.0d0 - x
else
tmp = 0.5d0 * ((1.0d0 + (x * (abs(eps) - 1.0d0))) - (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1.3e-229) {
tmp = 1.0 - x;
} else {
tmp = 0.5 * ((1.0 + (x * (Math.abs(eps) - 1.0))) - -1.0);
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.3e-229: tmp = 1.0 - x else: tmp = 0.5 * ((1.0 + (x * (math.fabs(eps) - 1.0))) - -1.0) return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.3e-229) tmp = Float64(1.0 - x); else tmp = Float64(0.5 * Float64(Float64(1.0 + Float64(x * Float64(abs(eps) - 1.0))) - -1.0)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.3e-229) tmp = 1.0 - x; else tmp = 0.5 * ((1.0 + (x * (abs(eps) - 1.0))) - -1.0); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.3e-229], N[(1.0 - x), $MachinePrecision], N[(0.5 * N[(N[(1.0 + N[(x * N[(N[Abs[eps], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{-229}:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(1 + x \cdot \left(\left|\varepsilon\right| - 1\right)\right) - -1\right)\\
\end{array}
if x < 1.3000000000000001e-229Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6443.0%
Applied rewrites43.0%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6443.0%
Applied rewrites43.0%
if 1.3000000000000001e-229 < x Initial program 74.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-+.f6499.0%
Applied rewrites99.0%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6449.5%
Applied rewrites49.5%
(FPCore (x eps) :precision binary64 1.0)
double code(double x, double eps) {
return 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, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 1.0d0
end function
public static double code(double x, double eps) {
return 1.0;
}
def code(x, eps): return 1.0
function code(x, eps) return 1.0 end
function tmp = code(x, eps) tmp = 1.0; end
code[x_, eps_] := 1.0
1
Initial program 74.4%
Taylor expanded in x around 0
Applied rewrites43.6%
herbie shell --seed 2025188
(FPCore (x eps)
:name "NMSE Section 6.1 mentioned, A"
:precision binary64
(/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))