
(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 15 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 99.0%
(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 (- INFINITY))
(/ (* x (/ 1.0 a)) y)
(if (<= t_1 2e+290)
(/
(*
x
(/ 1.0 (* (fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0) a)))
y)
(* x (/ (/ 1.0 a) y))))))
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 <= -((double) INFINITY)) {
tmp = (x * (1.0 / a)) / y;
} else if (t_1 <= 2e+290) {
tmp = (x * (1.0 / (fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * a))) / y;
} else {
tmp = x * ((1.0 / a) / y);
}
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 <= Float64(-Inf)) tmp = Float64(Float64(x * Float64(1.0 / a)) / y); elseif (t_1 <= 2e+290) tmp = Float64(Float64(x * Float64(1.0 / Float64(fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * a))) / y); else tmp = Float64(x * Float64(Float64(1.0 / a) / y)); 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, (-Infinity)], N[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 2e+290], N[(N[(x * N[(1.0 / N[(N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x * N[(N[(1.0 / a), $MachinePrecision] / y), $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 -\infty:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+290}:\\
\;\;\;\;\frac{x \cdot \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right) \cdot a}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\
\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) < -inf.0Initial 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.f6465.2
Applied rewrites65.2%
Taylor expanded in y around 0
Applied rewrites25.8%
if -inf.0 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 2.00000000000000012e290Initial program 98.0%
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.f6470.2
Applied rewrites70.2%
Taylor expanded in t around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6466.4
Applied rewrites66.4%
lift-pow.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
unpow-1N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f6466.4
Applied rewrites66.4%
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.f6467.6
Applied rewrites67.6%
if 2.00000000000000012e290 < (/.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 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--.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6466.9
Applied rewrites66.9%
Taylor expanded in y around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6422.2
Applied rewrites22.2%
(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 (- INFINITY))
(/ (* x (/ 1.0 a)) y)
(if (<= t_1 2e+290)
(/ (* x (/ 1.0 (* (fma (fma 0.5 b 1.0) b 1.0) a))) y)
(* x (/ (/ 1.0 a) y))))))
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 <= -((double) INFINITY)) {
tmp = (x * (1.0 / a)) / y;
} else if (t_1 <= 2e+290) {
tmp = (x * (1.0 / (fma(fma(0.5, b, 1.0), b, 1.0) * a))) / y;
} else {
tmp = x * ((1.0 / a) / y);
}
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 <= Float64(-Inf)) tmp = Float64(Float64(x * Float64(1.0 / a)) / y); elseif (t_1 <= 2e+290) tmp = Float64(Float64(x * Float64(1.0 / Float64(fma(fma(0.5, b, 1.0), b, 1.0) * a))) / y); else tmp = Float64(x * Float64(Float64(1.0 / a) / y)); 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, (-Infinity)], N[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 2e+290], N[(N[(x * N[(1.0 / N[(N[(N[(0.5 * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x * N[(N[(1.0 / a), $MachinePrecision] / y), $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 -\infty:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+290}:\\
\;\;\;\;\frac{x \cdot \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, b, 1\right), b, 1\right) \cdot a}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\
\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) < -inf.0Initial 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.f6465.2
Applied rewrites65.2%
Taylor expanded in y around 0
Applied rewrites25.8%
if -inf.0 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 2.00000000000000012e290Initial program 98.0%
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.f6470.2
Applied rewrites70.2%
Taylor expanded in t around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6466.4
Applied rewrites66.4%
lift-pow.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
unpow-1N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f6466.4
Applied rewrites66.4%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6458.4
Applied rewrites58.4%
if 2.00000000000000012e290 < (/.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 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--.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6466.9
Applied rewrites66.9%
Taylor expanded in y around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6422.2
Applied rewrites22.2%
(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 (- INFINITY))
(/ (* x (/ 1.0 a)) y)
(if (<= t_1 2e+290)
(/ (* x (/ 1.0 (fma b a a))) y)
(* x (/ (/ 1.0 a) y))))))
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 <= -((double) INFINITY)) {
tmp = (x * (1.0 / a)) / y;
} else if (t_1 <= 2e+290) {
tmp = (x * (1.0 / fma(b, a, a))) / y;
} else {
tmp = x * ((1.0 / a) / y);
}
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 <= Float64(-Inf)) tmp = Float64(Float64(x * Float64(1.0 / a)) / y); elseif (t_1 <= 2e+290) tmp = Float64(Float64(x * Float64(1.0 / fma(b, a, a))) / y); else tmp = Float64(x * Float64(Float64(1.0 / a) / y)); 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, (-Infinity)], N[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 2e+290], N[(N[(x * N[(1.0 / N[(b * a + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x * N[(N[(1.0 / a), $MachinePrecision] / y), $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 -\infty:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+290}:\\
\;\;\;\;\frac{x \cdot \frac{1}{\mathsf{fma}\left(b, a, a\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\
\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) < -inf.0Initial 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.f6465.2
Applied rewrites65.2%
Taylor expanded in y around 0
Applied rewrites25.8%
if -inf.0 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 2.00000000000000012e290Initial program 98.0%
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.f6470.2
Applied rewrites70.2%
Taylor expanded in t around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6466.4
Applied rewrites66.4%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6447.0
Applied rewrites47.0%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6447.0
Applied rewrites47.0%
if 2.00000000000000012e290 < (/.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 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--.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6466.9
Applied rewrites66.9%
Taylor expanded in y around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6422.2
Applied rewrites22.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.75e+47) (not (<= y 1.9e+34))) (* x (/ (exp (- (fma (log z) y (- (log a))) b)) y)) (/ (* x (exp (- (* (log a) (- t 1.0)) b))) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.75e+47) || !(y <= 1.9e+34)) {
tmp = x * (exp((fma(log(z), y, -log(a)) - b)) / y);
} else {
tmp = (x * exp(((log(a) * (t - 1.0)) - b))) / y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.75e+47) || !(y <= 1.9e+34)) tmp = Float64(x * Float64(exp(Float64(fma(log(z), y, Float64(-log(a))) - b)) / y)); else tmp = Float64(Float64(x * exp(Float64(Float64(log(a) * Float64(t - 1.0)) - b))) / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.75e+47], N[Not[LessEqual[y, 1.9e+34]], $MachinePrecision]], N[(x * N[(N[Exp[N[(N[(N[Log[z], $MachinePrecision] * y + (-N[Log[a], $MachinePrecision])), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Exp[N[(N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{+47} \lor \neg \left(y \leq 1.9 \cdot 10^{+34}\right):\\
\;\;\;\;x \cdot \frac{e^{\mathsf{fma}\left(\log z, y, -\log a\right) - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot e^{\log a \cdot \left(t - 1\right) - b}}{y}\\
\end{array}
\end{array}
if y < -2.7499999999999999e47 or 1.9000000000000001e34 < y Initial program 100.0%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-exp.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift-log.f6495.2
Applied rewrites95.2%
if -2.7499999999999999e47 < y < 1.9000000000000001e34Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6496.1
Applied rewrites96.1%
Final simplification95.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -5.4e+54) (not (<= y 5.6e+51))) (* x (/ (/ (pow z y) a) y)) (/ (* x (exp (- (* (log a) (- t 1.0)) b))) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -5.4e+54) || !(y <= 5.6e+51)) {
tmp = x * ((pow(z, y) / a) / y);
} else {
tmp = (x * exp(((log(a) * (t - 1.0)) - b))) / 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 <= (-5.4d+54)) .or. (.not. (y <= 5.6d+51))) then
tmp = x * (((z ** y) / a) / y)
else
tmp = (x * exp(((log(a) * (t - 1.0d0)) - b))) / 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 <= -5.4e+54) || !(y <= 5.6e+51)) {
tmp = x * ((Math.pow(z, y) / a) / y);
} else {
tmp = (x * Math.exp(((Math.log(a) * (t - 1.0)) - b))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -5.4e+54) or not (y <= 5.6e+51): tmp = x * ((math.pow(z, y) / a) / y) else: tmp = (x * math.exp(((math.log(a) * (t - 1.0)) - b))) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -5.4e+54) || !(y <= 5.6e+51)) tmp = Float64(x * Float64(Float64((z ^ y) / a) / y)); else tmp = Float64(Float64(x * exp(Float64(Float64(log(a) * Float64(t - 1.0)) - b))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -5.4e+54) || ~((y <= 5.6e+51))) tmp = x * (((z ^ y) / a) / y); else tmp = (x * exp(((log(a) * (t - 1.0)) - b))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -5.4e+54], N[Not[LessEqual[y, 5.6e+51]], $MachinePrecision]], N[(x * N[(N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Exp[N[(N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{+54} \lor \neg \left(y \leq 5.6 \cdot 10^{+51}\right):\\
\;\;\;\;x \cdot \frac{\frac{{z}^{y}}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot e^{\log a \cdot \left(t - 1\right) - b}}{y}\\
\end{array}
\end{array}
if y < -5.40000000000000022e54 or 5.60000000000000009e51 < 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--.f6472.1
Applied rewrites72.1%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6491.7
Applied rewrites91.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6491.7
Applied rewrites91.7%
if -5.40000000000000022e54 < y < 5.60000000000000009e51Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lift-log.f64N/A
lift--.f6496.2
Applied rewrites96.2%
Final simplification94.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.3e+34)
(* x (/ (exp (- b)) y))
(if (<= b 2.05e+108)
(/ (* x (* (pow z y) (pow a (- t 1.0)))) y)
(/
(*
x
(/ 1.0 (* (fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0) a)))
y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.3e+34) {
tmp = x * (exp(-b) / y);
} else if (b <= 2.05e+108) {
tmp = (x * (pow(z, y) * pow(a, (t - 1.0)))) / y;
} else {
tmp = (x * (1.0 / (fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * a))) / y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.3e+34) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); elseif (b <= 2.05e+108) tmp = Float64(Float64(x * Float64((z ^ y) * (a ^ Float64(t - 1.0)))) / y); else tmp = Float64(Float64(x * Float64(1.0 / Float64(fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * a))) / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.3e+34], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.05e+108], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] * N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[(1.0 / N[(N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.3 \cdot 10^{+34}:\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{elif}\;b \leq 2.05 \cdot 10^{+108}:\\
\;\;\;\;\frac{x \cdot \left({z}^{y} \cdot {a}^{\left(t - 1\right)}\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right) \cdot a}}{y}\\
\end{array}
\end{array}
if b < -1.29999999999999999e34Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6475.4
Applied rewrites75.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6475.4
Applied rewrites75.4%
if -1.29999999999999999e34 < b < 2.05e108Initial program 98.5%
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.6
Applied rewrites83.6%
if 2.05e108 < b Initial program 100.0%
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.f6471.5
Applied rewrites71.5%
Taylor expanded in t around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6488.8
Applied rewrites88.8%
lift-pow.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
unpow-1N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f6488.8
Applied rewrites88.8%
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.f6488.8
Applied rewrites88.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (/ (/ (pow z y) a) y))))
(if (<= y -1.55e+59)
t_1
(if (<= y 3e-175)
(/ (* x (/ 1.0 (* (exp b) a))) y)
(if (<= y 1.85e+34)
(/ (* x (/ (pow a (- t 1.0)) (fma (fma 0.5 b 1.0) b 1.0))) y)
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.55e+59) {
tmp = t_1;
} else if (y <= 3e-175) {
tmp = (x * (1.0 / (exp(b) * a))) / y;
} else if (y <= 1.85e+34) {
tmp = (x * (pow(a, (t - 1.0)) / fma(fma(0.5, b, 1.0), b, 1.0))) / y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x * Float64(Float64((z ^ y) / a) / y)) tmp = 0.0 if (y <= -1.55e+59) tmp = t_1; elseif (y <= 3e-175) tmp = Float64(Float64(x * Float64(1.0 / Float64(exp(b) * a))) / y); elseif (y <= 1.85e+34) tmp = Float64(Float64(x * Float64((a ^ Float64(t - 1.0)) / fma(fma(0.5, b, 1.0), b, 1.0))) / y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[(N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.55e+59], t$95$1, If[LessEqual[y, 3e-175], N[(N[(x * N[(1.0 / N[(N[Exp[b], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 1.85e+34], N[(N[(x * N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / N[(N[(0.5 * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{\frac{{z}^{y}}{a}}{y}\\
\mathbf{if}\;y \leq -1.55 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-175}:\\
\;\;\;\;\frac{x \cdot \frac{1}{e^{b} \cdot a}}{y}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+34}:\\
\;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, b, 1\right), b, 1\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.55000000000000007e59 or 1.85000000000000004e34 < 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--.f6472.6
Applied rewrites72.6%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6491.8
Applied rewrites91.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6491.8
Applied rewrites91.8%
if -1.55000000000000007e59 < y < 3e-175Initial 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.f6480.0
Applied rewrites80.0%
Taylor expanded in t around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6478.1
Applied rewrites78.1%
lift-pow.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
unpow-1N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f6478.1
Applied rewrites78.1%
if 3e-175 < y < 1.85000000000000004e34Initial program 99.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.f6475.7
Applied rewrites75.7%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6473.6
Applied rewrites73.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (pow z y) a)))
(if (<= y -1.55e+59)
(* x (/ t_1 y))
(if (<= y 300000000000.0)
(/ (* x (/ 1.0 (* (exp b) a))) y)
(/ (* x t_1) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow(z, y) / a;
double tmp;
if (y <= -1.55e+59) {
tmp = x * (t_1 / y);
} else if (y <= 300000000000.0) {
tmp = (x * (1.0 / (exp(b) * a))) / y;
} else {
tmp = (x * t_1) / 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) :: t_1
real(8) :: tmp
t_1 = (z ** y) / a
if (y <= (-1.55d+59)) then
tmp = x * (t_1 / y)
else if (y <= 300000000000.0d0) then
tmp = (x * (1.0d0 / (exp(b) * a))) / y
else
tmp = (x * t_1) / y
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(z, y) / a;
double tmp;
if (y <= -1.55e+59) {
tmp = x * (t_1 / y);
} else if (y <= 300000000000.0) {
tmp = (x * (1.0 / (Math.exp(b) * a))) / y;
} else {
tmp = (x * t_1) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.pow(z, y) / a tmp = 0 if y <= -1.55e+59: tmp = x * (t_1 / y) elif y <= 300000000000.0: tmp = (x * (1.0 / (math.exp(b) * a))) / y else: tmp = (x * t_1) / y return tmp
function code(x, y, z, t, a, b) t_1 = Float64((z ^ y) / a) tmp = 0.0 if (y <= -1.55e+59) tmp = Float64(x * Float64(t_1 / y)); elseif (y <= 300000000000.0) tmp = Float64(Float64(x * Float64(1.0 / Float64(exp(b) * a))) / y); else tmp = Float64(Float64(x * t_1) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z ^ y) / a; tmp = 0.0; if (y <= -1.55e+59) tmp = x * (t_1 / y); elseif (y <= 300000000000.0) tmp = (x * (1.0 / (exp(b) * a))) / y; else tmp = (x * t_1) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[y, -1.55e+59], N[(x * N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 300000000000.0], N[(N[(x * N[(1.0 / N[(N[Exp[b], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * t$95$1), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{{z}^{y}}{a}\\
\mathbf{if}\;y \leq -1.55 \cdot 10^{+59}:\\
\;\;\;\;x \cdot \frac{t\_1}{y}\\
\mathbf{elif}\;y \leq 300000000000:\\
\;\;\;\;\frac{x \cdot \frac{1}{e^{b} \cdot a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t\_1}{y}\\
\end{array}
\end{array}
if y < -1.55000000000000007e59Initial 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--.f6466.7
Applied rewrites66.7%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6493.1
Applied rewrites93.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6493.1
Applied rewrites93.1%
if -1.55000000000000007e59 < y < 3e11Initial program 98.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.4
Applied rewrites79.4%
Taylor expanded in t around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6474.4
Applied rewrites74.4%
lift-pow.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
unpow-1N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f6474.4
Applied rewrites74.4%
if 3e11 < 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--.f6475.1
Applied rewrites75.1%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6487.0
Applied rewrites87.0%
Taylor expanded in y around 0
Applied rewrites27.2%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6487.0
Applied rewrites87.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -9e+35) (not (<= y 1.85e+34))) (* x (/ (/ (pow z y) a) y)) (/ (* x (/ (pow a t) a)) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -9e+35) || !(y <= 1.85e+34)) {
tmp = x * ((pow(z, y) / a) / y);
} else {
tmp = (x * (pow(a, t) / 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 ((y <= (-9d+35)) .or. (.not. (y <= 1.85d+34))) then
tmp = x * (((z ** y) / a) / y)
else
tmp = (x * ((a ** t) / 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 ((y <= -9e+35) || !(y <= 1.85e+34)) {
tmp = x * ((Math.pow(z, y) / a) / y);
} else {
tmp = (x * (Math.pow(a, t) / a)) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -9e+35) or not (y <= 1.85e+34): tmp = x * ((math.pow(z, y) / a) / y) else: tmp = (x * (math.pow(a, t) / a)) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -9e+35) || !(y <= 1.85e+34)) tmp = Float64(x * Float64(Float64((z ^ y) / a) / y)); else tmp = Float64(Float64(x * Float64((a ^ t) / a)) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -9e+35) || ~((y <= 1.85e+34))) tmp = x * (((z ^ y) / a) / y); else tmp = (x * ((a ^ t) / a)) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -9e+35], N[Not[LessEqual[y, 1.85e+34]], $MachinePrecision]], N[(x * N[(N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[Power[a, t], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+35} \lor \neg \left(y \leq 1.85 \cdot 10^{+34}\right):\\
\;\;\;\;x \cdot \frac{\frac{{z}^{y}}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{{a}^{t}}{a}}{y}\\
\end{array}
\end{array}
if y < -8.9999999999999993e35 or 1.85000000000000004e34 < 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--.f6472.4
Applied rewrites72.4%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6491.2
Applied rewrites91.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6491.2
Applied rewrites91.2%
if -8.9999999999999993e35 < y < 1.85000000000000004e34Initial 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--.f6464.4
Applied rewrites64.4%
lift--.f64N/A
lift-pow.f64N/A
pow-subN/A
unpow1N/A
lower-/.f64N/A
lower-pow.f6464.5
Applied rewrites64.5%
Taylor expanded in y around 0
lift-pow.f64N/A
lift-/.f6466.1
Applied rewrites66.1%
Final simplification78.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -9e+35) (not (<= y 1.85e+34))) (* x (/ (/ (pow z y) a) 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 ((y <= -9e+35) || !(y <= 1.85e+34)) {
tmp = x * ((pow(z, y) / a) / 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 ((y <= (-9d+35)) .or. (.not. (y <= 1.85d+34))) then
tmp = x * (((z ** y) / a) / 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 ((y <= -9e+35) || !(y <= 1.85e+34)) {
tmp = x * ((Math.pow(z, y) / a) / y);
} else {
tmp = (x * Math.pow(a, (t - 1.0))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -9e+35) or not (y <= 1.85e+34): tmp = x * ((math.pow(z, y) / a) / 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 ((y <= -9e+35) || !(y <= 1.85e+34)) tmp = Float64(x * Float64(Float64((z ^ y) / a) / 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 ((y <= -9e+35) || ~((y <= 1.85e+34))) tmp = x * (((z ^ y) / a) / y); else tmp = (x * (a ^ (t - 1.0))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -9e+35], N[Not[LessEqual[y, 1.85e+34]], $MachinePrecision]], N[(x * N[(N[(N[Power[z, y], $MachinePrecision] / a), $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}\;y \leq -9 \cdot 10^{+35} \lor \neg \left(y \leq 1.85 \cdot 10^{+34}\right):\\
\;\;\;\;x \cdot \frac{\frac{{z}^{y}}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot {a}^{\left(t - 1\right)}}{y}\\
\end{array}
\end{array}
if y < -8.9999999999999993e35 or 1.85000000000000004e34 < 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--.f6472.4
Applied rewrites72.4%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6491.2
Applied rewrites91.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6491.2
Applied rewrites91.2%
if -8.9999999999999993e35 < y < 1.85000000000000004e34Initial program 98.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.f6479.7
Applied rewrites79.7%
Taylor expanded in b around 0
pow-to-expN/A
lift-pow.f64N/A
lift--.f6466.0
Applied rewrites66.0%
Final simplification78.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -0.0018)
(* x (/ (exp (- b)) y))
(if (<= b 2.05e+108)
(/ (* x (pow a (- t 1.0))) y)
(/
(*
x
(/ 1.0 (* (fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0) a)))
y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -0.0018) {
tmp = x * (exp(-b) / y);
} else if (b <= 2.05e+108) {
tmp = (x * pow(a, (t - 1.0))) / y;
} else {
tmp = (x * (1.0 / (fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * a))) / y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -0.0018) tmp = Float64(x * Float64(exp(Float64(-b)) / y)); elseif (b <= 2.05e+108) tmp = Float64(Float64(x * (a ^ Float64(t - 1.0))) / y); else tmp = Float64(Float64(x * Float64(1.0 / Float64(fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0) * a))) / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -0.0018], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.05e+108], N[(N[(x * N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[(1.0 / N[(N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0018:\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{elif}\;b \leq 2.05 \cdot 10^{+108}:\\
\;\;\;\;\frac{x \cdot {a}^{\left(t - 1\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right) \cdot a}}{y}\\
\end{array}
\end{array}
if b < -0.0018Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6473.1
Applied rewrites73.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.1
Applied rewrites73.1%
if -0.0018 < b < 2.05e108Initial program 98.4%
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.f6463.6
Applied rewrites63.6%
Taylor expanded in b around 0
pow-to-expN/A
lift-pow.f64N/A
lift--.f6463.4
Applied rewrites63.4%
if 2.05e108 < b Initial program 100.0%
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.f6471.5
Applied rewrites71.5%
Taylor expanded in t around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-exp.f6488.8
Applied rewrites88.8%
lift-pow.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
unpow-1N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f6488.8
Applied rewrites88.8%
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.f6488.8
Applied rewrites88.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -230.0) (not (<= b 1.6e-95))) (* 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 <= -230.0) || !(b <= 1.6e-95)) {
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 <= (-230.0d0)) .or. (.not. (b <= 1.6d-95))) 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 <= -230.0) || !(b <= 1.6e-95)) {
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 <= -230.0) or not (b <= 1.6e-95): 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 <= -230.0) || !(b <= 1.6e-95)) tmp = Float64(x * Float64(exp(Float64(-b)) / 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 ((b <= -230.0) || ~((b <= 1.6e-95))) 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, -230.0], N[Not[LessEqual[b, 1.6e-95]], $MachinePrecision]], N[(x * N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(1.0 / a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -230 \lor \neg \left(b \leq 1.6 \cdot 10^{-95}\right):\\
\;\;\;\;x \cdot \frac{e^{-b}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\
\end{array}
\end{array}
if b < -230 or 1.5999999999999999e-95 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6470.0
Applied rewrites70.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6470.0
Applied rewrites70.0%
if -230 < b < 1.5999999999999999e-95Initial program 97.8%
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--.f6485.8
Applied rewrites85.8%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6479.7
Applied rewrites79.7%
Taylor expanded in y around 0
Applied rewrites42.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6443.3
Applied rewrites43.3%
Final simplification58.6%
(FPCore (x y z t a b) :precision binary64 (if (<= a 1e-102) (/ (* 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 <= 1e-102) {
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 <= 1d-102) 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 <= 1e-102) {
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 <= 1e-102: 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 <= 1e-102) 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 <= 1e-102) 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, 1e-102], 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 10^{-102}:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\
\end{array}
\end{array}
if a < 9.99999999999999933e-103Initial program 99.5%
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--.f6470.0
Applied rewrites70.0%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6464.1
Applied rewrites64.1%
Taylor expanded in y around 0
Applied rewrites34.8%
if 9.99999999999999933e-103 < a Initial program 98.8%
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.3
Applied rewrites67.3%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6461.6
Applied rewrites61.6%
Taylor expanded in y around 0
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6429.1
Applied rewrites29.1%
(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 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--.f6468.3
Applied rewrites68.3%
Taylor expanded in t around 0
lower-/.f64N/A
lift-pow.f6462.5
Applied rewrites62.5%
Taylor expanded in y around 0
Applied rewrites29.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6429.3
Applied rewrites29.3%
(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 2025040
(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))