
(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}
Sampling outcomes in binary64 precision:
Herbie found 11 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) (+ z b) (* (- (log z) t) y)))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(-a, (z + b), ((log(z) - t) * y)));
}
function code(x, y, z, t, a, b) return Float64(x * exp(fma(Float64(-a), Float64(z + b), Float64(Float64(log(z) - t) * y)))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[((-a) * N[(z + b), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\mathsf{fma}\left(-a, z + b, \left(\log z - t\right) \cdot y\right)}
\end{array}
Initial program 96.6%
Taylor expanded in z around 0
Applied rewrites99.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))
(if (or (<= t_1 -2e+17) (not (<= t_1 5e+23)))
(exp (* (- a) b))
(* x (exp (* (- a) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
double tmp;
if ((t_1 <= -2e+17) || !(t_1 <= 5e+23)) {
tmp = exp((-a * b));
} else {
tmp = x * exp((-a * z));
}
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 = (y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))
if ((t_1 <= (-2d+17)) .or. (.not. (t_1 <= 5d+23))) then
tmp = exp((-a * b))
else
tmp = x * exp((-a * z))
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 = (y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b));
double tmp;
if ((t_1 <= -2e+17) || !(t_1 <= 5e+23)) {
tmp = Math.exp((-a * b));
} else {
tmp = x * Math.exp((-a * z));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b)) tmp = 0 if (t_1 <= -2e+17) or not (t_1 <= 5e+23): tmp = math.exp((-a * b)) else: tmp = x * math.exp((-a * z)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) tmp = 0.0 if ((t_1 <= -2e+17) || !(t_1 <= 5e+23)) tmp = exp(Float64(Float64(-a) * b)); else tmp = Float64(x * exp(Float64(Float64(-a) * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b)); tmp = 0.0; if ((t_1 <= -2e+17) || ~((t_1 <= 5e+23))) tmp = exp((-a * b)); else tmp = x * exp((-a * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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[Or[LessEqual[t$95$1, -2e+17], N[Not[LessEqual[t$95$1, 5e+23]], $MachinePrecision]], N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision], N[(x * N[Exp[N[((-a) * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+17} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+23}\right):\\
\;\;\;\;e^{\left(-a\right) \cdot b}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot z}\\
\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))) < -2e17 or 4.9999999999999999e23 < (+.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 t around inf
Applied rewrites45.2%
add-exp-logN/A
lower-exp.f64N/A
lift-*.f64N/A
log-prodN/A
lift-exp.f64N/A
add-log-expN/A
lower-+.f64N/A
lower-log.f6422.3
Applied rewrites9.2%
Taylor expanded in b around inf
Applied rewrites45.8%
if -2e17 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 4.9999999999999999e23Initial program 89.5%
Taylor expanded in z around 0
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites90.6%
Final simplification53.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))
(if (or (<= t_1 -2e+17) (not (<= t_1 5e+23)))
(exp (* (- a) b))
(* (exp (* b a)) x))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
double tmp;
if ((t_1 <= -2e+17) || !(t_1 <= 5e+23)) {
tmp = exp((-a * b));
} else {
tmp = exp((b * a)) * 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) :: t_1
real(8) :: tmp
t_1 = (y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))
if ((t_1 <= (-2d+17)) .or. (.not. (t_1 <= 5d+23))) then
tmp = exp((-a * b))
else
tmp = exp((b * a)) * x
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 = (y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b));
double tmp;
if ((t_1 <= -2e+17) || !(t_1 <= 5e+23)) {
tmp = Math.exp((-a * b));
} else {
tmp = Math.exp((b * a)) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b)) tmp = 0 if (t_1 <= -2e+17) or not (t_1 <= 5e+23): tmp = math.exp((-a * b)) else: tmp = math.exp((b * a)) * x return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) tmp = 0.0 if ((t_1 <= -2e+17) || !(t_1 <= 5e+23)) tmp = exp(Float64(Float64(-a) * b)); else tmp = Float64(exp(Float64(b * a)) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b)); tmp = 0.0; if ((t_1 <= -2e+17) || ~((t_1 <= 5e+23))) tmp = exp((-a * b)); else tmp = exp((b * a)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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[Or[LessEqual[t$95$1, -2e+17], N[Not[LessEqual[t$95$1, 5e+23]], $MachinePrecision]], N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision], N[(N[Exp[N[(b * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+17} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+23}\right):\\
\;\;\;\;e^{\left(-a\right) \cdot b}\\
\mathbf{else}:\\
\;\;\;\;e^{b \cdot a} \cdot x\\
\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))) < -2e17 or 4.9999999999999999e23 < (+.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 t around inf
Applied rewrites45.2%
add-exp-logN/A
lower-exp.f64N/A
lift-*.f64N/A
log-prodN/A
lift-exp.f64N/A
add-log-expN/A
lower-+.f64N/A
lower-log.f6422.3
Applied rewrites9.2%
Taylor expanded in b around inf
Applied rewrites45.8%
if -2e17 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 4.9999999999999999e23Initial program 89.5%
Taylor expanded in b around inf
Applied rewrites82.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.2
Applied rewrites82.2%
Final simplification52.4%
(FPCore (x y z t a b) :precision binary64 (if (<= a -1e+138) (* x (exp (* (- b) a))) (if (<= a 1.3e+48) (* x (exp (* (- (log z) t) y))) (/ x (exp (* b a))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1e+138) {
tmp = x * exp((-b * a));
} else if (a <= 1.3e+48) {
tmp = x * exp(((log(z) - t) * y));
} else {
tmp = x / exp((b * a));
}
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 (a <= (-1d+138)) then
tmp = x * exp((-b * a))
else if (a <= 1.3d+48) then
tmp = x * exp(((log(z) - t) * y))
else
tmp = x / exp((b * a))
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 (a <= -1e+138) {
tmp = x * Math.exp((-b * a));
} else if (a <= 1.3e+48) {
tmp = x * Math.exp(((Math.log(z) - t) * y));
} else {
tmp = x / Math.exp((b * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -1e+138: tmp = x * math.exp((-b * a)) elif a <= 1.3e+48: tmp = x * math.exp(((math.log(z) - t) * y)) else: tmp = x / math.exp((b * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1e+138) tmp = Float64(x * exp(Float64(Float64(-b) * a))); elseif (a <= 1.3e+48) tmp = Float64(x * exp(Float64(Float64(log(z) - t) * y))); else tmp = Float64(x / exp(Float64(b * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -1e+138) tmp = x * exp((-b * a)); elseif (a <= 1.3e+48) tmp = x * exp(((log(z) - t) * y)); else tmp = x / exp((b * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1e+138], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.3e+48], N[(x * N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x / N[Exp[N[(b * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+138}:\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\mathbf{elif}\;a \leq 1.3 \cdot 10^{+48}:\\
\;\;\;\;x \cdot e^{\left(\log z - t\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{b \cdot a}}\\
\end{array}
\end{array}
if a < -1e138Initial program 93.1%
Taylor expanded in b around inf
Applied rewrites91.0%
if -1e138 < a < 1.29999999999999998e48Initial program 98.7%
Taylor expanded in y around inf
Applied rewrites85.6%
if 1.29999999999999998e48 < a Initial program 93.5%
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
lower-/.f64N/A
Applied rewrites93.5%
Taylor expanded in z around 0
Applied rewrites93.5%
Taylor expanded in y around 0
Applied rewrites77.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.5) (not (<= y 1.45e-5))) (exp (* y (- (log z) t))) (/ x (pow (E) (* b a)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \lor \neg \left(y \leq 1.45 \cdot 10^{-5}\right):\\
\;\;\;\;e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{{\mathsf{E}\left(\right)}^{\left(b \cdot a\right)}}\\
\end{array}
\end{array}
if y < -2.5 or 1.45e-5 < y Initial program 97.9%
Taylor expanded in t around inf
Applied rewrites54.3%
add-exp-logN/A
lower-exp.f64N/A
lift-*.f64N/A
log-prodN/A
lift-exp.f64N/A
add-log-expN/A
lower-+.f64N/A
lower-log.f6427.8
Applied rewrites11.6%
Taylor expanded in y around inf
Applied rewrites68.1%
if -2.5 < y < 1.45e-5Initial program 95.0%
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
lower-/.f64N/A
Applied rewrites95.0%
Taylor expanded in z around 0
Applied rewrites95.0%
Taylor expanded in y around 0
Applied rewrites79.8%
Applied rewrites79.8%
Final simplification73.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.85e+200) (not (<= t 3.6e-25))) (* x (exp (* (- t) y))) (/ x (pow (E) (* b a)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.85 \cdot 10^{+200} \lor \neg \left(t \leq 3.6 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot e^{\left(-t\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{{\mathsf{E}\left(\right)}^{\left(b \cdot a\right)}}\\
\end{array}
\end{array}
if t < -1.8500000000000001e200 or 3.5999999999999999e-25 < t Initial program 97.5%
Taylor expanded in t around inf
Applied rewrites84.3%
if -1.8500000000000001e200 < t < 3.5999999999999999e-25Initial program 96.1%
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
lower-/.f64N/A
Applied rewrites96.1%
Taylor expanded in z around 0
Applied rewrites96.1%
Taylor expanded in y around 0
Applied rewrites72.6%
Applied rewrites72.6%
Final simplification76.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.85e+200) (not (<= t 3.6e-25))) (* x (exp (* (- t) y))) (/ x (exp (* b a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.85e+200) || !(t <= 3.6e-25)) {
tmp = x * exp((-t * y));
} else {
tmp = x / exp((b * a));
}
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 ((t <= (-1.85d+200)) .or. (.not. (t <= 3.6d-25))) then
tmp = x * exp((-t * y))
else
tmp = x / exp((b * a))
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 ((t <= -1.85e+200) || !(t <= 3.6e-25)) {
tmp = x * Math.exp((-t * y));
} else {
tmp = x / Math.exp((b * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.85e+200) or not (t <= 3.6e-25): tmp = x * math.exp((-t * y)) else: tmp = x / math.exp((b * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.85e+200) || !(t <= 3.6e-25)) tmp = Float64(x * exp(Float64(Float64(-t) * y))); else tmp = Float64(x / exp(Float64(b * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.85e+200) || ~((t <= 3.6e-25))) tmp = x * exp((-t * y)); else tmp = x / exp((b * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.85e+200], N[Not[LessEqual[t, 3.6e-25]], $MachinePrecision]], N[(x * N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x / N[Exp[N[(b * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.85 \cdot 10^{+200} \lor \neg \left(t \leq 3.6 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot e^{\left(-t\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{b \cdot a}}\\
\end{array}
\end{array}
if t < -1.8500000000000001e200 or 3.5999999999999999e-25 < t Initial program 97.5%
Taylor expanded in t around inf
Applied rewrites84.3%
if -1.8500000000000001e200 < t < 3.5999999999999999e-25Initial program 96.1%
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
lower-/.f64N/A
Applied rewrites96.1%
Taylor expanded in z around 0
Applied rewrites96.1%
Taylor expanded in y around 0
Applied rewrites72.6%
Final simplification76.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.85e+200) (not (<= t 3.6e-25))) (* x (exp (* (- t) y))) (* x (exp (* (- b) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.85e+200) || !(t <= 3.6e-25)) {
tmp = x * exp((-t * y));
} else {
tmp = x * exp((-b * a));
}
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 ((t <= (-1.85d+200)) .or. (.not. (t <= 3.6d-25))) then
tmp = x * exp((-t * y))
else
tmp = x * exp((-b * a))
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 ((t <= -1.85e+200) || !(t <= 3.6e-25)) {
tmp = x * Math.exp((-t * y));
} else {
tmp = x * Math.exp((-b * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.85e+200) or not (t <= 3.6e-25): tmp = x * math.exp((-t * y)) else: tmp = x * math.exp((-b * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.85e+200) || !(t <= 3.6e-25)) tmp = Float64(x * exp(Float64(Float64(-t) * y))); else tmp = Float64(x * exp(Float64(Float64(-b) * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.85e+200) || ~((t <= 3.6e-25))) tmp = x * exp((-t * y)); else tmp = x * exp((-b * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.85e+200], N[Not[LessEqual[t, 3.6e-25]], $MachinePrecision]], N[(x * N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.85 \cdot 10^{+200} \lor \neg \left(t \leq 3.6 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot e^{\left(-t\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\end{array}
\end{array}
if t < -1.8500000000000001e200 or 3.5999999999999999e-25 < t Initial program 97.5%
Taylor expanded in t around inf
Applied rewrites84.3%
if -1.8500000000000001e200 < t < 3.5999999999999999e-25Initial program 96.1%
Taylor expanded in b around inf
Applied rewrites72.6%
Final simplification76.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.12e+201) (not (<= t 4.7e+137))) (exp (* (- t) y)) (* x (exp (* (- b) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.12e+201) || !(t <= 4.7e+137)) {
tmp = exp((-t * y));
} else {
tmp = x * exp((-b * a));
}
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 ((t <= (-1.12d+201)) .or. (.not. (t <= 4.7d+137))) then
tmp = exp((-t * y))
else
tmp = x * exp((-b * a))
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 ((t <= -1.12e+201) || !(t <= 4.7e+137)) {
tmp = Math.exp((-t * y));
} else {
tmp = x * Math.exp((-b * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.12e+201) or not (t <= 4.7e+137): tmp = math.exp((-t * y)) else: tmp = x * math.exp((-b * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.12e+201) || !(t <= 4.7e+137)) tmp = exp(Float64(Float64(-t) * y)); else tmp = Float64(x * exp(Float64(Float64(-b) * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.12e+201) || ~((t <= 4.7e+137))) tmp = exp((-t * y)); else tmp = x * exp((-b * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.12e+201], N[Not[LessEqual[t, 4.7e+137]], $MachinePrecision]], N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.12 \cdot 10^{+201} \lor \neg \left(t \leq 4.7 \cdot 10^{+137}\right):\\
\;\;\;\;e^{\left(-t\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\end{array}
\end{array}
if t < -1.11999999999999994e201 or 4.6999999999999998e137 < t Initial program 96.1%
Taylor expanded in t around inf
Applied rewrites92.3%
add-exp-logN/A
lower-exp.f64N/A
lift-*.f64N/A
log-prodN/A
lift-exp.f64N/A
add-log-expN/A
lower-+.f64N/A
lower-log.f6446.9
Applied rewrites5.1%
Taylor expanded in t around inf
Applied rewrites63.2%
if -1.11999999999999994e201 < t < 4.6999999999999998e137Initial program 96.7%
Taylor expanded in b around inf
Applied rewrites72.1%
Final simplification70.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.85e+200) (not (<= t 4.8e+125))) (exp (* (- t) y)) (exp (* (- a) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.85e+200) || !(t <= 4.8e+125)) {
tmp = exp((-t * y));
} else {
tmp = 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 ((t <= (-1.85d+200)) .or. (.not. (t <= 4.8d+125))) then
tmp = exp((-t * y))
else
tmp = 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 ((t <= -1.85e+200) || !(t <= 4.8e+125)) {
tmp = Math.exp((-t * y));
} else {
tmp = Math.exp((-a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.85e+200) or not (t <= 4.8e+125): tmp = math.exp((-t * y)) else: tmp = math.exp((-a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.85e+200) || !(t <= 4.8e+125)) tmp = exp(Float64(Float64(-t) * y)); else tmp = exp(Float64(Float64(-a) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.85e+200) || ~((t <= 4.8e+125))) tmp = exp((-t * y)); else tmp = exp((-a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.85e+200], N[Not[LessEqual[t, 4.8e+125]], $MachinePrecision]], N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision], N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.85 \cdot 10^{+200} \lor \neg \left(t \leq 4.8 \cdot 10^{+125}\right):\\
\;\;\;\;e^{\left(-t\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-a\right) \cdot b}\\
\end{array}
\end{array}
if t < -1.8500000000000001e200 or 4.7999999999999999e125 < t Initial program 96.3%
Taylor expanded in t around inf
Applied rewrites92.7%
add-exp-logN/A
lower-exp.f64N/A
lift-*.f64N/A
log-prodN/A
lift-exp.f64N/A
add-log-expN/A
lower-+.f64N/A
lower-log.f6446.0
Applied rewrites6.5%
Taylor expanded in t around inf
Applied rewrites59.8%
if -1.8500000000000001e200 < t < 4.7999999999999999e125Initial program 96.6%
Taylor expanded in t around inf
Applied rewrites41.6%
add-exp-logN/A
lower-exp.f64N/A
lift-*.f64N/A
log-prodN/A
lift-exp.f64N/A
add-log-expN/A
lower-+.f64N/A
lower-log.f6422.3
Applied rewrites18.3%
Taylor expanded in b around inf
Applied rewrites45.0%
Final simplification48.1%
(FPCore (x y z t a b) :precision binary64 (exp (* (- a) b)))
double code(double x, double y, double z, double t, double a, double b) {
return 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 = exp((-a * b))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp((-a * b));
}
def code(x, y, z, t, a, b): return math.exp((-a * b))
function code(x, y, z, t, a, b) return exp(Float64(Float64(-a) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = exp((-a * b)); end
code[x_, y_, z_, t_, a_, b_] := N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(-a\right) \cdot b}
\end{array}
Initial program 96.6%
Taylor expanded in t around inf
Applied rewrites52.4%
add-exp-logN/A
lower-exp.f64N/A
lift-*.f64N/A
log-prodN/A
lift-exp.f64N/A
add-log-expN/A
lower-+.f64N/A
lower-log.f6427.3
Applied rewrites15.8%
Taylor expanded in b around inf
Applied rewrites38.3%
herbie shell --seed 2025021
(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))))))