
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (- (fma (log t) (- a 0.5) (log z)) (- t (log (+ y x)))))
double code(double x, double y, double z, double t, double a) {
return fma(log(t), (a - 0.5), log(z)) - (t - log((y + x)));
}
function code(x, y, z, t, a) return Float64(fma(log(t), Float64(a - 0.5), log(z)) - Float64(t - log(Float64(y + x)))) end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - N[(t - N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log t, a - 0.5, \log z\right) - \left(t - \log \left(y + x\right)\right)
\end{array}
Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
associate-+r-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
(FPCore (x y z t a) :precision binary64 (- (fma (log t) (- a 0.5) (log z)) (- t (log y))))
double code(double x, double y, double z, double t, double a) {
return fma(log(t), (a - 0.5), log(z)) - (t - log(y));
}
function code(x, y, z, t, a) return Float64(fma(log(t), Float64(a - 0.5), log(z)) - Float64(t - log(y))) end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - N[(t - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log t, a - 0.5, \log z\right) - \left(t - \log y\right)
\end{array}
Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
associate-+r-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
Applied rewrites68.8%
(FPCore (x y z t a) :precision binary64 (- (log z) (fma (- 0.5 a) (log t) (- t (log y)))))
double code(double x, double y, double z, double t, double a) {
return log(z) - fma((0.5 - a), log(t), (t - log(y)));
}
function code(x, y, z, t, a) return Float64(log(z) - fma(Float64(0.5 - a), log(t), Float64(t - log(y)))) end
code[x_, y_, z_, t_, a_] := N[(N[Log[z], $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(t - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log z - \mathsf{fma}\left(0.5 - a, \log t, t - \log y\right)
\end{array}
Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
associate-+r-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
Applied rewrites68.8%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
lower-fma.f6468.8
Applied rewrites68.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (log t))))
(if (<= a -1.2e+20)
t_1
(if (<= a 14500000000.0)
(- (+ (log z) (* -0.5 (log t))) (- t (log y)))
(- (log z) (* -1.0 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a * log(t);
double tmp;
if (a <= -1.2e+20) {
tmp = t_1;
} else if (a <= 14500000000.0) {
tmp = (log(z) + (-0.5 * log(t))) - (t - log(y));
} else {
tmp = log(z) - (-1.0 * 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 = a * log(t)
if (a <= (-1.2d+20)) then
tmp = t_1
else if (a <= 14500000000.0d0) then
tmp = (log(z) + ((-0.5d0) * log(t))) - (t - log(y))
else
tmp = log(z) - ((-1.0d0) * 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 = a * Math.log(t);
double tmp;
if (a <= -1.2e+20) {
tmp = t_1;
} else if (a <= 14500000000.0) {
tmp = (Math.log(z) + (-0.5 * Math.log(t))) - (t - Math.log(y));
} else {
tmp = Math.log(z) - (-1.0 * t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a * math.log(t) tmp = 0 if a <= -1.2e+20: tmp = t_1 elif a <= 14500000000.0: tmp = (math.log(z) + (-0.5 * math.log(t))) - (t - math.log(y)) else: tmp = math.log(z) - (-1.0 * t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a * log(t)) tmp = 0.0 if (a <= -1.2e+20) tmp = t_1; elseif (a <= 14500000000.0) tmp = Float64(Float64(log(z) + Float64(-0.5 * log(t))) - Float64(t - log(y))); else tmp = Float64(log(z) - Float64(-1.0 * t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a * log(t); tmp = 0.0; if (a <= -1.2e+20) tmp = t_1; elseif (a <= 14500000000.0) tmp = (log(z) + (-0.5 * log(t))) - (t - log(y)); else tmp = log(z) - (-1.0 * t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.2e+20], t$95$1, If[LessEqual[a, 14500000000.0], N[(N[(N[Log[z], $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[z], $MachinePrecision] - N[(-1.0 * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a \leq -1.2 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 14500000000:\\
\;\;\;\;\left(\log z + -0.5 \cdot \log t\right) - \left(t - \log y\right)\\
\mathbf{else}:\\
\;\;\;\;\log z - -1 \cdot t\_1\\
\end{array}
\end{array}
if a < -1.2e20Initial program 99.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6438.8
Applied rewrites38.8%
if -1.2e20 < a < 1.45e10Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
associate-+r-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
Applied rewrites68.8%
Taylor expanded in a around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6440.8
Applied rewrites40.8%
if 1.45e10 < a Initial program 99.6%
Taylor expanded in y 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--.f6468.4
Applied rewrites68.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.6
Applied rewrites41.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (log t))))
(if (<= a -1.2e+20)
t_1
(if (<= a 14500000000.0)
(- (log z) (fma 0.5 (log t) (- t (log y))))
(- (log z) (* -1.0 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a * log(t);
double tmp;
if (a <= -1.2e+20) {
tmp = t_1;
} else if (a <= 14500000000.0) {
tmp = log(z) - fma(0.5, log(t), (t - log(y)));
} else {
tmp = log(z) - (-1.0 * t_1);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(a * log(t)) tmp = 0.0 if (a <= -1.2e+20) tmp = t_1; elseif (a <= 14500000000.0) tmp = Float64(log(z) - fma(0.5, log(t), Float64(t - log(y)))); else tmp = Float64(log(z) - Float64(-1.0 * t_1)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.2e+20], t$95$1, If[LessEqual[a, 14500000000.0], N[(N[Log[z], $MachinePrecision] - N[(0.5 * N[Log[t], $MachinePrecision] + N[(t - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[z], $MachinePrecision] - N[(-1.0 * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a \leq -1.2 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 14500000000:\\
\;\;\;\;\log z - \mathsf{fma}\left(0.5, \log t, t - \log y\right)\\
\mathbf{else}:\\
\;\;\;\;\log z - -1 \cdot t\_1\\
\end{array}
\end{array}
if a < -1.2e20Initial program 99.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6438.8
Applied rewrites38.8%
if -1.2e20 < a < 1.45e10Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
associate-+r-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
Applied rewrites68.8%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
lower-fma.f6468.8
Applied rewrites68.8%
Taylor expanded in a around 0
Applied rewrites40.8%
if 1.45e10 < a Initial program 99.6%
Taylor expanded in y 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--.f6468.4
Applied rewrites68.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.6
Applied rewrites41.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z)))
(t_2 (- (log z) (* -1.0 (* a (log t))))))
(if (<= t_1 -750.0)
t_2
(if (<= t_1 700.0)
(- (log (* z (+ y x))) (fma (- 0.5 a) (log t) t))
(if (<= t_1 1035.0) t_2 (- t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double t_2 = log(z) - (-1.0 * (a * log(t)));
double tmp;
if (t_1 <= -750.0) {
tmp = t_2;
} else if (t_1 <= 700.0) {
tmp = log((z * (y + x))) - fma((0.5 - a), log(t), t);
} else if (t_1 <= 1035.0) {
tmp = t_2;
} else {
tmp = -t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) t_2 = Float64(log(z) - Float64(-1.0 * Float64(a * log(t)))) tmp = 0.0 if (t_1 <= -750.0) tmp = t_2; elseif (t_1 <= 700.0) tmp = Float64(log(Float64(z * Float64(y + x))) - fma(Float64(0.5 - a), log(t), t)); elseif (t_1 <= 1035.0) tmp = t_2; else tmp = Float64(-t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[z], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -750.0], t$95$2, If[LessEqual[t$95$1, 700.0], N[(N[Log[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1035.0], t$95$2, (-t)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
t_2 := \log z - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{if}\;t\_1 \leq -750:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\log \left(z \cdot \left(y + x\right)\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\\
\mathbf{elif}\;t\_1 \leq 1035:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750 or 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 1035Initial program 99.6%
Taylor expanded in y 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--.f6468.4
Applied rewrites68.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.6
Applied rewrites41.6%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/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
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f6476.9
Applied rewrites76.9%
if 1035 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6437.2
Applied rewrites37.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z)))
(t_2 (- (log z) (* -1.0 (* a (log t))))))
(if (<= t_1 -750.0)
t_2
(if (<= t_1 700.0)
(- (fma (log t) (- a 0.5) (log (* z (+ y x)))) t)
(if (<= t_1 1035.0) t_2 (- t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double t_2 = log(z) - (-1.0 * (a * log(t)));
double tmp;
if (t_1 <= -750.0) {
tmp = t_2;
} else if (t_1 <= 700.0) {
tmp = fma(log(t), (a - 0.5), log((z * (y + x)))) - t;
} else if (t_1 <= 1035.0) {
tmp = t_2;
} else {
tmp = -t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) t_2 = Float64(log(z) - Float64(-1.0 * Float64(a * log(t)))) tmp = 0.0 if (t_1 <= -750.0) tmp = t_2; elseif (t_1 <= 700.0) tmp = Float64(fma(log(t), Float64(a - 0.5), log(Float64(z * Float64(y + x)))) - t); elseif (t_1 <= 1035.0) tmp = t_2; else tmp = Float64(-t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[z], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -750.0], t$95$2, If[LessEqual[t$95$1, 700.0], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$1, 1035.0], t$95$2, (-t)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
t_2 := \log z - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{if}\;t\_1 \leq -750:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\mathsf{fma}\left(\log t, a - 0.5, \log \left(z \cdot \left(y + x\right)\right)\right) - t\\
\mathbf{elif}\;t\_1 \leq 1035:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750 or 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 1035Initial program 99.6%
Taylor expanded in y 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--.f6468.4
Applied rewrites68.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.6
Applied rewrites41.6%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites76.9%
if 1035 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6437.2
Applied rewrites37.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ x y)) (log z)))
(t_2 (- (log z) (* -1.0 (* a (log t))))))
(if (<= t_1 -750.0)
t_2
(if (<= t_1 700.0)
(- (fma (log t) (- a 0.5) (log (* z y))) t)
(if (<= t_1 1035.0) t_2 (- t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y)) + log(z);
double t_2 = log(z) - (-1.0 * (a * log(t)));
double tmp;
if (t_1 <= -750.0) {
tmp = t_2;
} else if (t_1 <= 700.0) {
tmp = fma(log(t), (a - 0.5), log((z * y))) - t;
} else if (t_1 <= 1035.0) {
tmp = t_2;
} else {
tmp = -t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(x + y)) + log(z)) t_2 = Float64(log(z) - Float64(-1.0 * Float64(a * log(t)))) tmp = 0.0 if (t_1 <= -750.0) tmp = t_2; elseif (t_1 <= 700.0) tmp = Float64(fma(log(t), Float64(a - 0.5), log(Float64(z * y))) - t); elseif (t_1 <= 1035.0) tmp = t_2; else tmp = Float64(-t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[z], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -750.0], t$95$2, If[LessEqual[t$95$1, 700.0], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$1, 1035.0], t$95$2, (-t)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
t_2 := \log z - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{if}\;t\_1 \leq -750:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\mathsf{fma}\left(\log t, a - 0.5, \log \left(z \cdot y\right)\right) - t\\
\mathbf{elif}\;t\_1 \leq 1035:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750 or 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 1035Initial program 99.6%
Taylor expanded in y 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--.f6468.4
Applied rewrites68.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.6
Applied rewrites41.6%
if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites76.9%
Taylor expanded in x around 0
Applied rewrites53.7%
if 1035 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6437.2
Applied rewrites37.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
(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 -5e+32)
(- t)
(if (<= t_1 900.0)
(- (fma (log t) -0.5 (log (* y z))) t)
(- (log z) (* -1.0 (* 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 <= -5e+32) {
tmp = -t;
} else if (t_1 <= 900.0) {
tmp = fma(log(t), -0.5, log((y * z))) - t;
} else {
tmp = log(z) - (-1.0 * (a * 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 <= -5e+32) tmp = Float64(-t); elseif (t_1 <= 900.0) tmp = Float64(fma(log(t), -0.5, log(Float64(y * z))) - t); else tmp = Float64(log(z) - Float64(-1.0 * Float64(a * log(t)))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+32], (-t), If[LessEqual[t$95$1, 900.0], N[(N[(N[Log[t], $MachinePrecision] * -0.5 + N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[z], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+32}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t\_1 \leq 900:\\
\;\;\;\;\mathsf{fma}\left(\log t, -0.5, \log \left(y \cdot z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log z - -1 \cdot \left(a \cdot \log t\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < -4.9999999999999997e32Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6437.2
Applied rewrites37.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
if -4.9999999999999997e32 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 900Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites76.9%
Taylor expanded in a around 0
Applied rewrites48.2%
Taylor expanded in x around 0
lower-*.f6432.0
Applied rewrites32.0%
if 900 < (+.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 y 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--.f6468.4
Applied rewrites68.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.6
Applied rewrites41.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* a (log t)))) (if (<= (- a 0.5) -1e+32) t_1 (if (<= (- a 0.5) 5000000.0) (- t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a * log(t);
double tmp;
if ((a - 0.5) <= -1e+32) {
tmp = t_1;
} else if ((a - 0.5) <= 5000000.0) {
tmp = -t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a * log(t)
if ((a - 0.5d0) <= (-1d+32)) then
tmp = t_1
else if ((a - 0.5d0) <= 5000000.0d0) then
tmp = -t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a * Math.log(t);
double tmp;
if ((a - 0.5) <= -1e+32) {
tmp = t_1;
} else if ((a - 0.5) <= 5000000.0) {
tmp = -t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a * math.log(t) tmp = 0 if (a - 0.5) <= -1e+32: tmp = t_1 elif (a - 0.5) <= 5000000.0: tmp = -t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(a * log(t)) tmp = 0.0 if (Float64(a - 0.5) <= -1e+32) tmp = t_1; elseif (Float64(a - 0.5) <= 5000000.0) tmp = Float64(-t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a * log(t); tmp = 0.0; if ((a - 0.5) <= -1e+32) tmp = t_1; elseif ((a - 0.5) <= 5000000.0) tmp = -t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a - 0.5), $MachinePrecision], -1e+32], t$95$1, If[LessEqual[N[(a - 0.5), $MachinePrecision], 5000000.0], (-t), t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a - 0.5 \leq -1 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a - 0.5 \leq 5000000:\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -1.00000000000000005e32 or 5e6 < (-.f64 a #s(literal 1/2 binary64)) Initial program 99.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6438.8
Applied rewrites38.8%
if -1.00000000000000005e32 < (-.f64 a #s(literal 1/2 binary64)) < 5e6Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6437.2
Applied rewrites37.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.3e+41) (- (log z) (* -1.0 (* a (log t)))) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.3e+41) {
tmp = log(z) - (-1.0 * (a * log(t)));
} else {
tmp = -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 <= 1.3d+41) then
tmp = log(z) - ((-1.0d0) * (a * log(t)))
else
tmp = -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 <= 1.3e+41) {
tmp = Math.log(z) - (-1.0 * (a * Math.log(t)));
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.3e+41: tmp = math.log(z) - (-1.0 * (a * math.log(t))) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.3e+41) tmp = Float64(log(z) - Float64(-1.0 * Float64(a * log(t)))); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.3e+41) tmp = log(z) - (-1.0 * (a * log(t))); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.3e+41], N[(N[Log[z], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.3 \cdot 10^{+41}:\\
\;\;\;\;\log z - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.3e41Initial program 99.6%
Taylor expanded in y 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--.f6468.4
Applied rewrites68.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.6
Applied rewrites41.6%
if 1.3e41 < t Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6437.2
Applied rewrites37.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6437.2
Applied rewrites37.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
herbie shell --seed 2025143
(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))))