
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 1/2) (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 - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 1/2) (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 - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t
(FPCore (x y z t a) :precision binary64 (- (+ (log (fmax x y)) (+ (log z) (* (log t) (- a 1/2)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(fmax(x, y)) + (log(z) + (log(t) * (a - 0.5)))) - 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(fmax(x, y)) + (log(z) + (log(t) * (a - 0.5d0)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(fmax(x, y)) + (Math.log(z) + (Math.log(t) * (a - 0.5)))) - t;
}
def code(x, y, z, t, a): return (math.log(fmax(x, y)) + (math.log(z) + (math.log(t) * (a - 0.5)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(max(x, y)) + (log(z) + (log(t) * (a - 0.5)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6469.3%
Applied rewrites69.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 190000) (+ (log z) (+ (log (+ (fmin x y) (fmax x y))) (* (log t) (- a 1/2)))) (- (+ (log (fmax x y)) (+ (log z) (* a (log t)))) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 190000.0) {
tmp = log(z) + (log((fmin(x, y) + fmax(x, y))) + (log(t) * (a - 0.5)));
} else {
tmp = (log(fmax(x, y)) + (log(z) + (a * log(t)))) - t;
}
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) :: tmp
if (t <= 190000.0d0) then
tmp = log(z) + (log((fmin(x, y) + fmax(x, y))) + (log(t) * (a - 0.5d0)))
else
tmp = (log(fmax(x, y)) + (log(z) + (a * log(t)))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 190000.0) {
tmp = Math.log(z) + (Math.log((fmin(x, y) + fmax(x, y))) + (Math.log(t) * (a - 0.5)));
} else {
tmp = (Math.log(fmax(x, y)) + (Math.log(z) + (a * Math.log(t)))) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 190000.0: tmp = math.log(z) + (math.log((fmin(x, y) + fmax(x, y))) + (math.log(t) * (a - 0.5))) else: tmp = (math.log(fmax(x, y)) + (math.log(z) + (a * math.log(t)))) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 190000.0) tmp = Float64(log(z) + Float64(log(Float64(fmin(x, y) + fmax(x, y))) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(a * log(t)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 190000.0) tmp = log(z) + (log((min(x, y) + max(x, y))) + (log(t) * (a - 0.5))); else tmp = (log(max(x, y)) + (log(z) + (a * log(t)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 190000], N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;t \leq 190000:\\
\;\;\;\;\log z + \left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log t \cdot \left(a - \frac{1}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + a \cdot \log t\right)\right) - t\\
\end{array}
if t < 1.9e5Initial program 99.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6463.4%
Applied rewrites63.4%
if 1.9e5 < t Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6469.3%
Applied rewrites69.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6458.8%
Applied rewrites58.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (fmax x y)))
(t_2
(+
(- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
(* (- a 1/2) (log t))))
(t_3 (* a (log t))))
(if (<= t_2 -20000000000000000000)
(+ (* -1 t) t_3)
(if (<= t_2 2000)
(- (+ t_1 (+ (log z) (* -1/2 (log t)))) t)
(- (+ t_1 (+ (log z) t_3)) t)))))double code(double x, double y, double z, double t, double a) {
double t_1 = log(fmax(x, y));
double t_2 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
double t_3 = a * log(t);
double tmp;
if (t_2 <= -2e+19) {
tmp = (-1.0 * t) + t_3;
} else if (t_2 <= 2000.0) {
tmp = (t_1 + (log(z) + (-0.5 * log(t)))) - t;
} else {
tmp = (t_1 + (log(z) + t_3)) - t;
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = log(fmax(x, y))
t_2 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5d0) * log(t))
t_3 = a * log(t)
if (t_2 <= (-2d+19)) then
tmp = ((-1.0d0) * t) + t_3
else if (t_2 <= 2000.0d0) then
tmp = (t_1 + (log(z) + ((-0.5d0) * log(t)))) - t
else
tmp = (t_1 + (log(z) + t_3)) - t
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(fmax(x, y));
double t_2 = ((Math.log((fmin(x, y) + fmax(x, y))) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
double t_3 = a * Math.log(t);
double tmp;
if (t_2 <= -2e+19) {
tmp = (-1.0 * t) + t_3;
} else if (t_2 <= 2000.0) {
tmp = (t_1 + (Math.log(z) + (-0.5 * Math.log(t)))) - t;
} else {
tmp = (t_1 + (Math.log(z) + t_3)) - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(fmax(x, y)) t_2 = ((math.log((fmin(x, y) + fmax(x, y))) + math.log(z)) - t) + ((a - 0.5) * math.log(t)) t_3 = a * math.log(t) tmp = 0 if t_2 <= -2e+19: tmp = (-1.0 * t) + t_3 elif t_2 <= 2000.0: tmp = (t_1 + (math.log(z) + (-0.5 * math.log(t)))) - t else: tmp = (t_1 + (math.log(z) + t_3)) - t return tmp
function code(x, y, z, t, a) t_1 = log(fmax(x, y)) t_2 = Float64(Float64(Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) t_3 = Float64(a * log(t)) tmp = 0.0 if (t_2 <= -2e+19) tmp = Float64(Float64(-1.0 * t) + t_3); elseif (t_2 <= 2000.0) tmp = Float64(Float64(t_1 + Float64(log(z) + Float64(-0.5 * log(t)))) - t); else tmp = Float64(Float64(t_1 + Float64(log(z) + t_3)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(max(x, y)); t_2 = ((log((min(x, y) + max(x, y))) + log(z)) - t) + ((a - 0.5) * log(t)); t_3 = a * log(t); tmp = 0.0; if (t_2 <= -2e+19) tmp = (-1.0 * t) + t_3; elseif (t_2 <= 2000.0) tmp = (t_1 + (log(z) + (-0.5 * log(t)))) - t; else tmp = (t_1 + (log(z) + t_3)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -20000000000000000000], N[(N[(-1 * t), $MachinePrecision] + t$95$3), $MachinePrecision], If[LessEqual[t$95$2, 2000], N[(N[(t$95$1 + N[(N[Log[z], $MachinePrecision] + N[(-1/2 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(t$95$1 + N[(N[Log[z], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \log \left(\mathsf{max}\left(x, y\right)\right)\\
t_2 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t\\
t_3 := a \cdot \log t\\
\mathbf{if}\;t\_2 \leq -20000000000000000000:\\
\;\;\;\;-1 \cdot t + t\_3\\
\mathbf{elif}\;t\_2 \leq 2000:\\
\;\;\;\;\left(t\_1 + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \left(\log z + t\_3\right)\right) - t\\
\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))) < -2e19Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.0%
Applied rewrites75.0%
if -2e19 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 2e3Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6469.3%
Applied rewrites69.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6458.8%
Applied rewrites58.8%
Taylor expanded in a around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6440.5%
Applied rewrites40.5%
if 2e3 < (+.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 t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6469.3%
Applied rewrites69.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6458.8%
Applied rewrites58.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (- t) (* (- 1/2 a) (log t)))))
(if (<= a -4600000000)
t_1
(if (<= a 420000000)
(- (+ (log (fmax x y)) (+ (log z) (* -1/2 (log t)))) t)
t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = -t - ((0.5 - a) * log(t));
double tmp;
if (a <= -4600000000.0) {
tmp = t_1;
} else if (a <= 420000000.0) {
tmp = (log(fmax(x, y)) + (log(z) + (-0.5 * log(t)))) - 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 = -t - ((0.5d0 - a) * log(t))
if (a <= (-4600000000.0d0)) then
tmp = t_1
else if (a <= 420000000.0d0) then
tmp = (log(fmax(x, y)) + (log(z) + ((-0.5d0) * log(t)))) - 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 = -t - ((0.5 - a) * Math.log(t));
double tmp;
if (a <= -4600000000.0) {
tmp = t_1;
} else if (a <= 420000000.0) {
tmp = (Math.log(fmax(x, y)) + (Math.log(z) + (-0.5 * Math.log(t)))) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -t - ((0.5 - a) * math.log(t)) tmp = 0 if a <= -4600000000.0: tmp = t_1 elif a <= 420000000.0: tmp = (math.log(fmax(x, y)) + (math.log(z) + (-0.5 * math.log(t)))) - t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))) tmp = 0.0 if (a <= -4600000000.0) tmp = t_1; elseif (a <= 420000000.0) tmp = Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(-0.5 * log(t)))) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -t - ((0.5 - a) * log(t)); tmp = 0.0; if (a <= -4600000000.0) tmp = t_1; elseif (a <= 420000000.0) tmp = (log(max(x, y)) + (log(z) + (-0.5 * log(t)))) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4600000000], t$95$1, If[LessEqual[a, 420000000], N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(-1/2 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\
\mathbf{if}\;a \leq -4600000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 420000000:\\
\;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -4.6e9 or 4.2e8 < a Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
Applied rewrites77.5%
if -4.6e9 < a < 4.2e8Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6469.3%
Applied rewrites69.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6458.8%
Applied rewrites58.8%
Taylor expanded in a around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6440.5%
Applied rewrites40.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ (fmin x y) (fmax x y))) (log z))))
(if (<= t_1 -750)
(+ (* -1 t) (* a (log t)))
(if (<= t_1 705)
(- (+ (log (* (fmax x y) z)) (* (log t) (- a 1/2))) t)
(- (- t) (* (- 1/2 a) (log t)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = log((fmin(x, y) + fmax(x, y))) + log(z);
double tmp;
if (t_1 <= -750.0) {
tmp = (-1.0 * t) + (a * log(t));
} else if (t_1 <= 705.0) {
tmp = (log((fmax(x, y) * z)) + (log(t) * (a - 0.5))) - t;
} else {
tmp = -t - ((0.5 - a) * log(t));
}
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((fmin(x, y) + fmax(x, y))) + log(z)
if (t_1 <= (-750.0d0)) then
tmp = ((-1.0d0) * t) + (a * log(t))
else if (t_1 <= 705.0d0) then
tmp = (log((fmax(x, y) * z)) + (log(t) * (a - 0.5d0))) - t
else
tmp = -t - ((0.5d0 - a) * log(t))
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((fmin(x, y) + fmax(x, y))) + Math.log(z);
double tmp;
if (t_1 <= -750.0) {
tmp = (-1.0 * t) + (a * Math.log(t));
} else if (t_1 <= 705.0) {
tmp = (Math.log((fmax(x, y) * z)) + (Math.log(t) * (a - 0.5))) - t;
} else {
tmp = -t - ((0.5 - a) * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((fmin(x, y) + fmax(x, y))) + math.log(z) tmp = 0 if t_1 <= -750.0: tmp = (-1.0 * t) + (a * math.log(t)) elif t_1 <= 705.0: tmp = (math.log((fmax(x, y) * z)) + (math.log(t) * (a - 0.5))) - t else: tmp = -t - ((0.5 - a) * math.log(t)) return tmp
function code(x, y, z, t, a) t_1 = Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) tmp = 0.0 if (t_1 <= -750.0) tmp = Float64(Float64(-1.0 * t) + Float64(a * log(t))); elseif (t_1 <= 705.0) tmp = Float64(Float64(log(Float64(fmax(x, y) * z)) + Float64(log(t) * Float64(a - 0.5))) - t); else tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((min(x, y) + max(x, y))) + log(z); tmp = 0.0; if (t_1 <= -750.0) tmp = (-1.0 * t) + (a * log(t)); elseif (t_1 <= 705.0) tmp = (log((max(x, y) * z)) + (log(t) * (a - 0.5))) - t; else tmp = -t - ((0.5 - a) * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -750], N[(N[(-1 * t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 705], N[(N[(N[Log[N[(N[Max[x, y], $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\\
\mathbf{if}\;t\_1 \leq -750:\\
\;\;\;\;-1 \cdot t + a \cdot \log t\\
\mathbf{elif}\;t\_1 \leq 705:\\
\;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right) \cdot z\right) + \log t \cdot \left(a - \frac{1}{2}\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.0%
Applied rewrites75.0%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 705Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
add-flipN/A
associate-+l-N/A
lower--.f64N/A
lower-neg.f64N/A
lower--.f64N/A
Applied rewrites76.9%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6453.6%
Applied rewrites53.6%
if 705 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
Applied rewrites77.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1
(+
(- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
(* (- a 1/2) (log t)))))
(if (<= t_1 -20000000000000000000)
(+ (* -1 t) (* a (log t)))
(if (<= t_1 700)
(- (log (* (* (pow t (- a 1/2)) z) (fmax x y))) t)
(- (- t) (* (- 1/2 a) (log t)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
double tmp;
if (t_1 <= -2e+19) {
tmp = (-1.0 * t) + (a * log(t));
} else if (t_1 <= 700.0) {
tmp = log(((pow(t, (a - 0.5)) * z) * fmax(x, y))) - t;
} else {
tmp = -t - ((0.5 - a) * log(t));
}
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((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5d0) * log(t))
if (t_1 <= (-2d+19)) then
tmp = ((-1.0d0) * t) + (a * log(t))
else if (t_1 <= 700.0d0) then
tmp = log((((t ** (a - 0.5d0)) * z) * fmax(x, y))) - t
else
tmp = -t - ((0.5d0 - a) * log(t))
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((fmin(x, y) + fmax(x, y))) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
double tmp;
if (t_1 <= -2e+19) {
tmp = (-1.0 * t) + (a * Math.log(t));
} else if (t_1 <= 700.0) {
tmp = Math.log(((Math.pow(t, (a - 0.5)) * z) * fmax(x, y))) - t;
} else {
tmp = -t - ((0.5 - a) * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((math.log((fmin(x, y) + fmax(x, y))) + math.log(z)) - t) + ((a - 0.5) * math.log(t)) tmp = 0 if t_1 <= -2e+19: tmp = (-1.0 * t) + (a * math.log(t)) elif t_1 <= 700.0: tmp = math.log(((math.pow(t, (a - 0.5)) * z) * fmax(x, y))) - t else: tmp = -t - ((0.5 - a) * math.log(t)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_1 <= -2e+19) tmp = Float64(Float64(-1.0 * t) + Float64(a * log(t))); elseif (t_1 <= 700.0) tmp = Float64(log(Float64(Float64((t ^ Float64(a - 0.5)) * z) * fmax(x, y))) - t); else tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((log((min(x, y) + max(x, y))) + log(z)) - t) + ((a - 0.5) * log(t)); tmp = 0.0; if (t_1 <= -2e+19) tmp = (-1.0 * t) + (a * log(t)); elseif (t_1 <= 700.0) tmp = log((((t ^ (a - 0.5)) * z) * max(x, y))) - t; else tmp = -t - ((0.5 - a) * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -20000000000000000000], N[(N[(-1 * t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 700], N[(N[Log[N[(N[(N[Power[t, N[(a - 1/2), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t\\
\mathbf{if}\;t\_1 \leq -20000000000000000000:\\
\;\;\;\;-1 \cdot t + a \cdot \log t\\
\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot \mathsf{max}\left(x, y\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\
\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))) < -2e19Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.0%
Applied rewrites75.0%
if -2e19 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 700Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6469.3%
Applied rewrites69.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift--.f64N/A
log-pow-revN/A
lift-pow.f64N/A
lift-log.f64N/A
sum-logN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lower-*.f6424.8%
Applied rewrites24.8%
if 700 < (+.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 t around inf
lower-*.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
Applied rewrites77.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1
(+
(- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
(* (- a 1/2) (log t)))))
(if (<= t_1 -20000000000000000000)
(+ (* -1 t) (* a (log t)))
(if (<= t_1 700)
(- (log (* (* (pow t -1/2) z) (fmax x y))) t)
(- (- t) (* (- 1/2 a) (log t)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
double tmp;
if (t_1 <= -2e+19) {
tmp = (-1.0 * t) + (a * log(t));
} else if (t_1 <= 700.0) {
tmp = log(((pow(t, -0.5) * z) * fmax(x, y))) - t;
} else {
tmp = -t - ((0.5 - a) * log(t));
}
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((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5d0) * log(t))
if (t_1 <= (-2d+19)) then
tmp = ((-1.0d0) * t) + (a * log(t))
else if (t_1 <= 700.0d0) then
tmp = log((((t ** (-0.5d0)) * z) * fmax(x, y))) - t
else
tmp = -t - ((0.5d0 - a) * log(t))
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((fmin(x, y) + fmax(x, y))) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
double tmp;
if (t_1 <= -2e+19) {
tmp = (-1.0 * t) + (a * Math.log(t));
} else if (t_1 <= 700.0) {
tmp = Math.log(((Math.pow(t, -0.5) * z) * fmax(x, y))) - t;
} else {
tmp = -t - ((0.5 - a) * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((math.log((fmin(x, y) + fmax(x, y))) + math.log(z)) - t) + ((a - 0.5) * math.log(t)) tmp = 0 if t_1 <= -2e+19: tmp = (-1.0 * t) + (a * math.log(t)) elif t_1 <= 700.0: tmp = math.log(((math.pow(t, -0.5) * z) * fmax(x, y))) - t else: tmp = -t - ((0.5 - a) * math.log(t)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_1 <= -2e+19) tmp = Float64(Float64(-1.0 * t) + Float64(a * log(t))); elseif (t_1 <= 700.0) tmp = Float64(log(Float64(Float64((t ^ -0.5) * z) * fmax(x, y))) - t); else tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((log((min(x, y) + max(x, y))) + log(z)) - t) + ((a - 0.5) * log(t)); tmp = 0.0; if (t_1 <= -2e+19) tmp = (-1.0 * t) + (a * log(t)); elseif (t_1 <= 700.0) tmp = log((((t ^ -0.5) * z) * max(x, y))) - t; else tmp = -t - ((0.5 - a) * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -20000000000000000000], N[(N[(-1 * t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 700], N[(N[Log[N[(N[(N[Power[t, -1/2], $MachinePrecision] * z), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t\\
\mathbf{if}\;t\_1 \leq -20000000000000000000:\\
\;\;\;\;-1 \cdot t + a \cdot \log t\\
\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\log \left(\left({t}^{\frac{-1}{2}} \cdot z\right) \cdot \mathsf{max}\left(x, y\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\
\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))) < -2e19Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.0%
Applied rewrites75.0%
if -2e19 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 700Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6469.3%
Applied rewrites69.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift--.f64N/A
log-pow-revN/A
lift-pow.f64N/A
lift-log.f64N/A
sum-logN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lower-*.f6424.8%
Applied rewrites24.8%
Taylor expanded in a around 0
Applied rewrites29.3%
if 700 < (+.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 t around inf
lower-*.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
Applied rewrites77.5%
(FPCore (x y z t a) :precision binary64 (- (- t) (* (- 1/2 a) (log t))))
double code(double x, double y, double z, double t, double a) {
return -t - ((0.5 - a) * 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 = -t - ((0.5d0 - a) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return -t - ((0.5 - a) * Math.log(t));
}
def code(x, y, z, t, a): return -t - ((0.5 - a) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = -t - ((0.5 - a) * log(t)); end
code[x_, y_, z_, t_, a_] := N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
add-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
lift-neg.f64N/A
Applied rewrites77.5%
(FPCore (x y z t a) :precision binary64 (+ (* -1 t) (* a (log t))))
double code(double x, double y, double z, double t, double a) {
return (-1.0 * t) + (a * 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 = ((-1.0d0) * t) + (a * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (-1.0 * t) + (a * Math.log(t));
}
def code(x, y, z, t, a): return (-1.0 * t) + (a * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(-1.0 * t) + Float64(a * log(t))) end
function tmp = code(x, y, z, t, a) tmp = (-1.0 * t) + (a * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(-1 * t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
-1 \cdot t + a \cdot \log t
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.0%
Applied rewrites75.0%
(FPCore (x y z t a) :precision binary64 (+ (- t) (* -1/2 (log t))))
double code(double x, double y, double z, double t, double a) {
return -t + (-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 = -t + ((-0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return -t + (-0.5 * Math.log(t));
}
def code(x, y, z, t, a): return -t + (-0.5 * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(-t) + Float64(-0.5 * log(t))) end
function tmp = code(x, y, z, t, a) tmp = -t + (-0.5 * log(t)); end
code[x_, y_, z_, t_, a_] := N[((-t) + N[(-1/2 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-t\right) + \frac{-1}{2} \cdot \log t
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in a around 0
lower-*.f64N/A
lower-log.f6440.0%
Applied rewrites40.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6440.0%
Applied rewrites40.0%
herbie shell --seed 2025271 -o generate:evaluate
(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 1/2) (log t))))