
(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 16 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.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y)))
(if (<= t_1 -5e+25)
(/ (* x (/ 1.0 a)) y)
(if (<= t_1 1e+251)
(/
x
(* (* (fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0) y) a))
(/ x (* y a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
double tmp;
if (t_1 <= -5e+25) {
tmp = (x * (1.0 / a)) / y;
} else if (t_1 <= 1e+251) {
tmp = x / ((fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * y) * a);
} else {
tmp = x / (y * a);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) tmp = 0.0 if (t_1 <= -5e+25) tmp = Float64(Float64(x * Float64(1.0 / a)) / y); elseif (t_1 <= 1e+251) tmp = Float64(x / Float64(Float64(fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * y) * a)); else tmp = Float64(x / Float64(y * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -5e+25], N[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 1e+251], N[(x / N[(N[(N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision] * y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\mathbf{elif}\;t\_1 \leq 10^{+251}:\\
\;\;\;\;\frac{x}{\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right) \cdot y\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot a}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < -5.00000000000000024e25Initial program 99.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--.f6478.6
Applied rewrites78.6%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6463.7
Applied rewrites63.7%
Taylor expanded in y around 0
Applied rewrites30.5%
if -5.00000000000000024e25 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 1e251Initial program 98.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6462.3
Applied rewrites62.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.f6460.3
Applied rewrites60.3%
if 1e251 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) Initial program 99.7%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6463.1
Applied rewrites63.1%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6466.8
Applied rewrites66.8%
Taylor expanded in b around 0
Applied rewrites37.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y)))
(if (<= t_1 -5e+25)
(/ (* x (/ 1.0 a)) y)
(if (<= t_1 1e+251)
(/ x (* (* (fma (fma 0.5 b 1.0) b 1.0) y) a))
(/ x (* y a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
double tmp;
if (t_1 <= -5e+25) {
tmp = (x * (1.0 / a)) / y;
} else if (t_1 <= 1e+251) {
tmp = x / ((fma(fma(0.5, b, 1.0), b, 1.0) * y) * a);
} else {
tmp = x / (y * a);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) tmp = 0.0 if (t_1 <= -5e+25) tmp = Float64(Float64(x * Float64(1.0 / a)) / y); elseif (t_1 <= 1e+251) tmp = Float64(x / Float64(Float64(fma(fma(0.5, b, 1.0), b, 1.0) * y) * a)); else tmp = Float64(x / Float64(y * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -5e+25], N[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 1e+251], N[(x / N[(N[(N[(N[(0.5 * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision] * y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\mathbf{elif}\;t\_1 \leq 10^{+251}:\\
\;\;\;\;\frac{x}{\left(\mathsf{fma}\left(\mathsf{fma}\left(0.5, b, 1\right), b, 1\right) \cdot y\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot a}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < -5.00000000000000024e25Initial program 99.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--.f6478.6
Applied rewrites78.6%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6463.7
Applied rewrites63.7%
Taylor expanded in y around 0
Applied rewrites30.5%
if -5.00000000000000024e25 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 1e251Initial program 98.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6462.3
Applied rewrites62.3%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6457.2
Applied rewrites57.2%
if 1e251 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) Initial program 99.7%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6463.1
Applied rewrites63.1%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6466.8
Applied rewrites66.8%
Taylor expanded in b around 0
Applied rewrites37.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y)))
(if (<= t_1 -5e+25)
(/ (* x (/ 1.0 a)) y)
(if (<= t_1 1e+251)
(/ x (* (fma (fma (* b y) 0.5 y) b y) a))
(/ x (* y a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
double tmp;
if (t_1 <= -5e+25) {
tmp = (x * (1.0 / a)) / y;
} else if (t_1 <= 1e+251) {
tmp = x / (fma(fma((b * y), 0.5, y), b, y) * a);
} else {
tmp = x / (y * a);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) tmp = 0.0 if (t_1 <= -5e+25) tmp = Float64(Float64(x * Float64(1.0 / a)) / y); elseif (t_1 <= 1e+251) tmp = Float64(x / Float64(fma(fma(Float64(b * y), 0.5, y), b, y) * a)); else tmp = Float64(x / Float64(y * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -5e+25], N[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 1e+251], N[(x / N[(N[(N[(N[(b * y), $MachinePrecision] * 0.5 + y), $MachinePrecision] * b + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\mathbf{elif}\;t\_1 \leq 10^{+251}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(b \cdot y, 0.5, y\right), b, y\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot a}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < -5.00000000000000024e25Initial program 99.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--.f6478.6
Applied rewrites78.6%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6463.7
Applied rewrites63.7%
Taylor expanded in y around 0
Applied rewrites30.5%
if -5.00000000000000024e25 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 1e251Initial program 98.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6462.3
Applied rewrites62.3%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6454.1
Applied rewrites54.1%
if 1e251 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) Initial program 99.7%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6463.1
Applied rewrites63.1%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6466.8
Applied rewrites66.8%
Taylor expanded in b around 0
Applied rewrites37.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t 1.0) (log a)))
(t_2 (/ x (* a y)))
(t_3 (* x (/ (pow a t) y))))
(if (<= t_1 -2e+16)
t_3
(if (<= t_1 -70.0)
(fma (- (* (- b) (* t_2 -0.5)) t_2) b t_2)
(if (<= t_1 1000.0) (* x (/ (exp (- b)) y)) t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - 1.0) * log(a);
double t_2 = x / (a * y);
double t_3 = x * (pow(a, t) / y);
double tmp;
if (t_1 <= -2e+16) {
tmp = t_3;
} else if (t_1 <= -70.0) {
tmp = fma(((-b * (t_2 * -0.5)) - t_2), b, t_2);
} else if (t_1 <= 1000.0) {
tmp = x * (exp(-b) / y);
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - 1.0) * log(a)) t_2 = Float64(x / Float64(a * y)) t_3 = Float64(x * Float64((a ^ t) / y)) tmp = 0.0 if (t_1 <= -2e+16) tmp = t_3; elseif (t_1 <= -70.0) tmp = fma(Float64(Float64(Float64(-b) * Float64(t_2 * -0.5)) - t_2), b, t_2); elseif (t_1 <= 1000.0) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(a * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(N[Power[a, t], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+16], t$95$3, If[LessEqual[t$95$1, -70.0], N[(N[(N[((-b) * N[(t$95$2 * -0.5), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision] * b + t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 1000.0], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
t_2 := \frac{x}{a \cdot y}\\
t_3 := x \cdot \frac{{a}^{t}}{y}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+16}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq -70:\\
\;\;\;\;\mathsf{fma}\left(\left(-b\right) \cdot \left(t\_2 \cdot -0.5\right) - t\_2, b, t\_2\right)\\
\mathbf{elif}\;t\_1 \leq 1000:\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -2e16 or 1e3 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) Initial program 100.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6461.7
Applied rewrites61.7%
Taylor expanded in b around 0
pow-to-expN/A
lift-pow.f64N/A
lift--.f6478.8
Applied rewrites78.8%
Taylor expanded in t around inf
Applied rewrites78.8%
if -2e16 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -70Initial program 95.1%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6480.0
Applied rewrites80.0%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6481.6
Applied rewrites81.6%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites58.8%
if -70 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 1e3Initial program 99.5%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6461.8
Applied rewrites61.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.8
Applied rewrites61.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.2e+50) (not (<= b 8.5e-93))) (/ (* 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 <= -6.2e+50) || !(b <= 8.5e-93)) {
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 <= (-6.2d+50)) .or. (.not. (b <= 8.5d-93))) 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 <= -6.2e+50) || !(b <= 8.5e-93)) {
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 <= -6.2e+50) or not (b <= 8.5e-93): 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 <= -6.2e+50) || !(b <= 8.5e-93)) tmp = Float64(Float64(x * exp(Float64(Float64(log(a) * Float64(t - 1.0)) - 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.2e+50) || ~((b <= 8.5e-93))) 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, -6.2e+50], N[Not[LessEqual[b, 8.5e-93]], $MachinePrecision]], N[(N[(x * N[Exp[N[(N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $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.2 \cdot 10^{+50} \lor \neg \left(b \leq 8.5 \cdot 10^{-93}\right):\\
\;\;\;\;\frac{x \cdot e^{\log a \cdot \left(t - 1\right) - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{{z}^{y} \cdot {a}^{\left(t - 1\right)}}{y}\\
\end{array}
\end{array}
if b < -6.20000000000000006e50 or 8.5000000000000007e-93 < b Initial program 99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6492.1
Applied rewrites92.1%
if -6.20000000000000006e50 < b < 8.5000000000000007e-93Initial program 97.2%
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--.f6488.7
Applied rewrites88.7%
Final simplification90.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -1.1e+23)
(/ (* x (/ (pow z y) a)) y)
(if (<= y 7.6e-255)
(* x (/ (pow a (- t 1.0)) y))
(if (<= y 150000.0)
(/ x (* (* (exp b) y) a))
(/ (* x (exp (* (log z) y))) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.1e+23) {
tmp = (x * (pow(z, y) / a)) / y;
} else if (y <= 7.6e-255) {
tmp = x * (pow(a, (t - 1.0)) / y);
} else if (y <= 150000.0) {
tmp = x / ((exp(b) * y) * a);
} else {
tmp = (x * exp((log(z) * y))) / 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 (y <= (-1.1d+23)) then
tmp = (x * ((z ** y) / a)) / y
else if (y <= 7.6d-255) then
tmp = x * ((a ** (t - 1.0d0)) / y)
else if (y <= 150000.0d0) then
tmp = x / ((exp(b) * y) * a)
else
tmp = (x * exp((log(z) * y))) / 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 (y <= -1.1e+23) {
tmp = (x * (Math.pow(z, y) / a)) / y;
} else if (y <= 7.6e-255) {
tmp = x * (Math.pow(a, (t - 1.0)) / y);
} else if (y <= 150000.0) {
tmp = x / ((Math.exp(b) * y) * a);
} else {
tmp = (x * Math.exp((Math.log(z) * y))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.1e+23: tmp = (x * (math.pow(z, y) / a)) / y elif y <= 7.6e-255: tmp = x * (math.pow(a, (t - 1.0)) / y) elif y <= 150000.0: tmp = x / ((math.exp(b) * y) * a) else: tmp = (x * math.exp((math.log(z) * y))) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.1e+23) tmp = Float64(Float64(x * Float64((z ^ y) / a)) / y); elseif (y <= 7.6e-255) tmp = Float64(x * Float64((a ^ Float64(t - 1.0)) / y)); elseif (y <= 150000.0) tmp = Float64(x / Float64(Float64(exp(b) * y) * a)); else tmp = Float64(Float64(x * exp(Float64(log(z) * y))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.1e+23) tmp = (x * ((z ^ y) / a)) / y; elseif (y <= 7.6e-255) tmp = x * ((a ^ (t - 1.0)) / y); elseif (y <= 150000.0) tmp = x / ((exp(b) * y) * a); else tmp = (x * exp((log(z) * y))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.1e+23], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 7.6e-255], N[(x * N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 150000.0], N[(x / N[(N[(N[Exp[b], $MachinePrecision] * y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Exp[N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+23}:\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{-255}:\\
\;\;\;\;x \cdot \frac{{a}^{\left(t - 1\right)}}{y}\\
\mathbf{elif}\;y \leq 150000:\\
\;\;\;\;\frac{x}{\left(e^{b} \cdot y\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot e^{\log z \cdot y}}{y}\\
\end{array}
\end{array}
if y < -1.10000000000000004e23Initial program 100.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--.f6463.1
Applied rewrites63.1%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6479.4
Applied rewrites79.4%
if -1.10000000000000004e23 < y < 7.6e-255Initial program 97.4%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6485.6
Applied rewrites85.6%
Taylor expanded in b around 0
pow-to-expN/A
lift-pow.f64N/A
lift--.f6479.7
Applied rewrites79.7%
if 7.6e-255 < y < 1.5e5Initial program 97.2%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6489.5
Applied rewrites89.5%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6487.9
Applied rewrites87.9%
if 1.5e5 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6480.3
Applied rewrites80.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -3.7e+83)
(* x (/ (exp (- b)) y))
(if (<= b 1.8e+18)
(* x (/ (* (pow z y) (pow a (- t 1.0))) y))
(/ x (* (* (exp b) y) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.7e+83) {
tmp = x * (exp(-b) / y);
} else if (b <= 1.8e+18) {
tmp = x * ((pow(z, y) * pow(a, (t - 1.0))) / y);
} else {
tmp = x / ((exp(b) * y) * 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 (b <= (-3.7d+83)) then
tmp = x * (exp(-b) / y)
else if (b <= 1.8d+18) then
tmp = x * (((z ** y) * (a ** (t - 1.0d0))) / y)
else
tmp = x / ((exp(b) * y) * 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 (b <= -3.7e+83) {
tmp = x * (Math.exp(-b) / y);
} else if (b <= 1.8e+18) {
tmp = x * ((Math.pow(z, y) * Math.pow(a, (t - 1.0))) / y);
} else {
tmp = x / ((Math.exp(b) * y) * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -3.7e+83: tmp = x * (math.exp(-b) / y) elif b <= 1.8e+18: tmp = x * ((math.pow(z, y) * math.pow(a, (t - 1.0))) / y) else: tmp = x / ((math.exp(b) * y) * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.7e+83) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); elseif (b <= 1.8e+18) tmp = Float64(x * Float64(Float64((z ^ y) * (a ^ Float64(t - 1.0))) / y)); else tmp = Float64(x / Float64(Float64(exp(b) * y) * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -3.7e+83) tmp = x * (exp(-b) / y); elseif (b <= 1.8e+18) tmp = x * (((z ^ y) * (a ^ (t - 1.0))) / y); else tmp = x / ((exp(b) * y) * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.7e+83], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.8e+18], N[(x * N[(N[(N[Power[z, y], $MachinePrecision] * N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(N[Exp[b], $MachinePrecision] * y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.7 \cdot 10^{+83}:\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \frac{{z}^{y} \cdot {a}^{\left(t - 1\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(e^{b} \cdot y\right) \cdot a}\\
\end{array}
\end{array}
if b < -3.7000000000000002e83Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6486.2
Applied rewrites86.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.2
Applied rewrites86.2%
if -3.7000000000000002e83 < b < 1.8e18Initial program 97.6%
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--.f6484.7
Applied rewrites84.7%
if 1.8e18 < b Initial program 100.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6467.3
Applied rewrites67.3%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6480.6
Applied rewrites80.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (* x (/ (pow z y) a)) y)))
(if (<= y -1.1e+23)
t_1
(if (<= y 7.6e-255)
(* x (/ (pow a (- t 1.0)) y))
(if (<= y 150000.0) (/ x (* (* (exp b) y) a)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * (pow(z, y) / a)) / y;
double tmp;
if (y <= -1.1e+23) {
tmp = t_1;
} else if (y <= 7.6e-255) {
tmp = x * (pow(a, (t - 1.0)) / y);
} else if (y <= 150000.0) {
tmp = x / ((exp(b) * y) * a);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (x * ((z ** y) / a)) / y
if (y <= (-1.1d+23)) then
tmp = t_1
else if (y <= 7.6d-255) then
tmp = x * ((a ** (t - 1.0d0)) / y)
else if (y <= 150000.0d0) then
tmp = x / ((exp(b) * y) * a)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * (Math.pow(z, y) / a)) / y;
double tmp;
if (y <= -1.1e+23) {
tmp = t_1;
} else if (y <= 7.6e-255) {
tmp = x * (Math.pow(a, (t - 1.0)) / y);
} else if (y <= 150000.0) {
tmp = x / ((Math.exp(b) * y) * a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * (math.pow(z, y) / a)) / y tmp = 0 if y <= -1.1e+23: tmp = t_1 elif y <= 7.6e-255: tmp = x * (math.pow(a, (t - 1.0)) / y) elif y <= 150000.0: tmp = x / ((math.exp(b) * y) * a) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * Float64((z ^ y) / a)) / y) tmp = 0.0 if (y <= -1.1e+23) tmp = t_1; elseif (y <= 7.6e-255) tmp = Float64(x * Float64((a ^ Float64(t - 1.0)) / y)); elseif (y <= 150000.0) tmp = Float64(x / Float64(Float64(exp(b) * y) * a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * ((z ^ y) / a)) / y; tmp = 0.0; if (y <= -1.1e+23) tmp = t_1; elseif (y <= 7.6e-255) tmp = x * ((a ^ (t - 1.0)) / y); elseif (y <= 150000.0) tmp = x / ((exp(b) * y) * a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -1.1e+23], t$95$1, If[LessEqual[y, 7.6e-255], N[(x * N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 150000.0], N[(x / N[(N[(N[Exp[b], $MachinePrecision] * y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{-255}:\\
\;\;\;\;x \cdot \frac{{a}^{\left(t - 1\right)}}{y}\\
\mathbf{elif}\;y \leq 150000:\\
\;\;\;\;\frac{x}{\left(e^{b} \cdot y\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.10000000000000004e23 or 1.5e5 < y Initial program 100.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--.f6465.5
Applied rewrites65.5%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6479.8
Applied rewrites79.8%
if -1.10000000000000004e23 < y < 7.6e-255Initial program 97.4%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6485.6
Applied rewrites85.6%
Taylor expanded in b around 0
pow-to-expN/A
lift-pow.f64N/A
lift--.f6479.7
Applied rewrites79.7%
if 7.6e-255 < y < 1.5e5Initial program 97.2%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6489.5
Applied rewrites89.5%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6487.9
Applied rewrites87.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (- t 1.0) -1e+23) (not (<= (- t 1.0) 20000000000.0))) (* x (/ (pow a t) y)) (/ x (* (* (exp b) y) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((t - 1.0) <= -1e+23) || !((t - 1.0) <= 20000000000.0)) {
tmp = x * (pow(a, t) / y);
} else {
tmp = x / ((exp(b) * y) * 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.0d0) <= (-1d+23)) .or. (.not. ((t - 1.0d0) <= 20000000000.0d0))) then
tmp = x * ((a ** t) / y)
else
tmp = x / ((exp(b) * y) * 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.0) <= -1e+23) || !((t - 1.0) <= 20000000000.0)) {
tmp = x * (Math.pow(a, t) / y);
} else {
tmp = x / ((Math.exp(b) * y) * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((t - 1.0) <= -1e+23) or not ((t - 1.0) <= 20000000000.0): tmp = x * (math.pow(a, t) / y) else: tmp = x / ((math.exp(b) * y) * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(t - 1.0) <= -1e+23) || !(Float64(t - 1.0) <= 20000000000.0)) tmp = Float64(x * Float64((a ^ t) / y)); else tmp = Float64(x / Float64(Float64(exp(b) * y) * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((t - 1.0) <= -1e+23) || ~(((t - 1.0) <= 20000000000.0))) tmp = x * ((a ^ t) / y); else tmp = x / ((exp(b) * y) * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(t - 1.0), $MachinePrecision], -1e+23], N[Not[LessEqual[N[(t - 1.0), $MachinePrecision], 20000000000.0]], $MachinePrecision]], N[(x * N[(N[Power[a, t], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(N[Exp[b], $MachinePrecision] * y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t - 1 \leq -1 \cdot 10^{+23} \lor \neg \left(t - 1 \leq 20000000000\right):\\
\;\;\;\;x \cdot \frac{{a}^{t}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(e^{b} \cdot y\right) \cdot a}\\
\end{array}
\end{array}
if (-.f64 t #s(literal 1 binary64)) < -9.9999999999999992e22 or 2e10 < (-.f64 t #s(literal 1 binary64)) Initial program 100.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6462.7
Applied rewrites62.7%
Taylor expanded in b around 0
pow-to-expN/A
lift-pow.f64N/A
lift--.f6480.0
Applied rewrites80.0%
Taylor expanded in t around inf
Applied rewrites80.0%
if -9.9999999999999992e22 < (-.f64 t #s(literal 1 binary64)) < 2e10Initial program 97.4%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6474.7
Applied rewrites74.7%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6476.3
Applied rewrites76.3%
Final simplification78.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -8.2e+82) (not (<= b 2.2e+17))) (* 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 <= -8.2e+82) || !(b <= 2.2e+17)) {
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 <= (-8.2d+82)) .or. (.not. (b <= 2.2d+17))) 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 <= -8.2e+82) || !(b <= 2.2e+17)) {
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 <= -8.2e+82) or not (b <= 2.2e+17): 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 <= -8.2e+82) || !(b <= 2.2e+17)) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); else tmp = Float64(x * Float64((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 <= -8.2e+82) || ~((b <= 2.2e+17))) 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, -8.2e+82], N[Not[LessEqual[b, 2.2e+17]], $MachinePrecision]], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.2 \cdot 10^{+82} \lor \neg \left(b \leq 2.2 \cdot 10^{+17}\right):\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{{a}^{\left(t - 1\right)}}{y}\\
\end{array}
\end{array}
if b < -8.1999999999999999e82 or 2.2e17 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6483.2
Applied rewrites83.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6483.2
Applied rewrites83.2%
if -8.1999999999999999e82 < b < 2.2e17Initial program 97.6%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6469.3
Applied rewrites69.3%
Taylor expanded in b around 0
pow-to-expN/A
lift-pow.f64N/A
lift--.f6471.4
Applied rewrites71.4%
Final simplification76.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ x (* a y))))
(if (or (<= t -1.85) (not (<= t 20000000000.0)))
(* x (/ (pow a t) y))
(fma (- (* (- b) (* t_1 -0.5)) t_1) b t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (a * y);
double tmp;
if ((t <= -1.85) || !(t <= 20000000000.0)) {
tmp = x * (pow(a, t) / y);
} else {
tmp = fma(((-b * (t_1 * -0.5)) - t_1), b, t_1);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(a * y)) tmp = 0.0 if ((t <= -1.85) || !(t <= 20000000000.0)) tmp = Float64(x * Float64((a ^ t) / y)); else tmp = fma(Float64(Float64(Float64(-b) * Float64(t_1 * -0.5)) - t_1), b, t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(a * y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -1.85], N[Not[LessEqual[t, 20000000000.0]], $MachinePrecision]], N[(x * N[(N[Power[a, t], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-b) * N[(t$95$1 * -0.5), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] * b + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{a \cdot y}\\
\mathbf{if}\;t \leq -1.85 \lor \neg \left(t \leq 20000000000\right):\\
\;\;\;\;x \cdot \frac{{a}^{t}}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-b\right) \cdot \left(t\_1 \cdot -0.5\right) - t\_1, b, t\_1\right)\\
\end{array}
\end{array}
if t < -1.8500000000000001 or 2e10 < t Initial program 100.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6462.1
Applied rewrites62.1%
Taylor expanded in b around 0
pow-to-expN/A
lift-pow.f64N/A
lift--.f6479.4
Applied rewrites79.4%
Taylor expanded in t around inf
Applied rewrites79.4%
if -1.8500000000000001 < t < 2e10Initial program 97.3%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6475.9
Applied rewrites75.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6476.7
Applied rewrites76.7%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites48.9%
Final simplification64.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ x (* a y))))
(if (<= b -250.0)
(fma (- (* (- b) (* t_1 -0.5)) t_1) b t_1)
(/
x
(* (* (fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0) y) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (a * y);
double tmp;
if (b <= -250.0) {
tmp = fma(((-b * (t_1 * -0.5)) - t_1), b, t_1);
} else {
tmp = x / ((fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * y) * a);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(a * y)) tmp = 0.0 if (b <= -250.0) tmp = fma(Float64(Float64(Float64(-b) * Float64(t_1 * -0.5)) - t_1), b, t_1); else tmp = Float64(x / Float64(Float64(fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * y) * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(a * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -250.0], N[(N[(N[((-b) * N[(t$95$1 * -0.5), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] * b + t$95$1), $MachinePrecision], N[(x / N[(N[(N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision] * y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{a \cdot y}\\
\mathbf{if}\;b \leq -250:\\
\;\;\;\;\mathsf{fma}\left(\left(-b\right) \cdot \left(t\_1 \cdot -0.5\right) - t\_1, b, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right) \cdot y\right) \cdot a}\\
\end{array}
\end{array}
if b < -250Initial program 100.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6469.9
Applied rewrites69.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6481.1
Applied rewrites81.1%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites56.3%
if -250 < b Initial program 98.1%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
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 t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6455.2
Applied rewrites55.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.f6449.9
Applied rewrites49.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ x (* a y))))
(if (<= b -250.0)
(fma (* b t_1) -1.0 t_1)
(/
x
(* (* (fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0) y) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (a * y);
double tmp;
if (b <= -250.0) {
tmp = fma((b * t_1), -1.0, t_1);
} else {
tmp = x / ((fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * y) * a);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(a * y)) tmp = 0.0 if (b <= -250.0) tmp = fma(Float64(b * t_1), -1.0, t_1); else tmp = Float64(x / Float64(Float64(fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * y) * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(a * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -250.0], N[(N[(b * t$95$1), $MachinePrecision] * -1.0 + t$95$1), $MachinePrecision], N[(x / N[(N[(N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision] * y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{a \cdot y}\\
\mathbf{if}\;b \leq -250:\\
\;\;\;\;\mathsf{fma}\left(b \cdot t\_1, -1, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right) \cdot y\right) \cdot a}\\
\end{array}
\end{array}
if b < -250Initial program 100.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6469.9
Applied rewrites69.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6481.1
Applied rewrites81.1%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6440.7
Applied rewrites40.7%
if -250 < b Initial program 98.1%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
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 t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6455.2
Applied rewrites55.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.f6449.9
Applied rewrites49.9%
(FPCore (x y z t a b) :precision binary64 (if (<= b -250.0) (/ x (* y a)) (/ x (* (fma b y y) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -250.0) {
tmp = x / (y * a);
} else {
tmp = x / (fma(b, y, y) * a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -250.0) tmp = Float64(x / Float64(y * a)); else tmp = Float64(x / Float64(fma(b, y, y) * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -250.0], N[(x / N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(b * y + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -250:\\
\;\;\;\;\frac{x}{y \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(b, y, y\right) \cdot a}\\
\end{array}
\end{array}
if b < -250Initial program 100.0%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6469.9
Applied rewrites69.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6481.1
Applied rewrites81.1%
Taylor expanded in b around 0
Applied rewrites33.8%
if -250 < b Initial program 98.1%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
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 t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6455.2
Applied rewrites55.2%
Taylor expanded in b around 0
+-commutativeN/A
lower-fma.f6440.9
Applied rewrites40.9%
(FPCore (x y z t a b) :precision binary64 (/ x (* y a)))
double code(double x, double y, double z, double t, double a, double b) {
return x / (y * a);
}
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 / (y * a)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x / (y * a);
}
def code(x, y, z, t, a, b): return x / (y * a)
function code(x, y, z, t, a, b) return Float64(x / Float64(y * a)) end
function tmp = code(x, y, z, t, a, b) tmp = x / (y * a); end
code[x_, y_, z_, t_, a_, b_] := N[(x / N[(y * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y \cdot a}
\end{array}
Initial program 98.6%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
div-expN/A
pow-to-expN/A
lower-/.f64N/A
lower-pow.f64N/A
lift--.f64N/A
lower-exp.f6469.0
Applied rewrites69.0%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6462.6
Applied rewrites62.6%
Taylor expanded in b around 0
Applied rewrites35.8%
herbie shell --seed 2025085
(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))