
(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 17 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.4%
(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-160)
(/
(*
x
(fma
(- (* (/ (fma -0.16666666666666666 b 0.5) a) b) (pow a -1.0))
b
(pow a -1.0)))
y)
(if (<= t_1 0.0)
(/ (* x (/ (- b) a)) y)
(/ (* x (fma (- (* (/ b a) 0.5) (pow a -1.0)) b (pow a -1.0))) 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 <= -5e-160) {
tmp = (x * fma((((fma(-0.16666666666666666, b, 0.5) / a) * b) - pow(a, -1.0)), b, pow(a, -1.0))) / y;
} else if (t_1 <= 0.0) {
tmp = (x * (-b / a)) / y;
} else {
tmp = (x * fma((((b / a) * 0.5) - pow(a, -1.0)), b, pow(a, -1.0))) / 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 <= -5e-160) tmp = Float64(Float64(x * fma(Float64(Float64(Float64(fma(-0.16666666666666666, b, 0.5) / a) * b) - (a ^ -1.0)), b, (a ^ -1.0))) / y); elseif (t_1 <= 0.0) tmp = Float64(Float64(x * Float64(Float64(-b) / a)) / y); else tmp = Float64(Float64(x * fma(Float64(Float64(Float64(b / a) * 0.5) - (a ^ -1.0)), b, (a ^ -1.0))) / 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, -5e-160], N[(N[(x * N[(N[(N[(N[(N[(-0.16666666666666666 * b + 0.5), $MachinePrecision] / a), $MachinePrecision] * b), $MachinePrecision] - N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision] * b + N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(x * N[((-b) / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[(N[(N[(N[(b / a), $MachinePrecision] * 0.5), $MachinePrecision] - N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision] * b + N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $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^{-160}:\\
\;\;\;\;\frac{x \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(-0.16666666666666666, b, 0.5\right)}{a} \cdot b - {a}^{-1}, b, {a}^{-1}\right)}{y}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{x \cdot \frac{-b}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \mathsf{fma}\left(\frac{b}{a} \cdot 0.5 - {a}^{-1}, b, {a}^{-1}\right)}{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) < -4.99999999999999994e-160Initial program 99.0%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6462.1
Applied rewrites62.1%
Taylor expanded in t around 0
Applied rewrites52.7%
Taylor expanded in b around 0
Applied rewrites41.8%
if -4.99999999999999994e-160 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 0.0Initial program 98.3%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6465.5
Applied rewrites65.5%
Taylor expanded in t around 0
Applied rewrites51.6%
Taylor expanded in b around 0
Applied rewrites20.3%
Taylor expanded in b around inf
Applied rewrites34.4%
if 0.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) Initial program 98.2%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
Applied rewrites59.6%
Taylor expanded in b around 0
Applied rewrites46.0%
Final simplification39.7%
(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-160)
(/ (* x (/ (/ (- (* b b) 1.0) (+ b 1.0)) (- a))) y)
(if (<= t_1 0.0)
(/ (* x (/ (- b) a)) y)
(/ (* x (fma (- (* (/ b a) 0.5) (pow a -1.0)) b (pow a -1.0))) 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 <= -5e-160) {
tmp = (x * ((((b * b) - 1.0) / (b + 1.0)) / -a)) / y;
} else if (t_1 <= 0.0) {
tmp = (x * (-b / a)) / y;
} else {
tmp = (x * fma((((b / a) * 0.5) - pow(a, -1.0)), b, pow(a, -1.0))) / 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 <= -5e-160) tmp = Float64(Float64(x * Float64(Float64(Float64(Float64(b * b) - 1.0) / Float64(b + 1.0)) / Float64(-a))) / y); elseif (t_1 <= 0.0) tmp = Float64(Float64(x * Float64(Float64(-b) / a)) / y); else tmp = Float64(Float64(x * fma(Float64(Float64(Float64(b / a) * 0.5) - (a ^ -1.0)), b, (a ^ -1.0))) / 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, -5e-160], N[(N[(x * N[(N[(N[(N[(b * b), $MachinePrecision] - 1.0), $MachinePrecision] / N[(b + 1.0), $MachinePrecision]), $MachinePrecision] / (-a)), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(x * N[((-b) / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[(N[(N[(N[(b / a), $MachinePrecision] * 0.5), $MachinePrecision] - N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision] * b + N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $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^{-160}:\\
\;\;\;\;\frac{x \cdot \frac{\frac{b \cdot b - 1}{b + 1}}{-a}}{y}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{x \cdot \frac{-b}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \mathsf{fma}\left(\frac{b}{a} \cdot 0.5 - {a}^{-1}, b, {a}^{-1}\right)}{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) < -4.99999999999999994e-160Initial program 99.0%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6462.1
Applied rewrites62.1%
Taylor expanded in t around 0
Applied rewrites52.7%
Taylor expanded in b around 0
Applied rewrites35.7%
Applied rewrites38.8%
if -4.99999999999999994e-160 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 0.0Initial program 98.3%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6465.5
Applied rewrites65.5%
Taylor expanded in t around 0
Applied rewrites51.6%
Taylor expanded in b around 0
Applied rewrites20.3%
Taylor expanded in b around inf
Applied rewrites34.4%
if 0.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) Initial program 98.2%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
Applied rewrites59.6%
Taylor expanded in b around 0
Applied rewrites46.0%
Final simplification39.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 (or (<= t_1 -5e-160) (not (<= t_1 0.0)))
(/ (* x (/ (/ (- (* b b) 1.0) (+ b 1.0)) (- a))) y)
(/ (* x (/ (- b) 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 <= -5e-160) || !(t_1 <= 0.0)) {
tmp = (x * ((((b * b) - 1.0) / (b + 1.0)) / -a)) / y;
} else {
tmp = (x * (-b / 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) :: t_1
real(8) :: tmp
t_1 = (x * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y
if ((t_1 <= (-5d-160)) .or. (.not. (t_1 <= 0.0d0))) then
tmp = (x * ((((b * b) - 1.0d0) / (b + 1.0d0)) / -a)) / y
else
tmp = (x * (-b / 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 t_1 = (x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y;
double tmp;
if ((t_1 <= -5e-160) || !(t_1 <= 0.0)) {
tmp = (x * ((((b * b) - 1.0) / (b + 1.0)) / -a)) / y;
} else {
tmp = (x * (-b / a)) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y tmp = 0 if (t_1 <= -5e-160) or not (t_1 <= 0.0): tmp = (x * ((((b * b) - 1.0) / (b + 1.0)) / -a)) / y else: tmp = (x * (-b / 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 <= -5e-160) || !(t_1 <= 0.0)) tmp = Float64(Float64(x * Float64(Float64(Float64(Float64(b * b) - 1.0) / Float64(b + 1.0)) / Float64(-a))) / y); else tmp = Float64(Float64(x * Float64(Float64(-b) / a)) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; tmp = 0.0; if ((t_1 <= -5e-160) || ~((t_1 <= 0.0))) tmp = (x * ((((b * b) - 1.0) / (b + 1.0)) / -a)) / y; else tmp = (x * (-b / a)) / y; end tmp_2 = 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[Or[LessEqual[t$95$1, -5e-160], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(x * N[(N[(N[(N[(b * b), $MachinePrecision] - 1.0), $MachinePrecision] / N[(b + 1.0), $MachinePrecision]), $MachinePrecision] / (-a)), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[((-b) / a), $MachinePrecision]), $MachinePrecision] / y), $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^{-160} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\frac{x \cdot \frac{\frac{b \cdot b - 1}{b + 1}}{-a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{-b}{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) < -4.99999999999999994e-160 or 0.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) Initial program 98.5%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6466.1
Applied rewrites66.1%
Taylor expanded in t around 0
Applied rewrites56.5%
Taylor expanded in b around 0
Applied rewrites37.8%
Applied rewrites44.6%
if -4.99999999999999994e-160 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 0.0Initial program 98.3%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6465.5
Applied rewrites65.5%
Taylor expanded in t around 0
Applied rewrites51.6%
Taylor expanded in b around 0
Applied rewrites20.3%
Taylor expanded in b around inf
Applied rewrites34.4%
Final simplification40.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 (or (<= t_1 -5e-160) (not (<= t_1 0.0)))
(/ (* x (/ (- 1.0 b) a)) y)
(/ (* x (/ (- b) 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 <= -5e-160) || !(t_1 <= 0.0)) {
tmp = (x * ((1.0 - b) / a)) / y;
} else {
tmp = (x * (-b / 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) :: t_1
real(8) :: tmp
t_1 = (x * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y
if ((t_1 <= (-5d-160)) .or. (.not. (t_1 <= 0.0d0))) then
tmp = (x * ((1.0d0 - b) / a)) / y
else
tmp = (x * (-b / 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 t_1 = (x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y;
double tmp;
if ((t_1 <= -5e-160) || !(t_1 <= 0.0)) {
tmp = (x * ((1.0 - b) / a)) / y;
} else {
tmp = (x * (-b / a)) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y tmp = 0 if (t_1 <= -5e-160) or not (t_1 <= 0.0): tmp = (x * ((1.0 - b) / a)) / y else: tmp = (x * (-b / 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 <= -5e-160) || !(t_1 <= 0.0)) tmp = Float64(Float64(x * Float64(Float64(1.0 - b) / a)) / y); else tmp = Float64(Float64(x * Float64(Float64(-b) / a)) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; tmp = 0.0; if ((t_1 <= -5e-160) || ~((t_1 <= 0.0))) tmp = (x * ((1.0 - b) / a)) / y; else tmp = (x * (-b / a)) / y; end tmp_2 = 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[Or[LessEqual[t$95$1, -5e-160], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(x * N[(N[(1.0 - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[((-b) / a), $MachinePrecision]), $MachinePrecision] / y), $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^{-160} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\frac{x \cdot \frac{1 - b}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{-b}{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) < -4.99999999999999994e-160 or 0.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) Initial program 98.5%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6466.1
Applied rewrites66.1%
Taylor expanded in t around 0
Applied rewrites56.5%
Taylor expanded in b around 0
Applied rewrites37.8%
Taylor expanded in b around 0
Applied rewrites37.8%
if -4.99999999999999994e-160 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 0.0Initial program 98.3%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6465.5
Applied rewrites65.5%
Taylor expanded in t around 0
Applied rewrites51.6%
Taylor expanded in b around 0
Applied rewrites20.3%
Taylor expanded in b around inf
Applied rewrites34.4%
Final simplification36.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-160)
(* (/ (/ (fma -1.0 b 1.0) a) y) x)
(if (<= t_1 0.0) (/ (* x (/ (- b) a)) y) (/ (* x (/ (- 1.0 b) 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 <= -5e-160) {
tmp = ((fma(-1.0, b, 1.0) / a) / y) * x;
} else if (t_1 <= 0.0) {
tmp = (x * (-b / a)) / y;
} else {
tmp = (x * ((1.0 - b) / 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 <= -5e-160) tmp = Float64(Float64(Float64(fma(-1.0, b, 1.0) / a) / y) * x); elseif (t_1 <= 0.0) tmp = Float64(Float64(x * Float64(Float64(-b) / a)) / y); else tmp = Float64(Float64(x * Float64(Float64(1.0 - b) / 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, -5e-160], N[(N[(N[(N[(-1.0 * b + 1.0), $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(x * N[((-b) / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[(N[(1.0 - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $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^{-160}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(-1, b, 1\right)}{a}}{y} \cdot x\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{x \cdot \frac{-b}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{1 - b}{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) < -4.99999999999999994e-160Initial program 99.0%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6462.1
Applied rewrites62.1%
Taylor expanded in t around 0
Applied rewrites52.7%
Taylor expanded in b around 0
Applied rewrites35.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.6%
if -4.99999999999999994e-160 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 0.0Initial program 98.3%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6465.5
Applied rewrites65.5%
Taylor expanded in t around 0
Applied rewrites51.6%
Taylor expanded in b around 0
Applied rewrites20.3%
Taylor expanded in b around inf
Applied rewrites34.4%
if 0.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) Initial program 98.2%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6469.4
Applied rewrites69.4%
Taylor expanded in t around 0
Applied rewrites59.6%
Taylor expanded in b around 0
Applied rewrites39.5%
Taylor expanded in b around 0
Applied rewrites39.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= (- t 1.0) -2e+43)
(/ (* x (exp (- (* (log a) t) b))) y)
(if (<= (- t 1.0) -0.99999995)
(/ (* x (exp (- (fma (log z) y (- (log a))) b))) y)
(/ (* x (exp (- (* (+ -1.0 t) (log a)) b))) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t - 1.0) <= -2e+43) {
tmp = (x * exp(((log(a) * t) - b))) / y;
} else if ((t - 1.0) <= -0.99999995) {
tmp = (x * exp((fma(log(z), y, -log(a)) - b))) / y;
} else {
tmp = (x * exp((((-1.0 + t) * log(a)) - b))) / y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(t - 1.0) <= -2e+43) tmp = Float64(Float64(x * exp(Float64(Float64(log(a) * t) - b))) / y); elseif (Float64(t - 1.0) <= -0.99999995) tmp = Float64(Float64(x * exp(Float64(fma(log(z), y, Float64(-log(a))) - b))) / y); else tmp = Float64(Float64(x * exp(Float64(Float64(Float64(-1.0 + t) * log(a)) - b))) / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(t - 1.0), $MachinePrecision], -2e+43], N[(N[(x * N[Exp[N[(N[(N[Log[a], $MachinePrecision] * t), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(t - 1.0), $MachinePrecision], -0.99999995], N[(N[(x * N[Exp[N[(N[(N[Log[z], $MachinePrecision] * y + (-N[Log[a], $MachinePrecision])), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[Exp[N[(N[(N[(-1.0 + t), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t - 1 \leq -2 \cdot 10^{+43}:\\
\;\;\;\;\frac{x \cdot e^{\log a \cdot t - b}}{y}\\
\mathbf{elif}\;t - 1 \leq -0.99999995:\\
\;\;\;\;\frac{x \cdot e^{\mathsf{fma}\left(\log z, y, -\log a\right) - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot e^{\left(-1 + t\right) \cdot \log a - b}}{y}\\
\end{array}
\end{array}
if (-.f64 t #s(literal 1 binary64)) < -2.00000000000000003e43Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6485.4
Applied rewrites85.4%
if -2.00000000000000003e43 < (-.f64 t #s(literal 1 binary64)) < -0.999999949999999971Initial program 97.0%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
mul-1-negN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-log.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-log.f6497.0
Applied rewrites97.0%
if -0.999999949999999971 < (-.f64 t #s(literal 1 binary64)) Initial program 99.5%
Taylor expanded in y around 0
distribute-rgt-out--N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
remove-double-negN/A
distribute-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f64N/A
lower-log.f6495.9
Applied rewrites95.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1300000.0) (not (<= y 9e+34))) (/ (* x (/ (pow z y) a)) y) (/ (* x (exp (- (* (+ -1.0 t) (log a)) b))) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1300000.0) || !(y <= 9e+34)) {
tmp = (x * (pow(z, y) / a)) / y;
} else {
tmp = (x * exp((((-1.0 + t) * log(a)) - 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 <= (-1300000.0d0)) .or. (.not. (y <= 9d+34))) then
tmp = (x * ((z ** y) / a)) / y
else
tmp = (x * exp(((((-1.0d0) + t) * log(a)) - 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 <= -1300000.0) || !(y <= 9e+34)) {
tmp = (x * (Math.pow(z, y) / a)) / y;
} else {
tmp = (x * Math.exp((((-1.0 + t) * Math.log(a)) - b))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1300000.0) or not (y <= 9e+34): tmp = (x * (math.pow(z, y) / a)) / y else: tmp = (x * math.exp((((-1.0 + t) * math.log(a)) - b))) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1300000.0) || !(y <= 9e+34)) tmp = Float64(Float64(x * Float64((z ^ y) / a)) / y); else tmp = Float64(Float64(x * exp(Float64(Float64(Float64(-1.0 + t) * log(a)) - b))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1300000.0) || ~((y <= 9e+34))) tmp = (x * ((z ^ y) / a)) / y; else tmp = (x * exp((((-1.0 + t) * log(a)) - b))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1300000.0], N[Not[LessEqual[y, 9e+34]], $MachinePrecision]], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[Exp[N[(N[(N[(-1.0 + t), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1300000 \lor \neg \left(y \leq 9 \cdot 10^{+34}\right):\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot e^{\left(-1 + t\right) \cdot \log a - b}}{y}\\
\end{array}
\end{array}
if y < -1.3e6 or 9.0000000000000001e34 < y Initial program 100.0%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6471.6
Applied rewrites71.6%
Taylor expanded in t around 0
Applied rewrites84.8%
if -1.3e6 < y < 9.0000000000000001e34Initial program 97.0%
Taylor expanded in y around 0
distribute-rgt-out--N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
remove-double-negN/A
distribute-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f64N/A
lower-log.f6495.5
Applied rewrites95.5%
Final simplification90.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -3.5e+24) (not (<= b 80.0))) (/ (* x (exp (- (* (log a) t) b))) y) (/ (* x (* (pow a (- t 1.0)) (pow z y))) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -3.5e+24) || !(b <= 80.0)) {
tmp = (x * exp(((log(a) * t) - b))) / y;
} else {
tmp = (x * (pow(a, (t - 1.0)) * pow(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 ((b <= (-3.5d+24)) .or. (.not. (b <= 80.0d0))) then
tmp = (x * exp(((log(a) * t) - b))) / y
else
tmp = (x * ((a ** (t - 1.0d0)) * (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 ((b <= -3.5e+24) || !(b <= 80.0)) {
tmp = (x * Math.exp(((Math.log(a) * t) - b))) / y;
} else {
tmp = (x * (Math.pow(a, (t - 1.0)) * Math.pow(z, y))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -3.5e+24) or not (b <= 80.0): tmp = (x * math.exp(((math.log(a) * t) - b))) / y else: tmp = (x * (math.pow(a, (t - 1.0)) * math.pow(z, y))) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -3.5e+24) || !(b <= 80.0)) tmp = Float64(Float64(x * exp(Float64(Float64(log(a) * t) - b))) / y); else tmp = Float64(Float64(x * Float64((a ^ Float64(t - 1.0)) * (z ^ y))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -3.5e+24) || ~((b <= 80.0))) tmp = (x * exp(((log(a) * t) - b))) / y; else tmp = (x * ((a ^ (t - 1.0)) * (z ^ y))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -3.5e+24], N[Not[LessEqual[b, 80.0]], $MachinePrecision]], N[(N[(x * N[Exp[N[(N[(N[Log[a], $MachinePrecision] * t), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] * N[Power[z, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{+24} \lor \neg \left(b \leq 80\right):\\
\;\;\;\;\frac{x \cdot e^{\log a \cdot t - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left({a}^{\left(t - 1\right)} \cdot {z}^{y}\right)}{y}\\
\end{array}
\end{array}
if b < -3.5000000000000002e24 or 80 < b Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6490.1
Applied rewrites90.1%
if -3.5000000000000002e24 < b < 80Initial program 97.1%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6486.5
Applied rewrites86.5%
Final simplification88.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -3.5e+24) (not (<= b 80.0))) (/ (* x (exp (- (* (log a) t) b))) y) (* (/ (* (pow z y) (pow a (- t 1.0))) y) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -3.5e+24) || !(b <= 80.0)) {
tmp = (x * exp(((log(a) * t) - b))) / y;
} else {
tmp = ((pow(z, y) * pow(a, (t - 1.0))) / y) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b <= (-3.5d+24)) .or. (.not. (b <= 80.0d0))) then
tmp = (x * exp(((log(a) * t) - b))) / y
else
tmp = (((z ** y) * (a ** (t - 1.0d0))) / y) * x
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.5e+24) || !(b <= 80.0)) {
tmp = (x * Math.exp(((Math.log(a) * t) - b))) / y;
} else {
tmp = ((Math.pow(z, y) * Math.pow(a, (t - 1.0))) / y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -3.5e+24) or not (b <= 80.0): tmp = (x * math.exp(((math.log(a) * t) - b))) / y else: tmp = ((math.pow(z, y) * math.pow(a, (t - 1.0))) / y) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -3.5e+24) || !(b <= 80.0)) tmp = Float64(Float64(x * exp(Float64(Float64(log(a) * t) - b))) / y); else tmp = Float64(Float64(Float64((z ^ y) * (a ^ Float64(t - 1.0))) / y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -3.5e+24) || ~((b <= 80.0))) tmp = (x * exp(((log(a) * t) - b))) / y; else tmp = (((z ^ y) * (a ^ (t - 1.0))) / y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -3.5e+24], N[Not[LessEqual[b, 80.0]], $MachinePrecision]], N[(N[(x * N[Exp[N[(N[(N[Log[a], $MachinePrecision] * t), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(N[Power[z, y], $MachinePrecision] * N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{+24} \lor \neg \left(b \leq 80\right):\\
\;\;\;\;\frac{x \cdot e^{\log a \cdot t - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{{z}^{y} \cdot {a}^{\left(t - 1\right)}}{y} \cdot x\\
\end{array}
\end{array}
if b < -3.5000000000000002e24 or 80 < b Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6490.1
Applied rewrites90.1%
if -3.5000000000000002e24 < b < 80Initial program 97.1%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6486.5
Applied rewrites86.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.4
Applied rewrites85.4%
Final simplification87.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.1e+57) (not (<= t 3.8e-6))) (/ (* x (exp (- (* (log a) t) b))) y) (/ (* x (/ (pow z y) a)) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.1e+57) || !(t <= 3.8e-6)) {
tmp = (x * exp(((log(a) * t) - b))) / y;
} else {
tmp = (x * (pow(z, y) / a)) / y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((t <= (-2.1d+57)) .or. (.not. (t <= 3.8d-6))) then
tmp = (x * exp(((log(a) * t) - b))) / y
else
tmp = (x * ((z ** y) / a)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.1e+57) || !(t <= 3.8e-6)) {
tmp = (x * Math.exp(((Math.log(a) * t) - b))) / y;
} else {
tmp = (x * (Math.pow(z, y) / a)) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -2.1e+57) or not (t <= 3.8e-6): tmp = (x * math.exp(((math.log(a) * t) - b))) / y else: tmp = (x * (math.pow(z, y) / a)) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.1e+57) || !(t <= 3.8e-6)) tmp = Float64(Float64(x * exp(Float64(Float64(log(a) * t) - b))) / y); else tmp = Float64(Float64(x * Float64((z ^ y) / a)) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -2.1e+57) || ~((t <= 3.8e-6))) tmp = (x * exp(((log(a) * t) - b))) / y; else tmp = (x * ((z ^ y) / a)) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.1e+57], N[Not[LessEqual[t, 3.8e-6]], $MachinePrecision]], N[(N[(x * N[Exp[N[(N[(N[Log[a], $MachinePrecision] * t), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+57} \lor \neg \left(t \leq 3.8 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{x \cdot e^{\log a \cdot t - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\end{array}
\end{array}
if t < -2.09999999999999991e57 or 3.8e-6 < t Initial program 99.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6490.4
Applied rewrites90.4%
if -2.09999999999999991e57 < t < 3.8e-6Initial program 97.0%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6474.6
Applied rewrites74.6%
Taylor expanded in t around 0
Applied rewrites77.5%
Final simplification84.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (pow a (- t 1.0))))
(if (<= t -3.3e+70)
(* (/ t_1 y) x)
(if (<= t 9.2e-8) (/ (* x (/ (pow z y) a)) y) (/ (* x t_1) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow(a, (t - 1.0));
double tmp;
if (t <= -3.3e+70) {
tmp = (t_1 / y) * x;
} else if (t <= 9.2e-8) {
tmp = (x * (pow(z, y) / 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 = a ** (t - 1.0d0)
if (t <= (-3.3d+70)) then
tmp = (t_1 / y) * x
else if (t <= 9.2d-8) then
tmp = (x * ((z ** y) / 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(a, (t - 1.0));
double tmp;
if (t <= -3.3e+70) {
tmp = (t_1 / y) * x;
} else if (t <= 9.2e-8) {
tmp = (x * (Math.pow(z, y) / a)) / y;
} else {
tmp = (x * t_1) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.pow(a, (t - 1.0)) tmp = 0 if t <= -3.3e+70: tmp = (t_1 / y) * x elif t <= 9.2e-8: tmp = (x * (math.pow(z, y) / a)) / y else: tmp = (x * t_1) / y return tmp
function code(x, y, z, t, a, b) t_1 = a ^ Float64(t - 1.0) tmp = 0.0 if (t <= -3.3e+70) tmp = Float64(Float64(t_1 / y) * x); elseif (t <= 9.2e-8) tmp = Float64(Float64(x * Float64((z ^ y) / 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 = a ^ (t - 1.0); tmp = 0.0; if (t <= -3.3e+70) tmp = (t_1 / y) * x; elseif (t <= 9.2e-8) tmp = (x * ((z ^ y) / 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[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3.3e+70], N[(N[(t$95$1 / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 9.2e-8], N[(N[(x * N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * t$95$1), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {a}^{\left(t - 1\right)}\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{+70}:\\
\;\;\;\;\frac{t\_1}{y} \cdot x\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{-8}:\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t\_1}{y}\\
\end{array}
\end{array}
if t < -3.30000000000000016e70Initial program 100.0%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6469.5
Applied rewrites69.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6469.5
Applied rewrites69.5%
Taylor expanded in y around 0
Applied rewrites79.9%
if -3.30000000000000016e70 < t < 9.2000000000000003e-8Initial program 97.1%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6474.1
Applied rewrites74.1%
Taylor expanded in t around 0
Applied rewrites77.4%
if 9.2000000000000003e-8 < t Initial program 99.5%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6470.2
Applied rewrites70.2%
Taylor expanded in y around 0
Applied rewrites82.6%
Final simplification79.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -2.2e+24) (not (<= b 8.5e+77))) (* (/ (exp (- b)) y) x) (/ (* 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 <= -2.2e+24) || !(b <= 8.5e+77)) {
tmp = (exp(-b) / y) * x;
} 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 <= (-2.2d+24)) .or. (.not. (b <= 8.5d+77))) then
tmp = (exp(-b) / y) * x
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 <= -2.2e+24) || !(b <= 8.5e+77)) {
tmp = (Math.exp(-b) / y) * x;
} else {
tmp = (x * Math.pow(a, (t - 1.0))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -2.2e+24) or not (b <= 8.5e+77): tmp = (math.exp(-b) / y) * x 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 <= -2.2e+24) || !(b <= 8.5e+77)) tmp = Float64(Float64(exp(Float64(-b)) / y) * x); else tmp = Float64(Float64(x * (a ^ Float64(t - 1.0))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -2.2e+24) || ~((b <= 8.5e+77))) tmp = (exp(-b) / y) * x; else tmp = (x * (a ^ (t - 1.0))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -2.2e+24], N[Not[LessEqual[b, 8.5e+77]], $MachinePrecision]], N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], N[(N[(x * N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.2 \cdot 10^{+24} \lor \neg \left(b \leq 8.5 \cdot 10^{+77}\right):\\
\;\;\;\;\frac{e^{-b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot {a}^{\left(t - 1\right)}}{y}\\
\end{array}
\end{array}
if b < -2.20000000000000002e24 or 8.50000000000000018e77 < b Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
difference-of-squares-revN/A
difference-of-sqr--1-revN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6495.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.8
Applied rewrites95.8%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6484.3
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.3
Applied rewrites84.3%
if -2.20000000000000002e24 < b < 8.50000000000000018e77Initial program 97.5%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6482.5
Applied rewrites82.5%
Taylor expanded in y around 0
Applied rewrites69.5%
Final simplification74.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -2.2e+24) (not (<= b 7.8e+77))) (* (/ (exp (- b)) y) x) (* (/ (pow a (- t 1.0)) y) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.2e+24) || !(b <= 7.8e+77)) {
tmp = (exp(-b) / y) * x;
} else {
tmp = (pow(a, (t - 1.0)) / y) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b <= (-2.2d+24)) .or. (.not. (b <= 7.8d+77))) then
tmp = (exp(-b) / y) * x
else
tmp = ((a ** (t - 1.0d0)) / y) * x
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 <= -2.2e+24) || !(b <= 7.8e+77)) {
tmp = (Math.exp(-b) / y) * x;
} else {
tmp = (Math.pow(a, (t - 1.0)) / y) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -2.2e+24) or not (b <= 7.8e+77): tmp = (math.exp(-b) / y) * x else: tmp = (math.pow(a, (t - 1.0)) / y) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -2.2e+24) || !(b <= 7.8e+77)) tmp = Float64(Float64(exp(Float64(-b)) / y) * x); else tmp = Float64(Float64((a ^ Float64(t - 1.0)) / y) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -2.2e+24) || ~((b <= 7.8e+77))) tmp = (exp(-b) / y) * x; else tmp = ((a ^ (t - 1.0)) / y) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -2.2e+24], N[Not[LessEqual[b, 7.8e+77]], $MachinePrecision]], N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.2 \cdot 10^{+24} \lor \neg \left(b \leq 7.8 \cdot 10^{+77}\right):\\
\;\;\;\;\frac{e^{-b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{{a}^{\left(t - 1\right)}}{y} \cdot x\\
\end{array}
\end{array}
if b < -2.20000000000000002e24 or 7.7999999999999995e77 < b Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
difference-of-squares-revN/A
difference-of-sqr--1-revN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6495.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.8
Applied rewrites95.8%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6484.3
Applied rewrites84.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.3
Applied rewrites84.3%
if -2.20000000000000002e24 < b < 7.7999999999999995e77Initial program 97.5%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6482.5
Applied rewrites82.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.4
Applied rewrites80.4%
Taylor expanded in y around 0
Applied rewrites68.6%
Final simplification74.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -4.4e-76) (not (<= b 1.05))) (* (/ (exp (- b)) y) x) (* (/ (fma -1.0 b 1.0) a) (/ x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -4.4e-76) || !(b <= 1.05)) {
tmp = (exp(-b) / y) * x;
} else {
tmp = (fma(-1.0, b, 1.0) / a) * (x / y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -4.4e-76) || !(b <= 1.05)) tmp = Float64(Float64(exp(Float64(-b)) / y) * x); else tmp = Float64(Float64(fma(-1.0, b, 1.0) / a) * Float64(x / y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -4.4e-76], N[Not[LessEqual[b, 1.05]], $MachinePrecision]], N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(-1.0 * b + 1.0), $MachinePrecision] / a), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.4 \cdot 10^{-76} \lor \neg \left(b \leq 1.05\right):\\
\;\;\;\;\frac{e^{-b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, b, 1\right)}{a} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if b < -4.39999999999999999e-76 or 1.05000000000000004 < b Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
difference-of-squares-revN/A
difference-of-sqr--1-revN/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6496.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.2
Applied rewrites96.2%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6472.9
Applied rewrites72.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.9
Applied rewrites72.9%
if -4.39999999999999999e-76 < b < 1.05000000000000004Initial program 96.8%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6473.1
Applied rewrites73.1%
Taylor expanded in t around 0
Applied rewrites34.7%
Taylor expanded in b around 0
Applied rewrites34.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6436.3
Applied rewrites36.3%
Final simplification55.4%
(FPCore (x y z t a b) :precision binary64 (if (<= b -5.4e-282) (/ (* x (/ (- b) a)) y) (/ (* x (/ 1.0 a)) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5.4e-282) {
tmp = (x * (-b / 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 (b <= (-5.4d-282)) then
tmp = (x * (-b / 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 (b <= -5.4e-282) {
tmp = (x * (-b / a)) / y;
} else {
tmp = (x * (1.0 / a)) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -5.4e-282: tmp = (x * (-b / a)) / y else: tmp = (x * (1.0 / a)) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -5.4e-282) tmp = Float64(Float64(x * Float64(Float64(-b) / a)) / y); else tmp = Float64(Float64(x * Float64(1.0 / a)) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -5.4e-282) tmp = (x * (-b / a)) / y; else tmp = (x * (1.0 / a)) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -5.4e-282], N[(N[(x * N[((-b) / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.4 \cdot 10^{-282}:\\
\;\;\;\;\frac{x \cdot \frac{-b}{a}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{1}{a}}{y}\\
\end{array}
\end{array}
if b < -5.39999999999999964e-282Initial program 98.4%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6460.9
Applied rewrites60.9%
Taylor expanded in t around 0
Applied rewrites55.4%
Taylor expanded in b around 0
Applied rewrites35.1%
Taylor expanded in b around inf
Applied rewrites36.1%
if -5.39999999999999964e-282 < b Initial program 98.5%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6470.5
Applied rewrites70.5%
Taylor expanded in t around 0
Applied rewrites53.3%
Taylor expanded in b around 0
Applied rewrites24.9%
Taylor expanded in b around 0
Applied rewrites30.5%
(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(Float64(x * 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[(N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{1}{a}}{y}
\end{array}
Initial program 98.4%
Taylor expanded in y around 0
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6465.8
Applied rewrites65.8%
Taylor expanded in t around 0
Applied rewrites54.3%
Taylor expanded in b around 0
Applied rewrites29.9%
Taylor expanded in b around 0
Applied rewrites28.7%
(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 2024363
(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))