
(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]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
Herbie found 13 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]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
(FPCore (x y z t a) :precision binary64 (+ (- (log (+ y x)) (- t (log z))) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return (log((y + x)) - (t - log(z))) + ((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 + x)) - (t - log(z))) + ((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 + x)) - (t - Math.log(z))) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return (math.log((y + x)) - (t - math.log(z))) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(log(Float64(y + x)) - Float64(t - log(z))) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = (log((y + x)) - (t - log(z))) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] - N[(t - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\log \left(y + x\right) - \left(t - \log z\right)\right) + \left(a - 0.5\right) \cdot \log t
Initial program 99.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f6499.6%
Applied rewrites99.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.32) (+ (log z) (+ (log (+ (fmin x y) (fmax x y))) (* (log t) (- a 0.5)))) (+ (- (+ (log (fmax x y)) (log z)) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.32) {
tmp = log(z) + (log((fmin(x, y) + fmax(x, y))) + (log(t) * (a - 0.5)));
} else {
tmp = ((log(fmax(x, y)) + log(z)) - t) + (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) :: tmp
if (t <= 0.32d0) then
tmp = log(z) + (log((fmin(x, y) + fmax(x, y))) + (log(t) * (a - 0.5d0)))
else
tmp = ((log(fmax(x, y)) + log(z)) - t) + (a * log(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 <= 0.32) {
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)) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.32: 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)) - t) + (a * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.32) tmp = Float64(log(z) + Float64(log(Float64(fmin(x, y) + fmax(x, y))) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(Float64(log(fmax(x, y)) + log(z)) - t) + Float64(a * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.32) tmp = log(z) + (log((min(x, y) + max(x, y))) + (log(t) * (a - 0.5))); else tmp = ((log(max(x, y)) + log(z)) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.32], 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 - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;t \leq 0.32:\\
\;\;\;\;\log z + \left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + a \cdot \log t\\
\end{array}
if t < 0.32000000000000001Initial 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--.f6462.8%
Applied rewrites62.8%
if 0.32000000000000001 < t Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6459.4%
Applied rewrites59.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ (log (fmax x y)) (log z)) t))
(t_2 (+ t_1 (* a (log t)))))
(if (<= a -1.05)
t_2
(if (<= a 9.6e-33) (+ t_1 (* -0.5 (log t))) t_2))))double code(double x, double y, double z, double t, double a) {
double t_1 = (log(fmax(x, y)) + log(z)) - t;
double t_2 = t_1 + (a * log(t));
double tmp;
if (a <= -1.05) {
tmp = t_2;
} else if (a <= 9.6e-33) {
tmp = t_1 + (-0.5 * log(t));
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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) :: tmp
t_1 = (log(fmax(x, y)) + log(z)) - t
t_2 = t_1 + (a * log(t))
if (a <= (-1.05d0)) then
tmp = t_2
else if (a <= 9.6d-33) then
tmp = t_1 + ((-0.5d0) * log(t))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (Math.log(fmax(x, y)) + Math.log(z)) - t;
double t_2 = t_1 + (a * Math.log(t));
double tmp;
if (a <= -1.05) {
tmp = t_2;
} else if (a <= 9.6e-33) {
tmp = t_1 + (-0.5 * Math.log(t));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (math.log(fmax(x, y)) + math.log(z)) - t t_2 = t_1 + (a * math.log(t)) tmp = 0 if a <= -1.05: tmp = t_2 elif a <= 9.6e-33: tmp = t_1 + (-0.5 * math.log(t)) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(log(fmax(x, y)) + log(z)) - t) t_2 = Float64(t_1 + Float64(a * log(t))) tmp = 0.0 if (a <= -1.05) tmp = t_2; elseif (a <= 9.6e-33) tmp = Float64(t_1 + Float64(-0.5 * log(t))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (log(max(x, y)) + log(z)) - t; t_2 = t_1 + (a * log(t)); tmp = 0.0; if (a <= -1.05) tmp = t_2; elseif (a <= 9.6e-33) tmp = t_1 + (-0.5 * log(t)); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.05], t$95$2, If[LessEqual[a, 9.6e-33], N[(t$95$1 + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \left(\log \left(\mathsf{max}\left(x, y\right)\right) + \log z\right) - t\\
t_2 := t\_1 + a \cdot \log t\\
\mathbf{if}\;a \leq -1.05:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq 9.6 \cdot 10^{-33}:\\
\;\;\;\;t\_1 + -0.5 \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if a < -1.05 or 9.6e-33 < a Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6459.4%
Applied rewrites59.4%
if -1.05 < a < 9.6e-33Initial program 99.6%
Taylor expanded in y around 0
lower-log.f6469.0%
Applied rewrites69.0%
Taylor expanded in a around 0
Applied rewrites40.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6441.4%
Applied rewrites41.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (- (+ (log (fmax x y)) (log z)) t) (* a (log t))))
(t_2 (+ (fmin x y) (fmax x y)))
(t_3 (+ (log t_2) (log z))))
(if (<= t_3 -700.0)
t_1
(if (<= t_3 750.0)
(- (- (- (log (/ (/ 1.0 z) t_2))) t) (* (- 0.5 a) (log t)))
t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = ((log(fmax(x, y)) + log(z)) - t) + (a * log(t));
double t_2 = fmin(x, y) + fmax(x, y);
double t_3 = log(t_2) + log(z);
double tmp;
if (t_3 <= -700.0) {
tmp = t_1;
} else if (t_3 <= 750.0) {
tmp = (-log(((1.0 / z) / t_2)) - t) - ((0.5 - a) * log(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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = ((log(fmax(x, y)) + log(z)) - t) + (a * log(t))
t_2 = fmin(x, y) + fmax(x, y)
t_3 = log(t_2) + log(z)
if (t_3 <= (-700.0d0)) then
tmp = t_1
else if (t_3 <= 750.0d0) then
tmp = (-log(((1.0d0 / z) / t_2)) - t) - ((0.5d0 - a) * log(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(fmax(x, y)) + Math.log(z)) - t) + (a * Math.log(t));
double t_2 = fmin(x, y) + fmax(x, y);
double t_3 = Math.log(t_2) + Math.log(z);
double tmp;
if (t_3 <= -700.0) {
tmp = t_1;
} else if (t_3 <= 750.0) {
tmp = (-Math.log(((1.0 / z) / t_2)) - t) - ((0.5 - a) * Math.log(t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((math.log(fmax(x, y)) + math.log(z)) - t) + (a * math.log(t)) t_2 = fmin(x, y) + fmax(x, y) t_3 = math.log(t_2) + math.log(z) tmp = 0 if t_3 <= -700.0: tmp = t_1 elif t_3 <= 750.0: tmp = (-math.log(((1.0 / z) / t_2)) - t) - ((0.5 - a) * math.log(t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(log(fmax(x, y)) + log(z)) - t) + Float64(a * log(t))) t_2 = Float64(fmin(x, y) + fmax(x, y)) t_3 = Float64(log(t_2) + log(z)) tmp = 0.0 if (t_3 <= -700.0) tmp = t_1; elseif (t_3 <= 750.0) tmp = Float64(Float64(Float64(-log(Float64(Float64(1.0 / z) / t_2))) - t) - Float64(Float64(0.5 - a) * log(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((log(max(x, y)) + log(z)) - t) + (a * log(t)); t_2 = min(x, y) + max(x, y); t_3 = log(t_2) + log(z); tmp = 0.0; if (t_3 <= -700.0) tmp = t_1; elseif (t_3 <= 750.0) tmp = (-log(((1.0 / z) / t_2)) - t) - ((0.5 - a) * log(t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[t$95$2], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -700.0], t$95$1, If[LessEqual[t$95$3, 750.0], N[(N[((-N[Log[N[(N[(1.0 / z), $MachinePrecision] / t$95$2), $MachinePrecision]], $MachinePrecision]) - t), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_1 := \left(\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + a \cdot \log t\\
t_2 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
t_3 := \log t\_2 + \log z\\
\mathbf{if}\;t\_3 \leq -700:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 750:\\
\;\;\;\;\left(\left(-\log \left(\frac{\frac{1}{z}}{t\_2}\right)\right) - t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -700 or 750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6459.4%
Applied rewrites59.4%
if -700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 750Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f6475.9%
Applied rewrites75.9%
lift-log.f64N/A
lift-*.f64N/A
*-commutativeN/A
sum-logN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
add-flipN/A
sub-negate-revN/A
lower-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lift-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f64N/A
lower-/.f6477.1%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6477.1%
Applied rewrites77.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z))))
(if (<= t_1 -700.0)
(+ (- t) (* (log t) a))
(if (<= t_1 750.0)
(- (- (- (log (/ (/ 1.0 z) (+ x y)))) t) (* (- 0.5 a) (log t)))
(+ (- t) (+ (* -0.5 (log t)) (* a (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 <= -700.0) {
tmp = -t + (log(t) * a);
} else if (t_1 <= 750.0) {
tmp = (-log(((1.0 / z) / (x + y))) - t) - ((0.5 - a) * log(t));
} else {
tmp = -t + ((-0.5 * log(t)) + (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((x + y)) + log(z)
if (t_1 <= (-700.0d0)) then
tmp = -t + (log(t) * a)
else if (t_1 <= 750.0d0) then
tmp = (-log(((1.0d0 / z) / (x + y))) - t) - ((0.5d0 - a) * log(t))
else
tmp = -t + (((-0.5d0) * log(t)) + (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((x + y)) + Math.log(z);
double tmp;
if (t_1 <= -700.0) {
tmp = -t + (Math.log(t) * a);
} else if (t_1 <= 750.0) {
tmp = (-Math.log(((1.0 / z) / (x + y))) - t) - ((0.5 - a) * Math.log(t));
} else {
tmp = -t + ((-0.5 * Math.log(t)) + (a * Math.log(t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((x + y)) + math.log(z) tmp = 0 if t_1 <= -700.0: tmp = -t + (math.log(t) * a) elif t_1 <= 750.0: tmp = (-math.log(((1.0 / z) / (x + y))) - t) - ((0.5 - a) * math.log(t)) else: tmp = -t + ((-0.5 * math.log(t)) + (a * math.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 <= -700.0) tmp = Float64(Float64(-t) + Float64(log(t) * a)); elseif (t_1 <= 750.0) tmp = Float64(Float64(Float64(-log(Float64(Float64(1.0 / z) / Float64(x + y)))) - t) - Float64(Float64(0.5 - a) * log(t))); else tmp = Float64(Float64(-t) + Float64(Float64(-0.5 * log(t)) + Float64(a * log(t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((x + y)) + log(z); tmp = 0.0; if (t_1 <= -700.0) tmp = -t + (log(t) * a); elseif (t_1 <= 750.0) tmp = (-log(((1.0 / z) / (x + y))) - t) - ((0.5 - a) * log(t)); else tmp = -t + ((-0.5 * log(t)) + (a * log(t))); end tmp_2 = 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, -700.0], N[((-t) + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 750.0], N[(N[((-N[Log[N[(N[(1.0 / z), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) - t), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-t) + N[(N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_1 \leq -700:\\
\;\;\;\;\left(-t\right) + \log t \cdot a\\
\mathbf{elif}\;t\_1 \leq 750:\\
\;\;\;\;\left(\left(-\log \left(\frac{\frac{1}{z}}{x + y}\right)\right) - t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) + \left(-0.5 \cdot \log t + a \cdot \log t\right)\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -700Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
if -700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 750Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f6475.9%
Applied rewrites75.9%
lift-log.f64N/A
lift-*.f64N/A
*-commutativeN/A
sum-logN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
add-flipN/A
sub-negate-revN/A
lower-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lift-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f64N/A
lower-/.f6477.1%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6477.1%
Applied rewrites77.1%
if 750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6477.8%
Applied rewrites77.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z))))
(if (<= t_1 -750.0)
(+ (- t) (* (log t) a))
(if (<= t_1 690.0)
(- (- (log (* z (+ y x))) t) (* (- 0.5 a) (log t)))
(+ (- t) (+ (* -0.5 (log t)) (* a (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 <= -750.0) {
tmp = -t + (log(t) * a);
} else if (t_1 <= 690.0) {
tmp = (log((z * (y + x))) - t) - ((0.5 - a) * log(t));
} else {
tmp = -t + ((-0.5 * log(t)) + (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((x + y)) + log(z)
if (t_1 <= (-750.0d0)) then
tmp = -t + (log(t) * a)
else if (t_1 <= 690.0d0) then
tmp = (log((z * (y + x))) - t) - ((0.5d0 - a) * log(t))
else
tmp = -t + (((-0.5d0) * log(t)) + (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((x + y)) + Math.log(z);
double tmp;
if (t_1 <= -750.0) {
tmp = -t + (Math.log(t) * a);
} else if (t_1 <= 690.0) {
tmp = (Math.log((z * (y + x))) - t) - ((0.5 - a) * Math.log(t));
} else {
tmp = -t + ((-0.5 * Math.log(t)) + (a * Math.log(t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((x + y)) + math.log(z) tmp = 0 if t_1 <= -750.0: tmp = -t + (math.log(t) * a) elif t_1 <= 690.0: tmp = (math.log((z * (y + x))) - t) - ((0.5 - a) * math.log(t)) else: tmp = -t + ((-0.5 * math.log(t)) + (a * math.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 <= -750.0) tmp = Float64(Float64(-t) + Float64(log(t) * a)); elseif (t_1 <= 690.0) tmp = Float64(Float64(log(Float64(z * Float64(y + x))) - t) - Float64(Float64(0.5 - a) * log(t))); else tmp = Float64(Float64(-t) + Float64(Float64(-0.5 * log(t)) + Float64(a * log(t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((x + y)) + log(z); tmp = 0.0; if (t_1 <= -750.0) tmp = -t + (log(t) * a); elseif (t_1 <= 690.0) tmp = (log((z * (y + x))) - t) - ((0.5 - a) * log(t)); else tmp = -t + ((-0.5 * log(t)) + (a * log(t))); end tmp_2 = 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, -750.0], N[((-t) + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 690.0], N[(N[(N[Log[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-t) + N[(N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t\_1 \leq -750:\\
\;\;\;\;\left(-t\right) + \log t \cdot a\\
\mathbf{elif}\;t\_1 \leq 690:\\
\;\;\;\;\left(\log \left(z \cdot \left(y + x\right)\right) - t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) + \left(-0.5 \cdot \log t + a \cdot \log t\right)\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 690Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f6475.9%
Applied rewrites75.9%
if 690 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6477.8%
Applied rewrites77.8%
(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 -600.0)
(+ (- t) (* (log t) a))
(if (<= t_1 1000.0)
(- (- (log (* z (+ y x))) t) (* 0.5 (log t)))
(+ (- t) (+ (* -0.5 (log t)) (* a (log t))))))))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 <= -600.0) {
tmp = -t + (log(t) * a);
} else if (t_1 <= 1000.0) {
tmp = (log((z * (y + x))) - t) - (0.5 * log(t));
} else {
tmp = -t + ((-0.5 * log(t)) + (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((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
if (t_1 <= (-600.0d0)) then
tmp = -t + (log(t) * a)
else if (t_1 <= 1000.0d0) then
tmp = (log((z * (y + x))) - t) - (0.5d0 * log(t))
else
tmp = -t + (((-0.5d0) * log(t)) + (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((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
double tmp;
if (t_1 <= -600.0) {
tmp = -t + (Math.log(t) * a);
} else if (t_1 <= 1000.0) {
tmp = (Math.log((z * (y + x))) - t) - (0.5 * Math.log(t));
} else {
tmp = -t + ((-0.5 * Math.log(t)) + (a * Math.log(t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t)) tmp = 0 if t_1 <= -600.0: tmp = -t + (math.log(t) * a) elif t_1 <= 1000.0: tmp = (math.log((z * (y + x))) - t) - (0.5 * math.log(t)) else: tmp = -t + ((-0.5 * math.log(t)) + (a * math.log(t))) 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 <= -600.0) tmp = Float64(Float64(-t) + Float64(log(t) * a)); elseif (t_1 <= 1000.0) tmp = Float64(Float64(log(Float64(z * Float64(y + x))) - t) - Float64(0.5 * log(t))); else tmp = Float64(Float64(-t) + Float64(Float64(-0.5 * log(t)) + Float64(a * log(t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); tmp = 0.0; if (t_1 <= -600.0) tmp = -t + (log(t) * a); elseif (t_1 <= 1000.0) tmp = (log((z * (y + x))) - t) - (0.5 * log(t)); else tmp = -t + ((-0.5 * log(t)) + (a * log(t))); end tmp_2 = 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, -600.0], N[((-t) + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1000.0], N[(N[(N[Log[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] - N[(0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-t) + N[(N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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 -600:\\
\;\;\;\;\left(-t\right) + \log t \cdot a\\
\mathbf{elif}\;t\_1 \leq 1000:\\
\;\;\;\;\left(\log \left(z \cdot \left(y + x\right)\right) - t\right) - 0.5 \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) + \left(-0.5 \cdot \log t + a \cdot \log t\right)\\
\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))) < -600Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
if -600 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 1e3Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f6475.9%
Applied rewrites75.9%
Taylor expanded in a around 0
Applied rewrites47.2%
if 1e3 < (+.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.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6477.8%
Applied rewrites77.8%
(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 -600.0)
(+ (- t) (* (log t) a))
(if (<= t_1 1000.0)
(- (log (* z (+ x y))) (* 0.5 (log t)))
(- (- t) (* (- 0.5 a) (log t)))))))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 <= -600.0) {
tmp = -t + (log(t) * a);
} else if (t_1 <= 1000.0) {
tmp = log((z * (x + y))) - (0.5 * log(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((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
if (t_1 <= (-600.0d0)) then
tmp = -t + (log(t) * a)
else if (t_1 <= 1000.0d0) then
tmp = log((z * (x + y))) - (0.5d0 * log(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((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
double tmp;
if (t_1 <= -600.0) {
tmp = -t + (Math.log(t) * a);
} else if (t_1 <= 1000.0) {
tmp = Math.log((z * (x + y))) - (0.5 * Math.log(t));
} else {
tmp = -t - ((0.5 - a) * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t)) tmp = 0 if t_1 <= -600.0: tmp = -t + (math.log(t) * a) elif t_1 <= 1000.0: tmp = math.log((z * (x + y))) - (0.5 * math.log(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(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_1 <= -600.0) tmp = Float64(Float64(-t) + Float64(log(t) * a)); elseif (t_1 <= 1000.0) tmp = Float64(log(Float64(z * Float64(x + y))) - Float64(0.5 * log(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((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); tmp = 0.0; if (t_1 <= -600.0) tmp = -t + (log(t) * a); elseif (t_1 <= 1000.0) tmp = log((z * (x + y))) - (0.5 * log(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[(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, -600.0], N[((-t) + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1000.0], N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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 -600:\\
\;\;\;\;\left(-t\right) + \log t \cdot a\\
\mathbf{elif}\;t\_1 \leq 1000:\\
\;\;\;\;\log \left(z \cdot \left(x + y\right)\right) - 0.5 \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(0.5 - 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))) < -600Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
if -600 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 1e3Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f6475.9%
Applied rewrites75.9%
Taylor expanded in a around 0
Applied rewrites47.2%
Taylor expanded in t around 0
lower-log.f64N/A
lower-*.f64N/A
lower-+.f6419.9%
Applied rewrites19.9%
if 1e3 < (+.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.8%
Applied rewrites77.8%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift-*.f64N/A
lower--.f6477.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.8%
Applied rewrites77.8%
(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 -600.0)
(+ (- t) (* (log t) a))
(if (<= t_1 1000.0)
(- (log (* z (+ x y))) (* 0.5 (log t)))
(+ (- t) (+ (* -0.5 (log t)) (* a (log t))))))))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 <= -600.0) {
tmp = -t + (log(t) * a);
} else if (t_1 <= 1000.0) {
tmp = log((z * (x + y))) - (0.5 * log(t));
} else {
tmp = -t + ((-0.5 * log(t)) + (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((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
if (t_1 <= (-600.0d0)) then
tmp = -t + (log(t) * a)
else if (t_1 <= 1000.0d0) then
tmp = log((z * (x + y))) - (0.5d0 * log(t))
else
tmp = -t + (((-0.5d0) * log(t)) + (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((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
double tmp;
if (t_1 <= -600.0) {
tmp = -t + (Math.log(t) * a);
} else if (t_1 <= 1000.0) {
tmp = Math.log((z * (x + y))) - (0.5 * Math.log(t));
} else {
tmp = -t + ((-0.5 * Math.log(t)) + (a * Math.log(t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t)) tmp = 0 if t_1 <= -600.0: tmp = -t + (math.log(t) * a) elif t_1 <= 1000.0: tmp = math.log((z * (x + y))) - (0.5 * math.log(t)) else: tmp = -t + ((-0.5 * math.log(t)) + (a * math.log(t))) 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 <= -600.0) tmp = Float64(Float64(-t) + Float64(log(t) * a)); elseif (t_1 <= 1000.0) tmp = Float64(log(Float64(z * Float64(x + y))) - Float64(0.5 * log(t))); else tmp = Float64(Float64(-t) + Float64(Float64(-0.5 * log(t)) + Float64(a * log(t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); tmp = 0.0; if (t_1 <= -600.0) tmp = -t + (log(t) * a); elseif (t_1 <= 1000.0) tmp = log((z * (x + y))) - (0.5 * log(t)); else tmp = -t + ((-0.5 * log(t)) + (a * log(t))); end tmp_2 = 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, -600.0], N[((-t) + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1000.0], N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-t) + N[(N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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 -600:\\
\;\;\;\;\left(-t\right) + \log t \cdot a\\
\mathbf{elif}\;t\_1 \leq 1000:\\
\;\;\;\;\log \left(z \cdot \left(x + y\right)\right) - 0.5 \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) + \left(-0.5 \cdot \log t + a \cdot \log t\right)\\
\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))) < -600Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
if -600 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 1e3Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f6475.9%
Applied rewrites75.9%
Taylor expanded in a around 0
Applied rewrites47.2%
Taylor expanded in t around 0
lower-log.f64N/A
lower-*.f64N/A
lower-+.f6419.9%
Applied rewrites19.9%
if 1e3 < (+.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.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6477.8%
Applied rewrites77.8%
(FPCore (x y z t a) :precision binary64 (- (- t) (* (- 0.5 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[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-t\right) - \left(0.5 - a\right) \cdot \log t
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift-*.f64N/A
lower--.f6477.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6477.8%
Applied rewrites77.8%
(FPCore (x y z t a) :precision binary64 (+ (- t) (* (log t) a)))
double code(double x, double y, double z, double t, double a) {
return -t + (log(t) * a);
}
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 + (log(t) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return -t + (Math.log(t) * a);
}
def code(x, y, z, t, a): return -t + (math.log(t) * a)
function code(x, y, z, t, a) return Float64(Float64(-t) + Float64(log(t) * a)) end
function tmp = code(x, y, z, t, a) tmp = -t + (log(t) * a); end
code[x_, y_, z_, t_, a_] := N[((-t) + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\left(-t\right) + \log t \cdot a
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
(FPCore (x y z t a) :precision binary64 (+ (- t) (* -0.5 (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[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(-t\right) + -0.5 \cdot \log t
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6477.8%
Applied rewrites77.8%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6475.2%
Applied rewrites75.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6475.2%
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites75.2%
Taylor expanded in a around 0
lower-*.f64N/A
lower-log.f6440.8%
Applied rewrites40.8%
herbie shell --seed 2025258
(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))))