
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
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, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
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, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
(FPCore (x y z t a b) :precision binary64 (* x (exp (fma (- a) b (fma (fma (* a z) -0.5 (- a)) z (* (- (log z) t) y))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(-a, b, fma(fma((a * z), -0.5, -a), z, ((log(z) - t) * y))));
}
function code(x, y, z, t, a, b) return Float64(x * exp(fma(Float64(-a), b, fma(fma(Float64(a * z), -0.5, Float64(-a)), z, Float64(Float64(log(z) - t) * y))))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[((-a) * b + N[(N[(N[(a * z), $MachinePrecision] * -0.5 + (-a)), $MachinePrecision] * z + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\mathsf{fma}\left(-a, b, \mathsf{fma}\left(\mathsf{fma}\left(a \cdot z, -0.5, -a\right), z, \left(\log z - t\right) \cdot y\right)\right)}
\end{array}
Initial program 96.7%
Taylor expanded in z around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.6
Applied rewrites99.6%
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (* (- (* -0.5 z) 1.0) z) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * ((((-0.5 * z) - 1.0) * z) - b))));
}
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, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (((((-0.5d0) * z) - 1.0d0) * z) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * ((((-0.5 * z) - 1.0) * z) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * ((((-0.5 * z) - 1.0) * z) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(Float64(Float64(Float64(-0.5 * z) - 1.0) * z) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * ((((-0.5 * z) - 1.0) * z) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(N[(N[(-0.5 * z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(-0.5 \cdot z - 1\right) \cdot z - b\right)}
\end{array}
Initial program 96.7%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.3
Applied rewrites99.3%
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (- z) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (-z - b))));
}
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, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (-z - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (-z - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (-z - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(Float64(-z) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (-z - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(-z\right) - b\right)}
\end{array}
Initial program 96.7%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6499.3
Applied rewrites99.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- (log z) t) y)) x)))
(if (<= y -7.5e-11)
t_1
(if (<= y 2.2e-6) (* x (exp (* (- a) (fma (fma 0.5 z 1.0) z b)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(((log(z) - t) * y)) * x;
double tmp;
if (y <= -7.5e-11) {
tmp = t_1;
} else if (y <= 2.2e-6) {
tmp = x * exp((-a * fma(fma(0.5, z, 1.0), z, b)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(log(z) - t) * y)) * x) tmp = 0.0 if (y <= -7.5e-11) tmp = t_1; elseif (y <= 2.2e-6) tmp = Float64(x * exp(Float64(Float64(-a) * fma(fma(0.5, z, 1.0), z, b)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -7.5e-11], t$95$1, If[LessEqual[y, 2.2e-6], N[(x * N[Exp[N[((-a) * N[(N[(0.5 * z + 1.0), $MachinePrecision] * z + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(\log z - t\right) \cdot y} \cdot x\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.5, z, 1\right), z, b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.5e-11 or 2.2000000000000001e-6 < y Initial program 97.9%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6488.6
Applied rewrites88.6%
if -7.5e-11 < y < 2.2000000000000001e-6Initial program 95.4%
Taylor expanded in z around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6499.9
Applied rewrites99.9%
Taylor expanded in a around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6486.8
Applied rewrites86.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- (log z) t) y)) x)))
(if (<= y -7.5e-11)
t_1
(if (<= y 2.2e-6) (* (exp (* (- (- z) b) a)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(((log(z) - t) * y)) * x;
double tmp;
if (y <= -7.5e-11) {
tmp = t_1;
} else if (y <= 2.2e-6) {
tmp = exp(((-z - b) * a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = exp(((log(z) - t) * y)) * x
if (y <= (-7.5d-11)) then
tmp = t_1
else if (y <= 2.2d-6) then
tmp = exp(((-z - b) * a)) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.exp(((Math.log(z) - t) * y)) * x;
double tmp;
if (y <= -7.5e-11) {
tmp = t_1;
} else if (y <= 2.2e-6) {
tmp = Math.exp(((-z - b) * a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp(((math.log(z) - t) * y)) * x tmp = 0 if y <= -7.5e-11: tmp = t_1 elif y <= 2.2e-6: tmp = math.exp(((-z - b) * a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(log(z) - t) * y)) * x) tmp = 0.0 if (y <= -7.5e-11) tmp = t_1; elseif (y <= 2.2e-6) tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp(((log(z) - t) * y)) * x; tmp = 0.0; if (y <= -7.5e-11) tmp = t_1; elseif (y <= 2.2e-6) tmp = exp(((-z - b) * a)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -7.5e-11], t$95$1, If[LessEqual[y, 2.2e-6], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(\log z - t\right) \cdot y} \cdot x\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.5e-11 or 2.2000000000000001e-6 < y Initial program 97.9%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6488.6
Applied rewrites88.6%
if -7.5e-11 < y < 2.2000000000000001e-6Initial program 95.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6481.9
Applied rewrites81.9%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6486.8
Applied rewrites86.8%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.36e+122) (* (exp (* (- t) y)) x) (if (<= y 2.55e+101) (* (exp (* (- (- z) b) a)) x) (* (pow z y) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.36e+122) {
tmp = exp((-t * y)) * x;
} else if (y <= 2.55e+101) {
tmp = exp(((-z - b) * a)) * x;
} else {
tmp = pow(z, y) * 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, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y <= (-1.36d+122)) then
tmp = exp((-t * y)) * x
else if (y <= 2.55d+101) then
tmp = exp(((-z - b) * a)) * x
else
tmp = (z ** y) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.36e+122) {
tmp = Math.exp((-t * y)) * x;
} else if (y <= 2.55e+101) {
tmp = Math.exp(((-z - b) * a)) * x;
} else {
tmp = Math.pow(z, y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.36e+122: tmp = math.exp((-t * y)) * x elif y <= 2.55e+101: tmp = math.exp(((-z - b) * a)) * x else: tmp = math.pow(z, y) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.36e+122) tmp = Float64(exp(Float64(Float64(-t) * y)) * x); elseif (y <= 2.55e+101) tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x); else tmp = Float64((z ^ y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.36e+122) tmp = exp((-t * y)) * x; elseif (y <= 2.55e+101) tmp = exp(((-z - b) * a)) * x; else tmp = (z ^ y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.36e+122], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 2.55e+101], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.36 \cdot 10^{+122}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{+101}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;{z}^{y} \cdot x\\
\end{array}
\end{array}
if y < -1.36000000000000004e122Initial program 97.7%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6466.6
Applied rewrites66.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.6
Applied rewrites66.6%
if -1.36000000000000004e122 < y < 2.54999999999999997e101Initial program 96.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6470.5
Applied rewrites70.5%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6475.0
Applied rewrites75.0%
if 2.54999999999999997e101 < y Initial program 98.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6492.9
Applied rewrites92.9%
Taylor expanded in t around 0
lower-pow.f6470.7
Applied rewrites70.7%
(FPCore (x y z t a b) :precision binary64 (if (<= y -7.5e+53) (* (exp (* (- t) y)) x) (if (<= y 4.2e+15) (* (exp (* (- a) b)) x) (* (pow z y) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7.5e+53) {
tmp = exp((-t * y)) * x;
} else if (y <= 4.2e+15) {
tmp = exp((-a * b)) * x;
} else {
tmp = pow(z, y) * 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, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y <= (-7.5d+53)) then
tmp = exp((-t * y)) * x
else if (y <= 4.2d+15) then
tmp = exp((-a * b)) * x
else
tmp = (z ** y) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7.5e+53) {
tmp = Math.exp((-t * y)) * x;
} else if (y <= 4.2e+15) {
tmp = Math.exp((-a * b)) * x;
} else {
tmp = Math.pow(z, y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -7.5e+53: tmp = math.exp((-t * y)) * x elif y <= 4.2e+15: tmp = math.exp((-a * b)) * x else: tmp = math.pow(z, y) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -7.5e+53) tmp = Float64(exp(Float64(Float64(-t) * y)) * x); elseif (y <= 4.2e+15) tmp = Float64(exp(Float64(Float64(-a) * b)) * x); else tmp = Float64((z ^ y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -7.5e+53) tmp = exp((-t * y)) * x; elseif (y <= 4.2e+15) tmp = exp((-a * b)) * x; else tmp = (z ^ y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -7.5e+53], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 4.2e+15], N[(N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+53}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+15}:\\
\;\;\;\;e^{\left(-a\right) \cdot b} \cdot x\\
\mathbf{else}:\\
\;\;\;\;{z}^{y} \cdot x\\
\end{array}
\end{array}
if y < -7.4999999999999997e53Initial program 98.0%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6464.3
Applied rewrites64.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6464.3
Applied rewrites64.3%
if -7.4999999999999997e53 < y < 4.2e15Initial program 95.6%
Taylor expanded in b around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6476.5
Applied rewrites76.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.5
Applied rewrites76.5%
if 4.2e15 < y Initial program 98.1%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6489.6
Applied rewrites89.6%
Taylor expanded in t around 0
lower-pow.f6469.4
Applied rewrites69.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (* (- t) y)) x))) (if (<= t -6e+21) t_1 (if (<= t 1.7e-25) (* (exp (* (- a) b)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((-t * y)) * x;
double tmp;
if (t <= -6e+21) {
tmp = t_1;
} else if (t <= 1.7e-25) {
tmp = exp((-a * b)) * x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = exp((-t * y)) * x
if (t <= (-6d+21)) then
tmp = t_1
else if (t <= 1.7d-25) then
tmp = exp((-a * b)) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.exp((-t * y)) * x;
double tmp;
if (t <= -6e+21) {
tmp = t_1;
} else if (t <= 1.7e-25) {
tmp = Math.exp((-a * b)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp((-t * y)) * x tmp = 0 if t <= -6e+21: tmp = t_1 elif t <= 1.7e-25: tmp = math.exp((-a * b)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(-t) * y)) * x) tmp = 0.0 if (t <= -6e+21) tmp = t_1; elseif (t <= 1.7e-25) tmp = Float64(exp(Float64(Float64(-a) * b)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp((-t * y)) * x; tmp = 0.0; if (t <= -6e+21) tmp = t_1; elseif (t <= 1.7e-25) tmp = exp((-a * b)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -6e+21], t$95$1, If[LessEqual[t, 1.7e-25], N[(N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{if}\;t \leq -6 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-25}:\\
\;\;\;\;e^{\left(-a\right) \cdot b} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6e21 or 1.70000000000000001e-25 < t Initial program 96.8%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.7
Applied rewrites77.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.7
Applied rewrites77.7%
if -6e21 < t < 1.70000000000000001e-25Initial program 96.7%
Taylor expanded in b around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6466.9
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.9
Applied rewrites66.9%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.62e+112) (* (* (- (log z) t) y) x) (* (exp (* (- a) b)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.62e+112) {
tmp = ((log(z) - t) * y) * x;
} else {
tmp = exp((-a * b)) * 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, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y <= (-1.62d+112)) then
tmp = ((log(z) - t) * y) * x
else
tmp = exp((-a * b)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.62e+112) {
tmp = ((Math.log(z) - t) * y) * x;
} else {
tmp = Math.exp((-a * b)) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.62e+112: tmp = ((math.log(z) - t) * y) * x else: tmp = math.exp((-a * b)) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.62e+112) tmp = Float64(Float64(Float64(log(z) - t) * y) * x); else tmp = Float64(exp(Float64(Float64(-a) * b)) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.62e+112) tmp = ((log(z) - t) * y) * x; else tmp = exp((-a * b)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.62e+112], N[(N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision] * x), $MachinePrecision], N[(N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.62 \cdot 10^{+112}:\\
\;\;\;\;\left(\left(\log z - t\right) \cdot y\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-a\right) \cdot b} \cdot x\\
\end{array}
\end{array}
if y < -1.61999999999999994e112Initial program 97.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6491.8
Applied rewrites91.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6438.0
Applied rewrites38.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6438.0
Applied rewrites38.0%
if -1.61999999999999994e112 < y Initial program 96.5%
Taylor expanded in b around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6462.9
Applied rewrites62.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.9
Applied rewrites62.9%
(FPCore (x y z t a b) :precision binary64 (if (<= y -5e+38) (* (* (- (log z) t) y) x) (if (<= y 1.8e-39) (* (fma (- (- z) b) a 1.0) x) (* (* (- a) b) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -5e+38) {
tmp = ((log(z) - t) * y) * x;
} else if (y <= 1.8e-39) {
tmp = fma((-z - b), a, 1.0) * x;
} else {
tmp = (-a * b) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -5e+38) tmp = Float64(Float64(Float64(log(z) - t) * y) * x); elseif (y <= 1.8e-39) tmp = Float64(fma(Float64(Float64(-z) - b), a, 1.0) * x); else tmp = Float64(Float64(Float64(-a) * b) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -5e+38], N[(N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 1.8e-39], N[(N[(N[((-z) - b), $MachinePrecision] * a + 1.0), $MachinePrecision] * x), $MachinePrecision], N[(N[((-a) * b), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+38}:\\
\;\;\;\;\left(\left(\log z - t\right) \cdot y\right) \cdot x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(\left(-z\right) - b, a, 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-a\right) \cdot b\right) \cdot x\\
\end{array}
\end{array}
if y < -4.9999999999999997e38Initial program 98.1%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6490.4
Applied rewrites90.4%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6433.1
Applied rewrites33.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6433.1
Applied rewrites33.1%
if -4.9999999999999997e38 < y < 1.8e-39Initial program 95.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6479.7
Applied rewrites79.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6442.8
Applied rewrites42.8%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6443.4
Applied rewrites43.4%
if 1.8e-39 < y Initial program 98.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6440.4
Applied rewrites40.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6413.4
Applied rewrites13.4%
Taylor expanded in b around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6425.3
Applied rewrites25.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1e+109) (* (* (log z) y) x) (if (<= y 1.8e-39) (* (fma (- (- z) b) a 1.0) x) (* (* (- a) b) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1e+109) {
tmp = (log(z) * y) * x;
} else if (y <= 1.8e-39) {
tmp = fma((-z - b), a, 1.0) * x;
} else {
tmp = (-a * b) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1e+109) tmp = Float64(Float64(log(z) * y) * x); elseif (y <= 1.8e-39) tmp = Float64(fma(Float64(Float64(-z) - b), a, 1.0) * x); else tmp = Float64(Float64(Float64(-a) * b) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1e+109], N[(N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 1.8e-39], N[(N[(N[((-z) - b), $MachinePrecision] * a + 1.0), $MachinePrecision] * x), $MachinePrecision], N[(N[((-a) * b), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+109}:\\
\;\;\;\;\left(\log z \cdot y\right) \cdot x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(\left(-z\right) - b, a, 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-a\right) \cdot b\right) \cdot x\\
\end{array}
\end{array}
if y < -9.99999999999999982e108Initial program 97.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6491.6
Applied rewrites91.6%
Taylor expanded in t around 0
lower-pow.f6469.5
Applied rewrites69.5%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f6429.4
Applied rewrites29.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6429.4
Applied rewrites29.4%
if -9.99999999999999982e108 < y < 1.8e-39Initial program 95.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6475.4
Applied rewrites75.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6439.8
Applied rewrites39.8%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6440.4
Applied rewrites40.4%
if 1.8e-39 < y Initial program 98.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6440.4
Applied rewrites40.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6413.4
Applied rewrites13.4%
Taylor expanded in b around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6425.3
Applied rewrites25.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -5e+38) (* (fma (- t) y 1.0) x) (if (<= y 1.8e-39) (* (fma (- (- z) b) a 1.0) x) (* (* (- a) b) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -5e+38) {
tmp = fma(-t, y, 1.0) * x;
} else if (y <= 1.8e-39) {
tmp = fma((-z - b), a, 1.0) * x;
} else {
tmp = (-a * b) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -5e+38) tmp = Float64(fma(Float64(-t), y, 1.0) * x); elseif (y <= 1.8e-39) tmp = Float64(fma(Float64(Float64(-z) - b), a, 1.0) * x); else tmp = Float64(Float64(Float64(-a) * b) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -5e+38], N[(N[((-t) * y + 1.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 1.8e-39], N[(N[(N[((-z) - b), $MachinePrecision] * a + 1.0), $MachinePrecision] * x), $MachinePrecision], N[(N[((-a) * b), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(-t, y, 1\right) \cdot x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(\left(-z\right) - b, a, 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-a\right) \cdot b\right) \cdot x\\
\end{array}
\end{array}
if y < -4.9999999999999997e38Initial program 98.1%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6490.4
Applied rewrites90.4%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6433.1
Applied rewrites33.1%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6421.4
Applied rewrites21.4%
if -4.9999999999999997e38 < y < 1.8e-39Initial program 95.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6479.7
Applied rewrites79.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6442.8
Applied rewrites42.8%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6443.4
Applied rewrites43.4%
if 1.8e-39 < y Initial program 98.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6440.4
Applied rewrites40.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6413.4
Applied rewrites13.4%
Taylor expanded in b around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6425.3
Applied rewrites25.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.65e+37) (* (fma (- t) y 1.0) x) (if (<= y 1.8e-39) (* (fma (- b) a 1.0) x) (* (* (- a) b) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.65e+37) {
tmp = fma(-t, y, 1.0) * x;
} else if (y <= 1.8e-39) {
tmp = fma(-b, a, 1.0) * x;
} else {
tmp = (-a * b) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.65e+37) tmp = Float64(fma(Float64(-t), y, 1.0) * x); elseif (y <= 1.8e-39) tmp = Float64(fma(Float64(-b), a, 1.0) * x); else tmp = Float64(Float64(Float64(-a) * b) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.65e+37], N[(N[((-t) * y + 1.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 1.8e-39], N[(N[((-b) * a + 1.0), $MachinePrecision] * x), $MachinePrecision], N[(N[((-a) * b), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(-t, y, 1\right) \cdot x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(-b, a, 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-a\right) \cdot b\right) \cdot x\\
\end{array}
\end{array}
if y < -1.65e37Initial program 98.1%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6490.5
Applied rewrites90.5%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6433.0
Applied rewrites33.0%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6421.3
Applied rewrites21.3%
if -1.65e37 < y < 1.8e-39Initial program 95.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6479.7
Applied rewrites79.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6442.9
Applied rewrites42.9%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6442.8
Applied rewrites42.8%
if 1.8e-39 < y Initial program 98.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6440.4
Applied rewrites40.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6413.4
Applied rewrites13.4%
Taylor expanded in b around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6425.3
Applied rewrites25.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* (- a) b) x))
(t_2 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))
(if (<= t_2 -4000000000000.0)
t_1
(if (<= t_2 1e+301) (* (fma (- t) y 1.0) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (-a * b) * x;
double t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
double tmp;
if (t_2 <= -4000000000000.0) {
tmp = t_1;
} else if (t_2 <= 1e+301) {
tmp = fma(-t, y, 1.0) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(-a) * b) * x) t_2 = Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) tmp = 0.0 if (t_2 <= -4000000000000.0) tmp = t_1; elseif (t_2 <= 1e+301) tmp = Float64(fma(Float64(-t), y, 1.0) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[((-a) * b), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4000000000000.0], t$95$1, If[LessEqual[t$95$2, 1e+301], N[(N[((-t) * y + 1.0), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-a\right) \cdot b\right) \cdot x\\
t_2 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t\_2 \leq -4000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+301}:\\
\;\;\;\;\mathsf{fma}\left(-t, y, 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < -4e12 or 1.00000000000000005e301 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 97.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6455.2
Applied rewrites55.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6415.2
Applied rewrites15.2%
Taylor expanded in b around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6426.3
Applied rewrites26.3%
if -4e12 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 1.00000000000000005e301Initial program 95.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6476.8
Applied rewrites76.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6446.5
Applied rewrites46.5%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6441.5
Applied rewrites41.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* (- a) b) x))
(t_2 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))
(if (<= t_2 -4000000000000.0) t_1 (if (<= t_2 2e+153) x t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (-a * b) * x;
double t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
double tmp;
if (t_2 <= -4000000000000.0) {
tmp = t_1;
} else if (t_2 <= 2e+153) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-a * b) * x
t_2 = (y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))
if (t_2 <= (-4000000000000.0d0)) then
tmp = t_1
else if (t_2 <= 2d+153) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (-a * b) * x;
double t_2 = (y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b));
double tmp;
if (t_2 <= -4000000000000.0) {
tmp = t_1;
} else if (t_2 <= 2e+153) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (-a * b) * x t_2 = (y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b)) tmp = 0 if t_2 <= -4000000000000.0: tmp = t_1 elif t_2 <= 2e+153: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(-a) * b) * x) t_2 = Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) tmp = 0.0 if (t_2 <= -4000000000000.0) tmp = t_1; elseif (t_2 <= 2e+153) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (-a * b) * x; t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b)); tmp = 0.0; if (t_2 <= -4000000000000.0) tmp = t_1; elseif (t_2 <= 2e+153) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[((-a) * b), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4000000000000.0], t$95$1, If[LessEqual[t$95$2, 2e+153], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-a\right) \cdot b\right) \cdot x\\
t_2 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t\_2 \leq -4000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+153}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < -4e12 or 2e153 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 98.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6454.3
Applied rewrites54.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6416.1
Applied rewrites16.1%
Taylor expanded in b around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift-neg.f6424.5
Applied rewrites24.5%
if -4e12 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 2e153Initial program 93.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6470.3
Applied rewrites70.3%
Taylor expanded in a around 0
Applied rewrites51.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* (- t) y) x))
(t_2 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))
(if (<= t_2 -4000000000000.0) t_1 (if (<= t_2 1e+184) x t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (-t * y) * x;
double t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
double tmp;
if (t_2 <= -4000000000000.0) {
tmp = t_1;
} else if (t_2 <= 1e+184) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-t * y) * x
t_2 = (y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))
if (t_2 <= (-4000000000000.0d0)) then
tmp = t_1
else if (t_2 <= 1d+184) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (-t * y) * x;
double t_2 = (y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b));
double tmp;
if (t_2 <= -4000000000000.0) {
tmp = t_1;
} else if (t_2 <= 1e+184) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (-t * y) * x t_2 = (y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b)) tmp = 0 if t_2 <= -4000000000000.0: tmp = t_1 elif t_2 <= 1e+184: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(-t) * y) * x) t_2 = Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) tmp = 0.0 if (t_2 <= -4000000000000.0) tmp = t_1; elseif (t_2 <= 1e+184) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (-t * y) * x; t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b)); tmp = 0.0; if (t_2 <= -4000000000000.0) tmp = t_1; elseif (t_2 <= 1e+184) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[((-t) * y), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4000000000000.0], t$95$1, If[LessEqual[t$95$2, 1e+184], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(-t\right) \cdot y\right) \cdot x\\
t_2 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t\_2 \leq -4000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+184}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < -4e12 or 1.00000000000000002e184 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 98.1%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6469.1
Applied rewrites69.1%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6418.2
Applied rewrites18.2%
Taylor expanded in t around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f6423.3
Applied rewrites23.3%
if -4e12 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 1.00000000000000002e184Initial program 94.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6469.4
Applied rewrites69.4%
Taylor expanded in a around 0
Applied rewrites46.9%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return 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, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6459.3
Applied rewrites59.3%
Taylor expanded in a around 0
Applied rewrites18.7%
herbie shell --seed 2025120
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
:precision binary64
(* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))