
(FPCore (x y z t a b) :precision binary64 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
double code(double x, double y, double z, double t, double a, double b) {
return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
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 - 1.0d0) * log(a))) - b))) / y
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 - 1.0) * Math.log(a))) - b))) / y;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
function code(x, y, z, t, a, b) return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) end
function tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
double code(double x, double y, double z, double t, double a, double b) {
return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
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 - 1.0d0) * log(a))) - b))) / y
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 - 1.0) * Math.log(a))) - b))) / y;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
function code(x, y, z, t, a, b) return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) end
function tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\end{array}
(FPCore (x y z t a b) :precision binary64 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
double code(double x, double y, double z, double t, double a, double b) {
return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
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 - 1.0d0) * log(a))) - b))) / y
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 - 1.0) * Math.log(a))) - b))) / y;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
function code(x, y, z, t, a, b) return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) end
function tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\end{array}
Initial program 98.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -3.8e-124) (not (<= b 2.8e+16))) (* x (/ (exp (- (* (log a) (- t 1.0)) b)) y)) (/ (* x (* (pow z y) (pow a (- t 1.0)))) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -3.8e-124) || !(b <= 2.8e+16)) {
tmp = x * (exp(((log(a) * (t - 1.0)) - b)) / y);
} else {
tmp = (x * (pow(z, y) * pow(a, (t - 1.0)))) / y;
}
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.8d-124)) .or. (.not. (b <= 2.8d+16))) then
tmp = x * (exp(((log(a) * (t - 1.0d0)) - b)) / y)
else
tmp = (x * ((z ** y) * (a ** (t - 1.0d0)))) / y
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.8e-124) || !(b <= 2.8e+16)) {
tmp = x * (Math.exp(((Math.log(a) * (t - 1.0)) - b)) / y);
} else {
tmp = (x * (Math.pow(z, y) * Math.pow(a, (t - 1.0)))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -3.8e-124) or not (b <= 2.8e+16): tmp = x * (math.exp(((math.log(a) * (t - 1.0)) - b)) / y) else: tmp = (x * (math.pow(z, y) * math.pow(a, (t - 1.0)))) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -3.8e-124) || !(b <= 2.8e+16)) tmp = Float64(x * Float64(exp(Float64(Float64(log(a) * Float64(t - 1.0)) - b)) / y)); else tmp = Float64(Float64(x * Float64((z ^ y) * (a ^ Float64(t - 1.0)))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -3.8e-124) || ~((b <= 2.8e+16))) tmp = x * (exp(((log(a) * (t - 1.0)) - b)) / y); else tmp = (x * ((z ^ y) * (a ^ (t - 1.0)))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -3.8e-124], N[Not[LessEqual[b, 2.8e+16]], $MachinePrecision]], N[(x * N[(N[Exp[N[(N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] * N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.8 \cdot 10^{-124} \lor \neg \left(b \leq 2.8 \cdot 10^{+16}\right):\\
\;\;\;\;x \cdot \frac{e^{\log a \cdot \left(t - 1\right) - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left({z}^{y} \cdot {a}^{\left(t - 1\right)}\right)}{y}\\
\end{array}
\end{array}
if b < -3.80000000000000012e-124 or 2.8e16 < b Initial program 99.2%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6490.2
Applied rewrites90.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6490.8
Applied rewrites90.8%
if -3.80000000000000012e-124 < b < 2.8e16Initial program 98.2%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6484.6
Applied rewrites84.6%
Final simplification88.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.6e+34) (not (<= b 2.55e+95))) (* x (/ (exp (- b)) y)) (/ (* x (* (pow z y) (pow a (- t 1.0)))) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.6e+34) || !(b <= 2.55e+95)) {
tmp = x * (exp(-b) / y);
} else {
tmp = (x * (pow(z, y) * pow(a, (t - 1.0)))) / y;
}
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 <= (-6.6d+34)) .or. (.not. (b <= 2.55d+95))) then
tmp = x * (exp(-b) / y)
else
tmp = (x * ((z ** y) * (a ** (t - 1.0d0)))) / y
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 <= -6.6e+34) || !(b <= 2.55e+95)) {
tmp = x * (Math.exp(-b) / y);
} else {
tmp = (x * (Math.pow(z, y) * Math.pow(a, (t - 1.0)))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -6.6e+34) or not (b <= 2.55e+95): tmp = x * (math.exp(-b) / y) else: tmp = (x * (math.pow(z, y) * math.pow(a, (t - 1.0)))) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.6e+34) || !(b <= 2.55e+95)) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); else tmp = Float64(Float64(x * Float64((z ^ y) * (a ^ Float64(t - 1.0)))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -6.6e+34) || ~((b <= 2.55e+95))) tmp = x * (exp(-b) / y); else tmp = (x * ((z ^ y) * (a ^ (t - 1.0)))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.6e+34], N[Not[LessEqual[b, 2.55e+95]], $MachinePrecision]], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] * N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.6 \cdot 10^{+34} \lor \neg \left(b \leq 2.55 \cdot 10^{+95}\right):\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left({z}^{y} \cdot {a}^{\left(t - 1\right)}\right)}{y}\\
\end{array}
\end{array}
if b < -6.59999999999999976e34 or 2.55000000000000001e95 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6486.1
Applied rewrites86.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.1
Applied rewrites86.1%
if -6.59999999999999976e34 < b < 2.55000000000000001e95Initial program 98.0%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6481.5
Applied rewrites81.5%
Final simplification83.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.8e+34) (not (<= b 4.9e+94))) (* x (/ (exp (- b)) y)) (* x (/ (* (pow z y) (pow a (- t 1.0))) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.8e+34) || !(b <= 4.9e+94)) {
tmp = x * (exp(-b) / y);
} else {
tmp = x * ((pow(z, y) * pow(a, (t - 1.0))) / y);
}
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 <= (-6.8d+34)) .or. (.not. (b <= 4.9d+94))) then
tmp = x * (exp(-b) / y)
else
tmp = x * (((z ** y) * (a ** (t - 1.0d0))) / y)
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 <= -6.8e+34) || !(b <= 4.9e+94)) {
tmp = x * (Math.exp(-b) / y);
} else {
tmp = x * ((Math.pow(z, y) * Math.pow(a, (t - 1.0))) / y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -6.8e+34) or not (b <= 4.9e+94): tmp = x * (math.exp(-b) / y) else: tmp = x * ((math.pow(z, y) * math.pow(a, (t - 1.0))) / y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.8e+34) || !(b <= 4.9e+94)) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); else tmp = Float64(x * Float64(Float64((z ^ y) * (a ^ Float64(t - 1.0))) / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -6.8e+34) || ~((b <= 4.9e+94))) tmp = x * (exp(-b) / y); else tmp = x * (((z ^ y) * (a ^ (t - 1.0))) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.8e+34], N[Not[LessEqual[b, 4.9e+94]], $MachinePrecision]], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(N[Power[z, y], $MachinePrecision] * N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.8 \cdot 10^{+34} \lor \neg \left(b \leq 4.9 \cdot 10^{+94}\right):\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{{z}^{y} \cdot {a}^{\left(t - 1\right)}}{y}\\
\end{array}
\end{array}
if b < -6.7999999999999999e34 or 4.8999999999999999e94 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6486.1
Applied rewrites86.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.1
Applied rewrites86.1%
if -6.7999999999999999e34 < b < 4.8999999999999999e94Initial program 98.0%
Taylor expanded in b around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6480.3
Applied rewrites80.3%
Final simplification82.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -0.00095)
(/ (* x (pow (* (exp b) a) -1.0)) y)
(if (<= b -1.12e-128)
(*
x
(/
(/
(pow a (- t 1.0))
(fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0))
y))
(if (<= b 4.2e+16) (/ (* x (/ (pow z y) a)) y) (* x (/ (exp (- b)) y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -0.00095) {
tmp = (x * pow((exp(b) * a), -1.0)) / y;
} else if (b <= -1.12e-128) {
tmp = x * ((pow(a, (t - 1.0)) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0)) / y);
} else if (b <= 4.2e+16) {
tmp = (x * (pow(z, y) / a)) / y;
} else {
tmp = x * (exp(-b) / y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -0.00095) tmp = Float64(Float64(x * (Float64(exp(b) * a) ^ -1.0)) / y); elseif (b <= -1.12e-128) tmp = Float64(x * Float64(Float64((a ^ Float64(t - 1.0)) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0)) / y)); elseif (b <= 4.2e+16) tmp = Float64(Float64(x * Float64((z ^ y) / a)) / y); else tmp = Float64(x * Float64(exp(Float64(-b)) / y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -0.00095], N[(N[(x * N[Power[N[(N[Exp[b], $MachinePrecision] * a), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[b, -1.12e-128], N[(x * N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.2e+16], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.00095:\\
\;\;\;\;\frac{x \cdot {\left(e^{b} \cdot a\right)}^{-1}}{y}\\
\mathbf{elif}\;b \leq -1.12 \cdot 10^{-128}:\\
\;\;\;\;x \cdot \frac{\frac{{a}^{\left(t - 1\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right)}}{y}\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{+16}:\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\end{array}
\end{array}
if b < -9.49999999999999998e-4Initial program 99.8%
Taylor expanded in y around 0
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6456.4
Applied rewrites56.4%
Taylor expanded in t around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6476.9
Applied rewrites76.9%
if -9.49999999999999998e-4 < b < -1.12e-128Initial program 95.3%
Taylor expanded in y around 0
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6478.3
Applied rewrites78.3%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6478.3
Applied rewrites78.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
if -1.12e-128 < b < 4.2e16Initial program 98.2%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6484.4
Applied rewrites84.4%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6477.0
Applied rewrites77.0%
if 4.2e16 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6487.9
Applied rewrites87.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.9
Applied rewrites87.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -0.00095)
(/ (* x (exp (- (- (log a)) b))) y)
(if (<= b -1.12e-128)
(*
x
(/
(/
(pow a (- t 1.0))
(fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0))
y))
(if (<= b 4.2e+16) (/ (* x (/ (pow z y) a)) y) (* x (/ (exp (- b)) y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -0.00095) {
tmp = (x * exp((-log(a) - b))) / y;
} else if (b <= -1.12e-128) {
tmp = x * ((pow(a, (t - 1.0)) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0)) / y);
} else if (b <= 4.2e+16) {
tmp = (x * (pow(z, y) / a)) / y;
} else {
tmp = x * (exp(-b) / y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -0.00095) tmp = Float64(Float64(x * exp(Float64(Float64(-log(a)) - b))) / y); elseif (b <= -1.12e-128) tmp = Float64(x * Float64(Float64((a ^ Float64(t - 1.0)) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0)) / y)); elseif (b <= 4.2e+16) tmp = Float64(Float64(x * Float64((z ^ y) / a)) / y); else tmp = Float64(x * Float64(exp(Float64(-b)) / y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -0.00095], N[(N[(x * N[Exp[N[((-N[Log[a], $MachinePrecision]) - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[b, -1.12e-128], N[(x * N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.2e+16], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.00095:\\
\;\;\;\;\frac{x \cdot e^{\left(-\log a\right) - b}}{y}\\
\mathbf{elif}\;b \leq -1.12 \cdot 10^{-128}:\\
\;\;\;\;x \cdot \frac{\frac{{a}^{\left(t - 1\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right)}}{y}\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{+16}:\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\end{array}
\end{array}
if b < -9.49999999999999998e-4Initial program 99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6490.6
Applied rewrites90.6%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lift-log.f6476.8
Applied rewrites76.8%
if -9.49999999999999998e-4 < b < -1.12e-128Initial program 95.3%
Taylor expanded in y around 0
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6478.3
Applied rewrites78.3%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6478.3
Applied rewrites78.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
if -1.12e-128 < b < 4.2e16Initial program 98.2%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6484.4
Applied rewrites84.4%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6477.0
Applied rewrites77.0%
if 4.2e16 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6487.9
Applied rewrites87.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.9
Applied rewrites87.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (/ (exp (- b)) y))))
(if (<= b -1.95)
t_1
(if (<= b -1.12e-128)
(*
x
(/
(/
(pow a (- t 1.0))
(fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0))
y))
(if (<= b 4.2e+16) (/ (* x (/ (pow z y) a)) y) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * (exp(-b) / y);
double tmp;
if (b <= -1.95) {
tmp = t_1;
} else if (b <= -1.12e-128) {
tmp = x * ((pow(a, (t - 1.0)) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0)) / y);
} else if (b <= 4.2e+16) {
tmp = (x * (pow(z, y) / a)) / y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x * Float64(exp(Float64(-b)) / y)) tmp = 0.0 if (b <= -1.95) tmp = t_1; elseif (b <= -1.12e-128) tmp = Float64(x * Float64(Float64((a ^ Float64(t - 1.0)) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0)) / y)); elseif (b <= 4.2e+16) tmp = Float64(Float64(x * Float64((z ^ y) / a)) / y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.95], t$95$1, If[LessEqual[b, -1.12e-128], N[(x * N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.2e+16], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{e^{-b}}{y}\\
\mathbf{if}\;b \leq -1.95:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -1.12 \cdot 10^{-128}:\\
\;\;\;\;x \cdot \frac{\frac{{a}^{\left(t - 1\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right)}}{y}\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{+16}:\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.94999999999999996 or 4.2e16 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6482.0
Applied rewrites82.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6482.0
Applied rewrites82.0%
if -1.94999999999999996 < b < -1.12e-128Initial program 95.1%
Taylor expanded in y around 0
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6479.2
Applied rewrites79.2%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6478.7
Applied rewrites78.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6482.3
Applied rewrites82.3%
if -1.12e-128 < b < 4.2e16Initial program 98.2%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6484.4
Applied rewrites84.4%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6477.0
Applied rewrites77.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (/ (exp (- b)) y))))
(if (<= b -2.1e+32)
t_1
(if (<= b -1.12e-128)
(* x (/ (/ (pow a (- t 1.0)) (fma (fma 0.5 b 1.0) b 1.0)) y))
(if (<= b 4.2e+16) (/ (* x (/ (pow z y) a)) y) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * (exp(-b) / y);
double tmp;
if (b <= -2.1e+32) {
tmp = t_1;
} else if (b <= -1.12e-128) {
tmp = x * ((pow(a, (t - 1.0)) / fma(fma(0.5, b, 1.0), b, 1.0)) / y);
} else if (b <= 4.2e+16) {
tmp = (x * (pow(z, y) / a)) / y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x * Float64(exp(Float64(-b)) / y)) tmp = 0.0 if (b <= -2.1e+32) tmp = t_1; elseif (b <= -1.12e-128) tmp = Float64(x * Float64(Float64((a ^ Float64(t - 1.0)) / fma(fma(0.5, b, 1.0), b, 1.0)) / y)); elseif (b <= 4.2e+16) tmp = Float64(Float64(x * Float64((z ^ y) / a)) / y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.1e+32], t$95$1, If[LessEqual[b, -1.12e-128], N[(x * N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / N[(N[(0.5 * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.2e+16], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{e^{-b}}{y}\\
\mathbf{if}\;b \leq -2.1 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -1.12 \cdot 10^{-128}:\\
\;\;\;\;x \cdot \frac{\frac{{a}^{\left(t - 1\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, b, 1\right), b, 1\right)}}{y}\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{+16}:\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.1000000000000001e32 or 4.2e16 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6483.4
Applied rewrites83.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
if -2.1000000000000001e32 < b < -1.12e-128Initial program 96.2%
Taylor expanded in y around 0
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6474.1
Applied rewrites74.1%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6473.3
Applied rewrites73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
if -1.12e-128 < b < 4.2e16Initial program 98.2%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6484.4
Applied rewrites84.4%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6477.0
Applied rewrites77.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -4.6e+90) (not (<= b 4.2e+16))) (* x (/ (exp (- b)) y)) (/ (* x (/ (pow z y) a)) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -4.6e+90) || !(b <= 4.2e+16)) {
tmp = x * (exp(-b) / y);
} else {
tmp = (x * (pow(z, y) / a)) / y;
}
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 <= (-4.6d+90)) .or. (.not. (b <= 4.2d+16))) then
tmp = x * (exp(-b) / y)
else
tmp = (x * ((z ** y) / a)) / y
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 <= -4.6e+90) || !(b <= 4.2e+16)) {
tmp = x * (Math.exp(-b) / y);
} else {
tmp = (x * (Math.pow(z, y) / a)) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -4.6e+90) or not (b <= 4.2e+16): tmp = x * (math.exp(-b) / y) else: tmp = (x * (math.pow(z, y) / a)) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -4.6e+90) || !(b <= 4.2e+16)) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); else tmp = Float64(Float64(x * Float64((z ^ y) / a)) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -4.6e+90) || ~((b <= 4.2e+16))) tmp = x * (exp(-b) / y); else tmp = (x * ((z ^ y) / a)) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -4.6e+90], N[Not[LessEqual[b, 4.2e+16]], $MachinePrecision]], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.6 \cdot 10^{+90} \lor \neg \left(b \leq 4.2 \cdot 10^{+16}\right):\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\end{array}
\end{array}
if b < -4.6e90 or 4.2e16 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6485.9
Applied rewrites85.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6485.9
Applied rewrites85.9%
if -4.6e90 < b < 4.2e16Initial program 97.9%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6480.8
Applied rewrites80.8%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6472.8
Applied rewrites72.8%
Final simplification78.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -4.6e+90) (not (<= b 4.2e+16))) (* x (/ (exp (- b)) y)) (* x (/ (/ (pow z y) a) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -4.6e+90) || !(b <= 4.2e+16)) {
tmp = x * (exp(-b) / y);
} else {
tmp = x * ((pow(z, y) / a) / y);
}
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 <= (-4.6d+90)) .or. (.not. (b <= 4.2d+16))) then
tmp = x * (exp(-b) / y)
else
tmp = x * (((z ** y) / a) / y)
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 <= -4.6e+90) || !(b <= 4.2e+16)) {
tmp = x * (Math.exp(-b) / y);
} else {
tmp = x * ((Math.pow(z, y) / a) / y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -4.6e+90) or not (b <= 4.2e+16): tmp = x * (math.exp(-b) / y) else: tmp = x * ((math.pow(z, y) / a) / y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -4.6e+90) || !(b <= 4.2e+16)) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); else tmp = Float64(x * Float64(Float64((z ^ y) / a) / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -4.6e+90) || ~((b <= 4.2e+16))) tmp = x * (exp(-b) / y); else tmp = x * (((z ^ y) / a) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -4.6e+90], N[Not[LessEqual[b, 4.2e+16]], $MachinePrecision]], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.6 \cdot 10^{+90} \lor \neg \left(b \leq 4.2 \cdot 10^{+16}\right):\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{{z}^{y}}{a}}{y}\\
\end{array}
\end{array}
if b < -4.6e90 or 4.2e16 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6485.9
Applied rewrites85.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6485.9
Applied rewrites85.9%
if -4.6e90 < b < 4.2e16Initial program 97.9%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6480.8
Applied rewrites80.8%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6472.8
Applied rewrites72.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6470.9
Applied rewrites70.9%
Final simplification77.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.62e+31) (not (<= b 4.5e+16))) (* x (/ (exp (- b)) y)) (/ (* x (pow a (- t 1.0))) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.62e+31) || !(b <= 4.5e+16)) {
tmp = x * (exp(-b) / y);
} else {
tmp = (x * pow(a, (t - 1.0))) / y;
}
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 <= (-1.62d+31)) .or. (.not. (b <= 4.5d+16))) then
tmp = x * (exp(-b) / y)
else
tmp = (x * (a ** (t - 1.0d0))) / y
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 <= -1.62e+31) || !(b <= 4.5e+16)) {
tmp = x * (Math.exp(-b) / y);
} else {
tmp = (x * Math.pow(a, (t - 1.0))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -1.62e+31) or not (b <= 4.5e+16): tmp = x * (math.exp(-b) / y) else: tmp = (x * math.pow(a, (t - 1.0))) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.62e+31) || !(b <= 4.5e+16)) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); else tmp = Float64(Float64(x * (a ^ Float64(t - 1.0))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -1.62e+31) || ~((b <= 4.5e+16))) tmp = x * (exp(-b) / y); else tmp = (x * (a ^ (t - 1.0))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.62e+31], N[Not[LessEqual[b, 4.5e+16]], $MachinePrecision]], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.62 \cdot 10^{+31} \lor \neg \left(b \leq 4.5 \cdot 10^{+16}\right):\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot {a}^{\left(t - 1\right)}}{y}\\
\end{array}
\end{array}
if b < -1.6199999999999999e31 or 4.5e16 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6483.4
Applied rewrites83.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
if -1.6199999999999999e31 < b < 4.5e16Initial program 97.8%
Taylor expanded in y around 0
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6468.6
Applied rewrites68.6%
Taylor expanded in b around 0
pow-to-expN/A
lift-pow.f64N/A
lift--.f6468.6
Applied rewrites68.6%
Final simplification75.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.95) (not (<= b 2.7e+16))) (* x (/ (exp (- b)) y)) (/ (* x (/ 1.0 a)) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.95) || !(b <= 2.7e+16)) {
tmp = x * (exp(-b) / y);
} else {
tmp = (x * (1.0 / a)) / y;
}
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 <= (-1.95d0)) .or. (.not. (b <= 2.7d+16))) then
tmp = x * (exp(-b) / y)
else
tmp = (x * (1.0d0 / a)) / y
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 <= -1.95) || !(b <= 2.7e+16)) {
tmp = x * (Math.exp(-b) / y);
} else {
tmp = (x * (1.0 / a)) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -1.95) or not (b <= 2.7e+16): tmp = x * (math.exp(-b) / y) else: tmp = (x * (1.0 / a)) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.95) || !(b <= 2.7e+16)) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); else tmp = Float64(Float64(x * Float64(1.0 / a)) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -1.95) || ~((b <= 2.7e+16))) tmp = x * (exp(-b) / y); else tmp = (x * (1.0 / a)) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.95], N[Not[LessEqual[b, 2.7e+16]], $MachinePrecision]], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.95 \lor \neg \left(b \leq 2.7 \cdot 10^{+16}\right):\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\end{array}
\end{array}
if b < -1.94999999999999996 or 2.7e16 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6482.0
Applied rewrites82.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6482.0
Applied rewrites82.0%
if -1.94999999999999996 < b < 2.7e16Initial program 97.6%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6483.0
Applied rewrites83.0%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6473.3
Applied rewrites73.3%
Taylor expanded in y around 0
Applied rewrites40.6%
Final simplification60.0%
(FPCore (x y z t a b) :precision binary64 (if (<= a 1.5e+213) (/ (* x (/ 1.0 a)) y) (* x (/ (/ 1.0 a) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= 1.5e+213) {
tmp = (x * (1.0 / a)) / y;
} else {
tmp = x * ((1.0 / a) / y);
}
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 <= 1.5d+213) then
tmp = (x * (1.0d0 / a)) / y
else
tmp = x * ((1.0d0 / a) / y)
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 <= 1.5e+213) {
tmp = (x * (1.0 / a)) / y;
} else {
tmp = x * ((1.0 / a) / y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= 1.5e+213: tmp = (x * (1.0 / a)) / y else: tmp = x * ((1.0 / a) / y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= 1.5e+213) tmp = Float64(Float64(x * Float64(1.0 / a)) / y); else tmp = Float64(x * Float64(Float64(1.0 / a) / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= 1.5e+213) tmp = (x * (1.0 / a)) / y; else tmp = x * ((1.0 / a) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 1.5e+213], N[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x * N[(N[(1.0 / a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.5 \cdot 10^{+213}:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\
\end{array}
\end{array}
if a < 1.5000000000000001e213Initial program 99.4%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6467.8
Applied rewrites67.8%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6458.7
Applied rewrites58.7%
Taylor expanded in y around 0
Applied rewrites30.8%
if 1.5000000000000001e213 < a Initial program 95.6%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6466.0
Applied rewrites66.0%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6459.6
Applied rewrites59.6%
Taylor expanded in y around 0
Applied rewrites35.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6446.3
Applied rewrites46.3%
(FPCore (x y z t a b) :precision binary64 (* x (/ (/ 1.0 a) y)))
double code(double x, double y, double z, double t, double a, double b) {
return x * ((1.0 / a) / y);
}
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 / a) / y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * ((1.0 / a) / y);
}
def code(x, y, z, t, a, b): return x * ((1.0 / a) / y)
function code(x, y, z, t, a, b) return Float64(x * Float64(Float64(1.0 / a) / y)) end
function tmp = code(x, y, z, t, a, b) tmp = x * ((1.0 / a) / y); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[(N[(1.0 / a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{\frac{1}{a}}{y}
\end{array}
Initial program 98.7%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
pow-to-expN/A
pow-to-expN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lift--.f6467.5
Applied rewrites67.5%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6458.9
Applied rewrites58.9%
Taylor expanded in y around 0
Applied rewrites31.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6430.4
Applied rewrites30.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (pow a (- t 1.0)))
(t_2 (/ (* x (/ t_1 y)) (- (+ b 1.0) (* y (log z))))))
(if (< t -0.8845848504127471)
t_2
(if (< t 852031.2288374073)
(/ (* (/ x y) t_1) (exp (- b (* (log z) y))))
t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow(a, (t - 1.0));
double t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * log(z)));
double tmp;
if (t < -0.8845848504127471) {
tmp = t_2;
} else if (t < 852031.2288374073) {
tmp = ((x / y) * t_1) / exp((b - (log(z) * y)));
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = a ** (t - 1.0d0)
t_2 = (x * (t_1 / y)) / ((b + 1.0d0) - (y * log(z)))
if (t < (-0.8845848504127471d0)) then
tmp = t_2
else if (t < 852031.2288374073d0) then
tmp = ((x / y) * t_1) / exp((b - (log(z) * y)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.pow(a, (t - 1.0));
double t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * Math.log(z)));
double tmp;
if (t < -0.8845848504127471) {
tmp = t_2;
} else if (t < 852031.2288374073) {
tmp = ((x / y) * t_1) / Math.exp((b - (Math.log(z) * y)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.pow(a, (t - 1.0)) t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * math.log(z))) tmp = 0 if t < -0.8845848504127471: tmp = t_2 elif t < 852031.2288374073: tmp = ((x / y) * t_1) / math.exp((b - (math.log(z) * y))) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = a ^ Float64(t - 1.0) t_2 = Float64(Float64(x * Float64(t_1 / y)) / Float64(Float64(b + 1.0) - Float64(y * log(z)))) tmp = 0.0 if (t < -0.8845848504127471) tmp = t_2; elseif (t < 852031.2288374073) tmp = Float64(Float64(Float64(x / y) * t_1) / exp(Float64(b - Float64(log(z) * y)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a ^ (t - 1.0); t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * log(z))); tmp = 0.0; if (t < -0.8845848504127471) tmp = t_2; elseif (t < 852031.2288374073) tmp = ((x / y) * t_1) / exp((b - (log(z) * y))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision] / N[(N[(b + 1.0), $MachinePrecision] - N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -0.8845848504127471], t$95$2, If[Less[t, 852031.2288374073], N[(N[(N[(x / y), $MachinePrecision] * t$95$1), $MachinePrecision] / N[Exp[N[(b - N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {a}^{\left(t - 1\right)}\\
t_2 := \frac{x \cdot \frac{t\_1}{y}}{\left(b + 1\right) - y \cdot \log z}\\
\mathbf{if}\;t < -0.8845848504127471:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < 852031.2288374073:\\
\;\;\;\;\frac{\frac{x}{y} \cdot t\_1}{e^{b - \log z \cdot y}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025064
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (if (< t -8845848504127471/10000000000000000) (/ (* x (/ (pow a (- t 1)) y)) (- (+ b 1) (* y (log z)))) (if (< t 8520312288374073/10000000000) (/ (* (/ x y) (pow a (- t 1))) (exp (- b (* (log z) y)))) (/ (* x (/ (pow a (- t 1)) y)) (- (+ b 1) (* y (log z)))))))
(/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))