
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
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)
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
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
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)
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
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
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)
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
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Initial program 99.6%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log y) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log(y) + log(z)) - t) + ((a - 0.5) * log(t));
}
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)
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
code = ((log(y) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log(y) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log(y) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(y) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log(y) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log y + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites68.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z))))
(if (<= t_1 720.0)
(fma (- a 0.5) (log t) (- (log (* z (+ y x))) t))
(if (<= t_1 861.0)
(+ (- (log (* (fabs x) z)) t) (* (- a 0.5) (log t)))
(+ (- (+ (log y) (log z)) t) (* -0.5 (log t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double tmp;
if (t_1 <= 720.0) {
tmp = fma((a - 0.5), log(t), (log((z * (y + x))) - t));
} else if (t_1 <= 861.0) {
tmp = (log((fabs(x) * z)) - t) + ((a - 0.5) * log(t));
} else {
tmp = ((log(y) + log(z)) - t) + (-0.5 * log(t));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) tmp = 0.0 if (t_1 <= 720.0) tmp = fma(Float64(a - 0.5), log(t), Float64(log(Float64(z * Float64(y + x))) - t)); elseif (t_1 <= 861.0) tmp = Float64(Float64(log(Float64(abs(x) * z)) - t) + Float64(Float64(a - 0.5) * log(t))); else tmp = Float64(Float64(Float64(log(y) + log(z)) - t) + Float64(-0.5 * log(t))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 720.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 861.0], N[(N[(N[Log[N[(N[Abs[x], $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_1 \leq 720:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \log \left(z \cdot \left(y + x\right)\right) - t\right)\\
\mathbf{elif}\;t\_1 \leq 861:\\
\;\;\;\;\left(\log \left(\left|x\right| \cdot z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\log y + \log z\right) - t\right) + -0.5 \cdot \log t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f64N/A
lower--.f64N/A
Applied rewrites76.0%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 861Initial program 99.6%
Taylor expanded in y around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6453.6
Applied rewrites53.6%
lift-*.f64N/A
lift-log.f64N/A
sum-logN/A
+-commutativeN/A
log-fabsN/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lower-fabs.f6468.1
Applied rewrites68.1%
if 861 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites68.9%
Taylor expanded in a around 0
Applied rewrites41.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z))))
(if (<= t_1 720.0)
(fma (- a 0.5) (log t) (- (log (* z (+ y x))) t))
(if (<= t_1 915.0)
(+ (- (log (* (fabs x) z)) t) (* (- a 0.5) (log t)))
(+ (fma (log t) (- a 0.5) (log y)) (log z))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double tmp;
if (t_1 <= 720.0) {
tmp = fma((a - 0.5), log(t), (log((z * (y + x))) - t));
} else if (t_1 <= 915.0) {
tmp = (log((fabs(x) * z)) - t) + ((a - 0.5) * log(t));
} else {
tmp = fma(log(t), (a - 0.5), log(y)) + log(z);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) tmp = 0.0 if (t_1 <= 720.0) tmp = fma(Float64(a - 0.5), log(t), Float64(log(Float64(z * Float64(y + x))) - t)); elseif (t_1 <= 915.0) tmp = Float64(Float64(log(Float64(abs(x) * z)) - t) + Float64(Float64(a - 0.5) * log(t))); else tmp = Float64(fma(log(t), Float64(a - 0.5), log(y)) + log(z)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 720.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 915.0], N[(N[(N[Log[N[(N[Abs[x], $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_1 \leq 720:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \log \left(z \cdot \left(y + x\right)\right) - t\right)\\
\mathbf{elif}\;t\_1 \leq 915:\\
\;\;\;\;\left(\log \left(\left|x\right| \cdot z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, a - 0.5, \log y\right) + \log z\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f64N/A
lower--.f64N/A
Applied rewrites76.0%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 915Initial program 99.6%
Taylor expanded in y around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6453.6
Applied rewrites53.6%
lift-*.f64N/A
lift-log.f64N/A
sum-logN/A
+-commutativeN/A
log-fabsN/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lower-fabs.f6468.1
Applied rewrites68.1%
if 915 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around 0
associate-+r+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6447.5
Applied rewrites47.5%
lift-+.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
sum-logN/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
associate-+r+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-log.f6462.0
Applied rewrites62.0%
Taylor expanded in x around 0
lower-log.f6441.4
Applied rewrites41.4%
(FPCore (x y z t a) :precision binary64 (if (<= (+ (log (+ x y)) (log z)) 720.0) (fma (- a 0.5) (log t) (- (log (* z (+ y x))) t)) (+ (- (log (* (fabs x) z)) t) (* (- a 0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((log((x + y)) + log(z)) <= 720.0) {
tmp = fma((a - 0.5), log(t), (log((z * (y + x))) - t));
} else {
tmp = (log((fabs(x) * z)) - t) + ((a - 0.5) * log(t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(log(Float64(x + y)) + log(z)) <= 720.0) tmp = fma(Float64(a - 0.5), log(t), Float64(log(Float64(z * Float64(y + x))) - t)); else tmp = Float64(Float64(log(Float64(abs(x) * z)) - t) + Float64(Float64(a - 0.5) * log(t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 720.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[(N[Abs[x], $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log \left(x + y\right) + \log z \leq 720:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \log \left(z \cdot \left(y + x\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(\left|x\right| \cdot z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f64N/A
lower--.f64N/A
Applied rewrites76.0%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in y around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6453.6
Applied rewrites53.6%
lift-*.f64N/A
lift-log.f64N/A
sum-logN/A
+-commutativeN/A
log-fabsN/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lower-fabs.f6468.1
Applied rewrites68.1%
(FPCore (x y z t a) :precision binary64 (if (<= (+ (log (+ x y)) (log z)) 720.0) (fma (- a 0.5) (log t) (- (log (* z y)) t)) (+ (- (log (* (fabs x) z)) t) (* (- a 0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((log((x + y)) + log(z)) <= 720.0) {
tmp = fma((a - 0.5), log(t), (log((z * y)) - t));
} else {
tmp = (log((fabs(x) * z)) - t) + ((a - 0.5) * log(t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(log(Float64(x + y)) + log(z)) <= 720.0) tmp = fma(Float64(a - 0.5), log(t), Float64(log(Float64(z * y)) - t)); else tmp = Float64(Float64(log(Float64(abs(x) * z)) - t) + Float64(Float64(a - 0.5) * log(t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 720.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[(N[Abs[x], $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log \left(x + y\right) + \log z \leq 720:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \log \left(z \cdot y\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(\left|x\right| \cdot z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites68.9%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6468.9
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6453.0
Applied rewrites53.0%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in y around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6453.6
Applied rewrites53.6%
lift-*.f64N/A
lift-log.f64N/A
sum-logN/A
+-commutativeN/A
log-fabsN/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lower-fabs.f6468.1
Applied rewrites68.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z))))
(if (<= t_1 720.0)
(fma (- a 0.5) (log t) (- (log (* z y)) t))
(if (<= t_1 780.0) (* (log t) a) (- t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double tmp;
if (t_1 <= 720.0) {
tmp = fma((a - 0.5), log(t), (log((z * y)) - t));
} else if (t_1 <= 780.0) {
tmp = log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) tmp = 0.0 if (t_1 <= 720.0) tmp = fma(Float64(a - 0.5), log(t), Float64(log(Float64(z * y)) - t)); elseif (t_1 <= 780.0) tmp = Float64(log(t) * a); else tmp = Float64(-t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 720.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 780.0], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_1 \leq 720:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \log \left(z \cdot y\right) - t\right)\\
\mathbf{elif}\;t\_1 \leq 780:\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites68.9%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6468.9
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6453.0
Applied rewrites53.0%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 780Initial program 99.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6437.9
Applied rewrites37.9%
if 780 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6438.5
Applied rewrites38.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (log t) a)))
(if (<= (- a 0.5) -5e+21)
t_1
(if (<= (- a 0.5) 5e+98)
(fma -0.5 (log t) (- (log (* (fabs y) z)) t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * a;
double tmp;
if ((a - 0.5) <= -5e+21) {
tmp = t_1;
} else if ((a - 0.5) <= 5e+98) {
tmp = fma(-0.5, log(t), (log((fabs(y) * z)) - t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(t) * a) tmp = 0.0 if (Float64(a - 0.5) <= -5e+21) tmp = t_1; elseif (Float64(a - 0.5) <= 5e+98) tmp = fma(-0.5, log(t), Float64(log(Float64(abs(y) * z)) - t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[N[(a - 0.5), $MachinePrecision], -5e+21], t$95$1, If[LessEqual[N[(a - 0.5), $MachinePrecision], 5e+98], N[(-0.5 * N[Log[t], $MachinePrecision] + N[(N[Log[N[(N[Abs[y], $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot a\\
\mathbf{if}\;a - 0.5 \leq -5 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a - 0.5 \leq 5 \cdot 10^{+98}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log t, \log \left(\left|y\right| \cdot z\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -5e21 or 4.9999999999999998e98 < (-.f64 a #s(literal 1/2 binary64)) Initial program 99.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6437.9
Applied rewrites37.9%
if -5e21 < (-.f64 a #s(literal 1/2 binary64)) < 4.9999999999999998e98Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites68.9%
lift-+.f64N/A
lift-log.f64N/A
log-fabsN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lower-fabs.f6468.2
Applied rewrites68.2%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6468.2
Applied rewrites68.2%
Taylor expanded in a around 0
Applied rewrites40.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 59000.0) (fma (log t) (- a 0.5) (log (* z y))) (if (<= t 8.5e+90) (* (log t) a) (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 59000.0) {
tmp = fma(log(t), (a - 0.5), log((z * y)));
} else if (t <= 8.5e+90) {
tmp = log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 59000.0) tmp = fma(log(t), Float64(a - 0.5), log(Float64(z * y))); elseif (t <= 8.5e+90) tmp = Float64(log(t) * a); else tmp = Float64(-t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 59000.0], N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e+90], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 59000:\\
\;\;\;\;\mathsf{fma}\left(\log t, a - 0.5, \log \left(z \cdot y\right)\right)\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+90}:\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 59000Initial program 99.6%
Taylor expanded in t around 0
associate-+r+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6447.5
Applied rewrites47.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f6432.0
Applied rewrites32.0%
if 59000 < t < 8.5000000000000002e90Initial program 99.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6437.9
Applied rewrites37.9%
if 8.5000000000000002e90 < t Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6438.5
Applied rewrites38.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t)))))
(if (<= t_1 -500.0)
(- t)
(if (<= t_1 1050.0) (fma -0.5 (log t) (log (* z y))) (* (log t) a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
double tmp;
if (t_1 <= -500.0) {
tmp = -t;
} else if (t_1 <= 1050.0) {
tmp = fma(-0.5, log(t), log((z * y)));
} else {
tmp = log(t) * a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_1 <= -500.0) tmp = Float64(-t); elseif (t_1 <= 1050.0) tmp = fma(-0.5, log(t), log(Float64(z * y))); else tmp = Float64(log(t) * a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -500.0], (-t), If[LessEqual[t$95$1, 1050.0], N[(-0.5 * N[Log[t], $MachinePrecision] + N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{if}\;t\_1 \leq -500:\\
\;\;\;\;-t\\
\mathbf{elif}\;t\_1 \leq 1050:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log t, \log \left(z \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log t \cdot a\\
\end{array}
\end{array}
if (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < -500Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6438.5
Applied rewrites38.5%
if -500 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 1050Initial program 99.6%
Taylor expanded in t around 0
associate-+r+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6447.5
Applied rewrites47.5%
lift-+.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
sum-logN/A
lift-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
associate-+r+N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower-log.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-log.f6462.0
Applied rewrites62.0%
Taylor expanded in a around 0
associate-+r+N/A
sum-logN/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lift-+.f6420.6
Applied rewrites20.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6411.9
Applied rewrites11.9%
if 1050 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) Initial program 99.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6437.9
Applied rewrites37.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (log t) a))) (if (<= (- a 0.5) -2000000.0) t_1 (if (<= (- a 0.5) 5e+98) (- t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * a;
double tmp;
if ((a - 0.5) <= -2000000.0) {
tmp = t_1;
} else if ((a - 0.5) <= 5e+98) {
tmp = -t;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = log(t) * a
if ((a - 0.5d0) <= (-2000000.0d0)) then
tmp = t_1
else if ((a - 0.5d0) <= 5d+98) then
tmp = -t
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 t_1 = Math.log(t) * a;
double tmp;
if ((a - 0.5) <= -2000000.0) {
tmp = t_1;
} else if ((a - 0.5) <= 5e+98) {
tmp = -t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * a tmp = 0 if (a - 0.5) <= -2000000.0: tmp = t_1 elif (a - 0.5) <= 5e+98: tmp = -t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * a) tmp = 0.0 if (Float64(a - 0.5) <= -2000000.0) tmp = t_1; elseif (Float64(a - 0.5) <= 5e+98) tmp = Float64(-t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * a; tmp = 0.0; if ((a - 0.5) <= -2000000.0) tmp = t_1; elseif ((a - 0.5) <= 5e+98) tmp = -t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[N[(a - 0.5), $MachinePrecision], -2000000.0], t$95$1, If[LessEqual[N[(a - 0.5), $MachinePrecision], 5e+98], (-t), t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot a\\
\mathbf{if}\;a - 0.5 \leq -2000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a - 0.5 \leq 5 \cdot 10^{+98}:\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -2e6 or 4.9999999999999998e98 < (-.f64 a #s(literal 1/2 binary64)) Initial program 99.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6437.9
Applied rewrites37.9%
if -2e6 < (-.f64 a #s(literal 1/2 binary64)) < 4.9999999999999998e98Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6438.5
Applied rewrites38.5%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
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)
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
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6438.5
Applied rewrites38.5%
herbie shell --seed 2025136
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))