
(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 12 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 (+ (* 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.5%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6499.2
Applied rewrites99.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (/ 1.0 (* a b))))
(t_2 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))
(if (<= t_2 -2e+180) t_1 (if (<= t_2 1e+31) (/ x 1.0) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * (1.0 / (a * b));
double t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
double tmp;
if (t_2 <= -2e+180) {
tmp = t_1;
} else if (t_2 <= 1e+31) {
tmp = x / 1.0;
} 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 = x * (1.0d0 / (a * b))
t_2 = (y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))
if (t_2 <= (-2d+180)) then
tmp = t_1
else if (t_2 <= 1d+31) then
tmp = x / 1.0d0
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 = x * (1.0 / (a * b));
double t_2 = (y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b));
double tmp;
if (t_2 <= -2e+180) {
tmp = t_1;
} else if (t_2 <= 1e+31) {
tmp = x / 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * (1.0 / (a * b)) t_2 = (y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b)) tmp = 0 if t_2 <= -2e+180: tmp = t_1 elif t_2 <= 1e+31: tmp = x / 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * Float64(1.0 / Float64(a * b))) t_2 = Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) tmp = 0.0 if (t_2 <= -2e+180) tmp = t_1; elseif (t_2 <= 1e+31) tmp = Float64(x / 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * (1.0 / (a * b)); t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b)); tmp = 0.0; if (t_2 <= -2e+180) tmp = t_1; elseif (t_2 <= 1e+31) tmp = x / 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[(1.0 / N[(a * b), $MachinePrecision]), $MachinePrecision]), $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, -2e+180], t$95$1, If[LessEqual[t$95$2, 1e+31], N[(x / 1.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{1}{a \cdot b}\\
t_2 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+180}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+31}:\\
\;\;\;\;\frac{x}{1}\\
\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))) < -2e180 or 9.9999999999999996e30 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 97.9%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites76.9%
Taylor expanded in y around 0
Applied rewrites54.3%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6417.4
Applied rewrites17.4%
Taylor expanded in b around inf
lift-*.f6421.5
Applied rewrites21.5%
if -2e180 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 9.9999999999999996e30Initial program 94.1%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites81.7%
Taylor expanded in b around -inf
lower-/.f64N/A
lower-*.f64N/A
pow-expN/A
lift-log.f64N/A
lift--.f64N/A
lift-pow.f64N/A
lift-exp.f64N/A
lower-exp.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
lower-+.f64N/A
Applied rewrites81.7%
Taylor expanded in y around 0
Applied rewrites68.2%
Taylor expanded in a around 0
Applied rewrites47.1%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))) 1e+31) (* x (/ 1.0 (+ 1.0 (* a (+ b z))))) (* x (/ 1.0 (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))) <= 1e+31) {
tmp = x * (1.0 / (1.0 + (a * (b + z))));
} else {
tmp = x * (1.0 / (a * b));
}
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 * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))) <= 1d+31) then
tmp = x * (1.0d0 / (1.0d0 + (a * (b + z))))
else
tmp = x * (1.0d0 / (a * b))
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 * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))) <= 1e+31) {
tmp = x * (1.0 / (1.0 + (a * (b + z))));
} else {
tmp = x * (1.0 / (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))) <= 1e+31: tmp = x * (1.0 / (1.0 + (a * (b + z)))) else: tmp = x * (1.0 / (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) <= 1e+31) tmp = Float64(x * Float64(1.0 / Float64(1.0 + Float64(a * Float64(b + z))))); else tmp = Float64(x * Float64(1.0 / Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))) <= 1e+31) tmp = x * (1.0 / (1.0 + (a * (b + z)))); else tmp = x * (1.0 / (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[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], 1e+31], N[(x * N[(1.0 / N[(1.0 + N[(a * N[(b + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right) \leq 10^{+31}:\\
\;\;\;\;x \cdot \frac{1}{1 + a \cdot \left(b + z\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{a \cdot b}\\
\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))) < 9.9999999999999996e30Initial program 96.4%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites80.2%
Taylor expanded in y around 0
Applied rewrites64.1%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6446.1
Applied rewrites46.1%
Taylor expanded in z around 0
lower-+.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6446.6
Applied rewrites46.6%
if 9.9999999999999996e30 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 96.7%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites76.2%
Taylor expanded in y around 0
Applied rewrites52.1%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f643.4
Applied rewrites3.4%
Taylor expanded in b around inf
lift-*.f6410.4
Applied rewrites10.4%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))) 1e+31) (* x (/ 1.0 (+ 1.0 (* a b)))) (* x (/ 1.0 (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))) <= 1e+31) {
tmp = x * (1.0 / (1.0 + (a * b)));
} else {
tmp = x * (1.0 / (a * b));
}
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 * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))) <= 1d+31) then
tmp = x * (1.0d0 / (1.0d0 + (a * b)))
else
tmp = x * (1.0d0 / (a * b))
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 * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))) <= 1e+31) {
tmp = x * (1.0 / (1.0 + (a * b)));
} else {
tmp = x * (1.0 / (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))) <= 1e+31: tmp = x * (1.0 / (1.0 + (a * b))) else: tmp = x * (1.0 / (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) <= 1e+31) tmp = Float64(x * Float64(1.0 / Float64(1.0 + Float64(a * b)))); else tmp = Float64(x * Float64(1.0 / Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))) <= 1e+31) tmp = x * (1.0 / (1.0 + (a * b))); else tmp = x * (1.0 / (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[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], 1e+31], N[(x * N[(1.0 / N[(1.0 + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 / N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right) \leq 10^{+31}:\\
\;\;\;\;x \cdot \frac{1}{1 + a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{a \cdot b}\\
\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))) < 9.9999999999999996e30Initial program 96.4%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites80.2%
Taylor expanded in y around 0
Applied rewrites64.1%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6446.1
Applied rewrites46.1%
Taylor expanded in z around 0
lower-+.f64N/A
lift-*.f6446.0
Applied rewrites46.0%
if 9.9999999999999996e30 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 96.7%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites76.2%
Taylor expanded in y around 0
Applied rewrites52.1%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f643.4
Applied rewrites3.4%
Taylor expanded in b around inf
lift-*.f6410.4
Applied rewrites10.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* (- (log z) t) y)))))
(if (<= y -9.8e+39)
t_1
(if (<= y 1.55e+174) (* x (exp (fma y (- t) (* a (- (- z) b))))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp(((log(z) - t) * y));
double tmp;
if (y <= -9.8e+39) {
tmp = t_1;
} else if (y <= 1.55e+174) {
tmp = x * exp(fma(y, -t, (a * (-z - b))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(Float64(log(z) - t) * y))) tmp = 0.0 if (y <= -9.8e+39) tmp = t_1; elseif (y <= 1.55e+174) tmp = Float64(x * exp(fma(y, Float64(-t), Float64(a * Float64(Float64(-z) - b))))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.8e+39], t$95$1, If[LessEqual[y, 1.55e+174], N[(x * N[Exp[N[(y * (-t) + N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{\left(\log z - t\right) \cdot y}\\
\mathbf{if}\;y \leq -9.8 \cdot 10^{+39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+174}:\\
\;\;\;\;x \cdot e^{\mathsf{fma}\left(y, -t, a \cdot \left(\left(-z\right) - b\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.79999999999999974e39 or 1.55e174 < y Initial program 97.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6490.8
Applied rewrites90.8%
if -9.79999999999999974e39 < y < 1.55e174Initial program 96.2%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6499.9
Applied rewrites99.9%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6493.8
Applied rewrites93.8%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6493.8
Applied rewrites93.8%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1e-10) (* x (exp (* (- t) y))) (if (<= y 160.0) (/ x (exp (* a (+ b z)))) (* x (/ (pow z y) 1.0)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1e-10) {
tmp = x * exp((-t * y));
} else if (y <= 160.0) {
tmp = x / exp((a * (b + z)));
} else {
tmp = x * (pow(z, y) / 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, 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 <= (-1d-10)) then
tmp = x * exp((-t * y))
else if (y <= 160.0d0) then
tmp = x / exp((a * (b + z)))
else
tmp = x * ((z ** y) / 1.0d0)
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 <= -1e-10) {
tmp = x * Math.exp((-t * y));
} else if (y <= 160.0) {
tmp = x / Math.exp((a * (b + z)));
} else {
tmp = x * (Math.pow(z, y) / 1.0);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1e-10: tmp = x * math.exp((-t * y)) elif y <= 160.0: tmp = x / math.exp((a * (b + z))) else: tmp = x * (math.pow(z, y) / 1.0) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1e-10) tmp = Float64(x * exp(Float64(Float64(-t) * y))); elseif (y <= 160.0) tmp = Float64(x / exp(Float64(a * Float64(b + z)))); else tmp = Float64(x * Float64((z ^ y) / 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1e-10) tmp = x * exp((-t * y)); elseif (y <= 160.0) tmp = x / exp((a * (b + z))); else tmp = x * ((z ^ y) / 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1e-10], N[(x * N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 160.0], N[(x / N[Exp[N[(a * N[(b + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[(N[Power[z, y], $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-10}:\\
\;\;\;\;x \cdot e^{\left(-t\right) \cdot y}\\
\mathbf{elif}\;y \leq 160:\\
\;\;\;\;\frac{x}{e^{a \cdot \left(b + z\right)}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{{z}^{y}}{1}\\
\end{array}
\end{array}
if y < -1.00000000000000004e-10Initial program 97.2%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6460.1
Applied rewrites60.1%
if -1.00000000000000004e-10 < y < 160Initial program 95.5%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites82.1%
Taylor expanded in b around -inf
lower-/.f64N/A
lower-*.f64N/A
pow-expN/A
lift-log.f64N/A
lift--.f64N/A
lift-pow.f64N/A
lift-exp.f64N/A
lower-exp.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
lower-+.f64N/A
Applied rewrites82.1%
Taylor expanded in y around 0
Applied rewrites81.1%
Taylor expanded in z around 0
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6486.0
Applied rewrites86.0%
if 160 < y Initial program 97.8%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites75.2%
Taylor expanded in y around 0
Applied rewrites37.6%
Taylor expanded in a around 0
Applied rewrites3.8%
Taylor expanded in t around 0
lower-pow.f6467.3
Applied rewrites67.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1e-10) (* x (exp (* (- t) y))) (if (<= y 160.0) (/ x (exp (* a b))) (* x (/ (pow z y) 1.0)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1e-10) {
tmp = x * exp((-t * y));
} else if (y <= 160.0) {
tmp = x / exp((a * b));
} else {
tmp = x * (pow(z, y) / 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, 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 <= (-1d-10)) then
tmp = x * exp((-t * y))
else if (y <= 160.0d0) then
tmp = x / exp((a * b))
else
tmp = x * ((z ** y) / 1.0d0)
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 <= -1e-10) {
tmp = x * Math.exp((-t * y));
} else if (y <= 160.0) {
tmp = x / Math.exp((a * b));
} else {
tmp = x * (Math.pow(z, y) / 1.0);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1e-10: tmp = x * math.exp((-t * y)) elif y <= 160.0: tmp = x / math.exp((a * b)) else: tmp = x * (math.pow(z, y) / 1.0) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1e-10) tmp = Float64(x * exp(Float64(Float64(-t) * y))); elseif (y <= 160.0) tmp = Float64(x / exp(Float64(a * b))); else tmp = Float64(x * Float64((z ^ y) / 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1e-10) tmp = x * exp((-t * y)); elseif (y <= 160.0) tmp = x / exp((a * b)); else tmp = x * ((z ^ y) / 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1e-10], N[(x * N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 160.0], N[(x / N[Exp[N[(a * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[(N[Power[z, y], $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-10}:\\
\;\;\;\;x \cdot e^{\left(-t\right) \cdot y}\\
\mathbf{elif}\;y \leq 160:\\
\;\;\;\;\frac{x}{e^{a \cdot b}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{{z}^{y}}{1}\\
\end{array}
\end{array}
if y < -1.00000000000000004e-10Initial program 97.2%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6460.1
Applied rewrites60.1%
if -1.00000000000000004e-10 < y < 160Initial program 95.5%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites82.1%
Taylor expanded in b around -inf
lower-/.f64N/A
lower-*.f64N/A
pow-expN/A
lift-log.f64N/A
lift--.f64N/A
lift-pow.f64N/A
lift-exp.f64N/A
lower-exp.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
lower-+.f64N/A
Applied rewrites82.1%
Taylor expanded in y around 0
Applied rewrites81.1%
Taylor expanded in z around 0
lift-*.f6480.0
Applied rewrites80.0%
if 160 < y Initial program 97.8%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites75.2%
Taylor expanded in y around 0
Applied rewrites37.6%
Taylor expanded in a around 0
Applied rewrites3.8%
Taylor expanded in t around 0
lower-pow.f6467.3
Applied rewrites67.3%
(FPCore (x y z t a b) :precision binary64 (if (<= b -3.6e+22) (* x (exp (* (- a) b))) (if (<= b 6.5e+90) (* x (exp (* (- t) y))) (/ x (exp (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.6e+22) {
tmp = x * exp((-a * b));
} else if (b <= 6.5e+90) {
tmp = x * exp((-t * y));
} else {
tmp = x / exp((a * b));
}
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 (b <= (-3.6d+22)) then
tmp = x * exp((-a * b))
else if (b <= 6.5d+90) then
tmp = x * exp((-t * y))
else
tmp = x / exp((a * b))
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 (b <= -3.6e+22) {
tmp = x * Math.exp((-a * b));
} else if (b <= 6.5e+90) {
tmp = x * Math.exp((-t * y));
} else {
tmp = x / Math.exp((a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -3.6e+22: tmp = x * math.exp((-a * b)) elif b <= 6.5e+90: tmp = x * math.exp((-t * y)) else: tmp = x / math.exp((a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.6e+22) tmp = Float64(x * exp(Float64(Float64(-a) * b))); elseif (b <= 6.5e+90) tmp = Float64(x * exp(Float64(Float64(-t) * y))); else tmp = Float64(x / exp(Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -3.6e+22) tmp = x * exp((-a * b)); elseif (b <= 6.5e+90) tmp = x * exp((-t * y)); else tmp = x / exp((a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.6e+22], N[(x * N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.5e+90], N[(x * N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x / N[Exp[N[(a * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.6 \cdot 10^{+22}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot b}\\
\mathbf{elif}\;b \leq 6.5 \cdot 10^{+90}:\\
\;\;\;\;x \cdot e^{\left(-t\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{a \cdot b}}\\
\end{array}
\end{array}
if b < -3.6e22Initial program 98.3%
Taylor expanded in b around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6475.9
Applied rewrites75.9%
if -3.6e22 < b < 6.5000000000000001e90Initial program 95.4%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6466.1
Applied rewrites66.1%
if 6.5000000000000001e90 < b Initial program 98.0%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites77.3%
Taylor expanded in b around -inf
lower-/.f64N/A
lower-*.f64N/A
pow-expN/A
lift-log.f64N/A
lift--.f64N/A
lift-pow.f64N/A
lift-exp.f64N/A
lower-exp.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
lower-+.f64N/A
Applied rewrites77.3%
Taylor expanded in y around 0
Applied rewrites80.6%
Taylor expanded in z around 0
lift-*.f6480.6
Applied rewrites80.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* x (exp (* (- a) b))))) (if (<= b -3.6e+22) t_1 (if (<= b 6.5e+90) (* x (exp (* (- t) y))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((-a * b));
double tmp;
if (b <= -3.6e+22) {
tmp = t_1;
} else if (b <= 6.5e+90) {
tmp = x * exp((-t * y));
} 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 = x * exp((-a * b))
if (b <= (-3.6d+22)) then
tmp = t_1
else if (b <= 6.5d+90) then
tmp = x * exp((-t * y))
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 = x * Math.exp((-a * b));
double tmp;
if (b <= -3.6e+22) {
tmp = t_1;
} else if (b <= 6.5e+90) {
tmp = x * Math.exp((-t * y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((-a * b)) tmp = 0 if b <= -3.6e+22: tmp = t_1 elif b <= 6.5e+90: tmp = x * math.exp((-t * y)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(Float64(-a) * b))) tmp = 0.0 if (b <= -3.6e+22) tmp = t_1; elseif (b <= 6.5e+90) tmp = Float64(x * exp(Float64(Float64(-t) * y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((-a * b)); tmp = 0.0; if (b <= -3.6e+22) tmp = t_1; elseif (b <= 6.5e+90) tmp = x * exp((-t * y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.6e+22], t$95$1, If[LessEqual[b, 6.5e+90], N[(x * N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{\left(-a\right) \cdot b}\\
\mathbf{if}\;b \leq -3.6 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 6.5 \cdot 10^{+90}:\\
\;\;\;\;x \cdot e^{\left(-t\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.6e22 or 6.5000000000000001e90 < b Initial program 98.2%
Taylor expanded in b around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.9
Applied rewrites77.9%
if -3.6e22 < b < 6.5000000000000001e90Initial program 95.4%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6466.1
Applied rewrites66.1%
(FPCore (x y z t a b) :precision binary64 (* x (exp (fma y (- t) (* a (- (- z) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(y, -t, (a * (-z - b))));
}
function code(x, y, z, t, a, b) return Float64(x * exp(fma(y, Float64(-t), Float64(a * Float64(Float64(-z) - b))))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(y * (-t) + N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\mathsf{fma}\left(y, -t, a \cdot \left(\left(-z\right) - b\right)\right)}
\end{array}
Initial program 96.5%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6499.2
Applied rewrites99.2%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6487.5
Applied rewrites87.5%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6487.8
Applied rewrites87.8%
(FPCore (x y z t a b) :precision binary64 (* x (exp (* (- a) b))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp((-a * 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((-a * b))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp((-a * b));
}
def code(x, y, z, t, a, b): return x * math.exp((-a * b))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(-a) * b))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp((-a * b)); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\left(-a\right) \cdot b}
\end{array}
Initial program 96.5%
Taylor expanded in b around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6458.6
Applied rewrites58.6%
(FPCore (x y z t a b) :precision binary64 (/ x 1.0))
double code(double x, double y, double z, double t, double a, double b) {
return x / 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, 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 / 1.0d0
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x / 1.0;
}
def code(x, y, z, t, a, b): return x / 1.0
function code(x, y, z, t, a, b) return Float64(x / 1.0) end
function tmp = code(x, y, z, t, a, b) tmp = x / 1.0; end
code[x_, y_, z_, t_, a_, b_] := N[(x / 1.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{1}
\end{array}
Initial program 96.5%
lift-exp.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-log.f64N/A
fp-cancel-sign-sub-invN/A
exp-diffN/A
lower-/.f64N/A
Applied rewrites78.7%
Taylor expanded in b around -inf
lower-/.f64N/A
lower-*.f64N/A
pow-expN/A
lift-log.f64N/A
lift--.f64N/A
lift-pow.f64N/A
lift-exp.f64N/A
lower-exp.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
mul-1-negN/A
lower-+.f64N/A
Applied rewrites78.7%
Taylor expanded in y around 0
Applied rewrites59.4%
Taylor expanded in a around 0
Applied rewrites19.7%
herbie shell --seed 2025093
(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))))))