
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (- z) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (-z - b))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (-z - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (-z - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (-z - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(Float64(-z) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (-z - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(-z\right) - b\right)}
\end{array}
Initial program 96.6%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6499.2
Applied rewrites99.2%
(FPCore (x y z t a b) :precision binary64 (* x (exp (fma (- a) b (* (- (log z) t) y)))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(-a, b, ((log(z) - t) * y)));
}
function code(x, y, z, t, a, b) return Float64(x * exp(fma(Float64(-a), b, Float64(Float64(log(z) - t) * y)))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[((-a) * b + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\mathsf{fma}\left(-a, b, \left(\log z - t\right) \cdot y\right)}
\end{array}
Initial program 96.6%
Taylor expanded in z around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6496.6
Applied rewrites96.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- t) y)) x)))
(if (<= t -3.4e+25)
t_1
(if (<= t 2.85e+138) (* x (exp (fma (- a) b (* (log z) y)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((-t * y)) * x;
double tmp;
if (t <= -3.4e+25) {
tmp = t_1;
} else if (t <= 2.85e+138) {
tmp = x * exp(fma(-a, b, (log(z) * y)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(-t) * y)) * x) tmp = 0.0 if (t <= -3.4e+25) tmp = t_1; elseif (t <= 2.85e+138) tmp = Float64(x * exp(fma(Float64(-a), b, Float64(log(z) * y)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -3.4e+25], t$95$1, If[LessEqual[t, 2.85e+138], N[(x * N[Exp[N[((-a) * b + N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{if}\;t \leq -3.4 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.85 \cdot 10^{+138}:\\
\;\;\;\;x \cdot e^{\mathsf{fma}\left(-a, b, \log z \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.39999999999999984e25 or 2.84999999999999993e138 < t Initial program 96.6%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.4
Applied rewrites56.4%
if -3.39999999999999984e25 < t < 2.84999999999999993e138Initial program 96.6%
Taylor expanded in z around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6496.6
Applied rewrites96.6%
Taylor expanded in t around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f6479.4
Applied rewrites79.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- (log z) t) y)) x)))
(if (<= y -3.1e-74)
t_1
(if (<= y 2600000000000.0) (* (exp (fma (- a) b (* (- a) z))) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(((log(z) - t) * y)) * x;
double tmp;
if (y <= -3.1e-74) {
tmp = t_1;
} else if (y <= 2600000000000.0) {
tmp = exp(fma(-a, b, (-a * z))) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(log(z) - t) * y)) * x) tmp = 0.0 if (y <= -3.1e-74) tmp = t_1; elseif (y <= 2600000000000.0) tmp = Float64(exp(fma(Float64(-a), b, Float64(Float64(-a) * z))) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -3.1e-74], t$95$1, If[LessEqual[y, 2600000000000.0], N[(N[Exp[N[((-a) * b + N[((-a) * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(\log z - t\right) \cdot y} \cdot x\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{-74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2600000000000:\\
\;\;\;\;e^{\mathsf{fma}\left(-a, b, \left(-a\right) \cdot z\right)} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.1000000000000002e-74 or 2.6e12 < y Initial program 96.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6472.0
Applied rewrites72.0%
if -3.1000000000000002e-74 < y < 2.6e12Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6458.7
Applied rewrites58.7%
lift--.f64N/A
lift-log.f64N/A
sub-flipN/A
lift-neg.f64N/A
lower-log1p.f6462.6
Applied rewrites62.6%
Taylor expanded in z around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6462.6
Applied rewrites62.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (pow z y) x)))
(if (<= y -4.4e-6)
t_1
(if (<= y 24000000000000.0)
(* (exp (fma (- a) b (* (- a) z))) x)
(if (<= y 3e+210) t_1 (* (exp (* (- t) y)) x))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow(z, y) * x;
double tmp;
if (y <= -4.4e-6) {
tmp = t_1;
} else if (y <= 24000000000000.0) {
tmp = exp(fma(-a, b, (-a * z))) * x;
} else if (y <= 3e+210) {
tmp = t_1;
} else {
tmp = exp((-t * y)) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64((z ^ y) * x) tmp = 0.0 if (y <= -4.4e-6) tmp = t_1; elseif (y <= 24000000000000.0) tmp = Float64(exp(fma(Float64(-a), b, Float64(Float64(-a) * z))) * x); elseif (y <= 3e+210) tmp = t_1; else tmp = Float64(exp(Float64(Float64(-t) * y)) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -4.4e-6], t$95$1, If[LessEqual[y, 24000000000000.0], N[(N[Exp[N[((-a) * b + N[((-a) * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 3e+210], t$95$1, N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {z}^{y} \cdot x\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 24000000000000:\\
\;\;\;\;e^{\mathsf{fma}\left(-a, b, \left(-a\right) \cdot z\right)} \cdot x\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+210}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\end{array}
\end{array}
if y < -4.4000000000000002e-6 or 2.4e13 < y < 3.00000000000000022e210Initial program 96.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6472.0
Applied rewrites72.0%
Taylor expanded in t around 0
lower-pow.f6451.6
Applied rewrites51.6%
if -4.4000000000000002e-6 < y < 2.4e13Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6458.7
Applied rewrites58.7%
lift--.f64N/A
lift-log.f64N/A
sub-flipN/A
lift-neg.f64N/A
lower-log1p.f6462.6
Applied rewrites62.6%
Taylor expanded in z around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6462.6
Applied rewrites62.6%
if 3.00000000000000022e210 < y Initial program 96.6%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.4
Applied rewrites56.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (pow z y) x)))
(if (<= y -85000000000000.0)
t_1
(if (<= y 2600000000000.0)
(* (exp (* (- a) b)) x)
(if (<= y 3e+210) t_1 (* (exp (* (- t) y)) x))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow(z, y) * x;
double tmp;
if (y <= -85000000000000.0) {
tmp = t_1;
} else if (y <= 2600000000000.0) {
tmp = exp((-a * b)) * x;
} else if (y <= 3e+210) {
tmp = t_1;
} else {
tmp = exp((-t * 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) :: t_1
real(8) :: tmp
t_1 = (z ** y) * x
if (y <= (-85000000000000.0d0)) then
tmp = t_1
else if (y <= 2600000000000.0d0) then
tmp = exp((-a * b)) * x
else if (y <= 3d+210) then
tmp = t_1
else
tmp = exp((-t * 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 t_1 = Math.pow(z, y) * x;
double tmp;
if (y <= -85000000000000.0) {
tmp = t_1;
} else if (y <= 2600000000000.0) {
tmp = Math.exp((-a * b)) * x;
} else if (y <= 3e+210) {
tmp = t_1;
} else {
tmp = Math.exp((-t * y)) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.pow(z, y) * x tmp = 0 if y <= -85000000000000.0: tmp = t_1 elif y <= 2600000000000.0: tmp = math.exp((-a * b)) * x elif y <= 3e+210: tmp = t_1 else: tmp = math.exp((-t * y)) * x return tmp
function code(x, y, z, t, a, b) t_1 = Float64((z ^ y) * x) tmp = 0.0 if (y <= -85000000000000.0) tmp = t_1; elseif (y <= 2600000000000.0) tmp = Float64(exp(Float64(Float64(-a) * b)) * x); elseif (y <= 3e+210) tmp = t_1; else tmp = Float64(exp(Float64(Float64(-t) * y)) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z ^ y) * x; tmp = 0.0; if (y <= -85000000000000.0) tmp = t_1; elseif (y <= 2600000000000.0) tmp = exp((-a * b)) * x; elseif (y <= 3e+210) tmp = t_1; else tmp = exp((-t * y)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -85000000000000.0], t$95$1, If[LessEqual[y, 2600000000000.0], N[(N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 3e+210], t$95$1, N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {z}^{y} \cdot x\\
\mathbf{if}\;y \leq -85000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2600000000000:\\
\;\;\;\;e^{\left(-a\right) \cdot b} \cdot x\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+210}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\end{array}
\end{array}
if y < -8.5e13 or 2.6e12 < y < 3.00000000000000022e210Initial program 96.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6472.0
Applied rewrites72.0%
Taylor expanded in t around 0
lower-pow.f6451.6
Applied rewrites51.6%
if -8.5e13 < y < 2.6e12Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6458.7
Applied rewrites58.7%
Taylor expanded in z around 0
lower-exp.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6458.1
Applied rewrites58.1%
if 3.00000000000000022e210 < y Initial program 96.6%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.4
Applied rewrites56.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- t) y)) x)))
(if (<= t -1.25e+108)
t_1
(if (<= t 1.25e-55) (* (exp (* (- a) b)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((-t * y)) * x;
double tmp;
if (t <= -1.25e+108) {
tmp = t_1;
} else if (t <= 1.25e-55) {
tmp = exp((-a * b)) * x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = exp((-t * y)) * x
if (t <= (-1.25d+108)) then
tmp = t_1
else if (t <= 1.25d-55) then
tmp = exp((-a * b)) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.exp((-t * y)) * x;
double tmp;
if (t <= -1.25e+108) {
tmp = t_1;
} else if (t <= 1.25e-55) {
tmp = Math.exp((-a * b)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp((-t * y)) * x tmp = 0 if t <= -1.25e+108: tmp = t_1 elif t <= 1.25e-55: tmp = math.exp((-a * b)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(-t) * y)) * x) tmp = 0.0 if (t <= -1.25e+108) tmp = t_1; elseif (t <= 1.25e-55) tmp = Float64(exp(Float64(Float64(-a) * b)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp((-t * y)) * x; tmp = 0.0; if (t <= -1.25e+108) tmp = t_1; elseif (t <= 1.25e-55) tmp = exp((-a * b)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -1.25e+108], t$95$1, If[LessEqual[t, 1.25e-55], N[(N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{if}\;t \leq -1.25 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{-55}:\\
\;\;\;\;e^{\left(-a\right) \cdot b} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.24999999999999998e108 or 1.25e-55 < t Initial program 96.6%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6456.4
Applied rewrites56.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.4
Applied rewrites56.4%
if -1.24999999999999998e108 < t < 1.25e-55Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6458.7
Applied rewrites58.7%
Taylor expanded in z around 0
lower-exp.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6458.1
Applied rewrites58.1%
(FPCore (x y z t a b) :precision binary64 (* (exp (* (- a) b)) x))
double code(double x, double y, double z, double t, double a, double b) {
return exp((-a * b)) * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = exp((-a * b)) * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp((-a * b)) * x;
}
def code(x, y, z, t, a, b): return math.exp((-a * b)) * x
function code(x, y, z, t, a, b) return Float64(exp(Float64(Float64(-a) * b)) * x) end
function tmp = code(x, y, z, t, a, b) tmp = exp((-a * b)) * x; end
code[x_, y_, z_, t_, a_, b_] := N[(N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
e^{\left(-a\right) \cdot b} \cdot x
\end{array}
Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6458.7
Applied rewrites58.7%
Taylor expanded in z around 0
lower-exp.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6458.1
Applied rewrites58.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (fma (- t) y 1.0) x)))
(if (<= t -3.7e+61)
t_1
(if (<= t 1.08e+120) (* (+ (fma (- a) b (* (- a) z)) 1.0) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(-t, y, 1.0) * x;
double tmp;
if (t <= -3.7e+61) {
tmp = t_1;
} else if (t <= 1.08e+120) {
tmp = (fma(-a, b, (-a * z)) + 1.0) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(Float64(-t), y, 1.0) * x) tmp = 0.0 if (t <= -3.7e+61) tmp = t_1; elseif (t <= 1.08e+120) tmp = Float64(Float64(fma(Float64(-a), b, Float64(Float64(-a) * z)) + 1.0) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[((-t) * y + 1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -3.7e+61], t$95$1, If[LessEqual[t, 1.08e+120], N[(N[(N[((-a) * b + N[((-a) * z), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-t, y, 1\right) \cdot x\\
\mathbf{if}\;t \leq -3.7 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{+120}:\\
\;\;\;\;\left(\mathsf{fma}\left(-a, b, \left(-a\right) \cdot z\right) + 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.70000000000000003e61 or 1.0799999999999999e120 < t Initial program 96.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6472.0
Applied rewrites72.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6429.9
Applied rewrites29.9%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6427.4
Applied rewrites27.4%
if -3.70000000000000003e61 < t < 1.0799999999999999e120Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6458.7
Applied rewrites58.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6427.7
Applied rewrites27.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6428.1
Applied rewrites28.1%
(FPCore (x y z t a b) :precision binary64 (if (<= a -5.2e+132) (* (+ (fma (- a) b (* (- a) z)) 1.0) x) (* (fma (- (log z) t) y 1.0) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -5.2e+132) {
tmp = (fma(-a, b, (-a * z)) + 1.0) * x;
} else {
tmp = fma((log(z) - t), y, 1.0) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -5.2e+132) tmp = Float64(Float64(fma(Float64(-a), b, Float64(Float64(-a) * z)) + 1.0) * x); else tmp = Float64(fma(Float64(log(z) - t), y, 1.0) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -5.2e+132], N[(N[(N[((-a) * b + N[((-a) * z), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y + 1.0), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.2 \cdot 10^{+132}:\\
\;\;\;\;\left(\mathsf{fma}\left(-a, b, \left(-a\right) \cdot z\right) + 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log z - t, y, 1\right) \cdot x\\
\end{array}
\end{array}
if a < -5.2e132Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6458.7
Applied rewrites58.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6427.7
Applied rewrites27.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6428.1
Applied rewrites28.1%
if -5.2e132 < a Initial program 96.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6472.0
Applied rewrites72.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6429.9
Applied rewrites29.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma (- t) y 1.0) x))) (if (<= t -3.6e+61) t_1 (if (<= t 1.08e+120) (* (fma (- a) b 1.0) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(-t, y, 1.0) * x;
double tmp;
if (t <= -3.6e+61) {
tmp = t_1;
} else if (t <= 1.08e+120) {
tmp = fma(-a, b, 1.0) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(Float64(-t), y, 1.0) * x) tmp = 0.0 if (t <= -3.6e+61) tmp = t_1; elseif (t <= 1.08e+120) tmp = Float64(fma(Float64(-a), b, 1.0) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[((-t) * y + 1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -3.6e+61], t$95$1, If[LessEqual[t, 1.08e+120], N[(N[((-a) * b + 1.0), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-t, y, 1\right) \cdot x\\
\mathbf{if}\;t \leq -3.6 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{fma}\left(-a, b, 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.6000000000000001e61 or 1.0799999999999999e120 < t Initial program 96.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6472.0
Applied rewrites72.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6429.9
Applied rewrites29.9%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6427.4
Applied rewrites27.4%
if -3.6000000000000001e61 < t < 1.0799999999999999e120Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift--.f6458.7
Applied rewrites58.7%
Taylor expanded in z around 0
lower-exp.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f6458.1
Applied rewrites58.1%
Taylor expanded in a around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f6427.7
Applied rewrites27.7%
(FPCore (x y z t a b) :precision binary64 (* (fma (- t) y 1.0) x))
double code(double x, double y, double z, double t, double a, double b) {
return fma(-t, y, 1.0) * x;
}
function code(x, y, z, t, a, b) return Float64(fma(Float64(-t), y, 1.0) * x) end
code[x_, y_, z_, t_, a_, b_] := N[(N[((-t) * y + 1.0), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-t, y, 1\right) \cdot x
\end{array}
Initial program 96.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6472.0
Applied rewrites72.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f6429.9
Applied rewrites29.9%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6427.4
Applied rewrites27.4%
(FPCore (x y z t a b) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t, double a, double b) {
return 1.0 * x;
}
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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return 1.0 * x;
}
def code(x, y, z, t, a, b): return 1.0 * x
function code(x, y, z, t, a, b) return Float64(1.0 * x) end
function tmp = code(x, y, z, t, a, b) tmp = 1.0 * x; end
code[x_, y_, z_, t_, a_, b_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 96.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6472.0
Applied rewrites72.0%
Taylor expanded in y around 0
Applied rewrites18.7%
herbie shell --seed 2025134
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
:precision binary64
(* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))