
(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 19 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 (fmax x y)) (+ (log z) (* (log t) (- a 0.5)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(fmax(x, y)) + (log(z) + (log(t) * (a - 0.5)))) - t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (log(fmax(x, y)) + (log(z) + (log(t) * (a - 0.5d0)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(fmax(x, y)) + (Math.log(z) + (Math.log(t) * (a - 0.5)))) - t;
}
def code(x, y, z, t, a): return (math.log(fmax(x, y)) + (math.log(z) + (math.log(t) * (a - 0.5)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(max(x, y)) + (log(z) + (log(t) * (a - 0.5)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t
Initial program 99.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6468.5%
Applied rewrites68.5%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (fmax x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log(fmax(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(fmax(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(fmax(x, y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log(fmax(x, y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(fmax(x, y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log(max(x, y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[Max[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(\mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites68.5%
(FPCore (x y z t a) :precision binary64 (fma (- a 0.5) (log t) (- (+ (log (fmax x y)) (log z)) t)))
double code(double x, double y, double z, double t, double a) {
return fma((a - 0.5), log(t), ((log(fmax(x, y)) + log(z)) - t));
}
function code(x, y, z, t, a) return fma(Float64(a - 0.5), log(t), Float64(Float64(log(fmax(x, y)) + log(z)) - t)) end
code[x_, y_, z_, t_, a_] := N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(a - 0.5, \log t, \left(\log \left(\mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right)
Initial program 99.6%
Taylor expanded in y around 0
lower-log.f6468.6%
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lift--.f64N/A
lower--.f6468.6%
Applied rewrites68.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6468.5%
Applied rewrites68.5%
(FPCore (x y z t a) :precision binary64 (fma (- a 0.5) (log t) (- (log (fmax x y)) (- t (log z)))))
double code(double x, double y, double z, double t, double a) {
return fma((a - 0.5), log(t), (log(fmax(x, y)) - (t - log(z))));
}
function code(x, y, z, t, a) return fma(Float64(a - 0.5), log(t), Float64(log(fmax(x, y)) - Float64(t - log(z)))) end
code[x_, y_, z_, t_, a_] := N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] - N[(t - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(a - 0.5, \log t, \log \left(\mathsf{max}\left(x, y\right)\right) - \left(t - \log z\right)\right)
Initial program 99.6%
Taylor expanded in y around 0
lower-log.f6468.6%
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lift--.f64N/A
lower--.f6468.6%
Applied rewrites68.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6468.5%
Applied rewrites68.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lift--.f64N/A
lower--.f6468.5%
Applied rewrites68.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ (fmin x y) (fmax x y))) (log z))))
(if (<= t_1 -720.0)
(- (fma (- a 0.5) (log t) (log (fmin x y))) (- t (log z)))
(if (<= t_1 740.0)
(fma (- a 0.5) (log t) (- (- (log (/ (/ 1.0 z) (fmax x y)))) t))
(- (+ (log (fmax x y)) (+ (log z) (* -0.5 (log t)))) t)))))double code(double x, double y, double z, double t, double a) {
double t_1 = log((fmin(x, y) + fmax(x, y))) + log(z);
double tmp;
if (t_1 <= -720.0) {
tmp = fma((a - 0.5), log(t), log(fmin(x, y))) - (t - log(z));
} else if (t_1 <= 740.0) {
tmp = fma((a - 0.5), log(t), (-log(((1.0 / z) / fmax(x, y))) - t));
} else {
tmp = (log(fmax(x, y)) + (log(z) + (-0.5 * log(t)))) - t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) tmp = 0.0 if (t_1 <= -720.0) tmp = Float64(fma(Float64(a - 0.5), log(t), log(fmin(x, y))) - Float64(t - log(z))); elseif (t_1 <= 740.0) tmp = fma(Float64(a - 0.5), log(t), Float64(Float64(-log(Float64(Float64(1.0 / z) / fmax(x, y)))) - t)); else tmp = Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(-0.5 * log(t)))) - t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -720.0], N[(N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[Log[N[Min[x, y], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 740.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[((-N[Log[N[(N[(1.0 / z), $MachinePrecision] / N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\\
\mathbf{if}\;t\_1 \leq -720:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \log \left(\mathsf{min}\left(x, y\right)\right)\right) - \left(t - \log z\right)\\
\mathbf{elif}\;t\_1 \leq 740:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \left(-\log \left(\frac{\frac{1}{z}}{\mathsf{max}\left(x, y\right)}\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + -0.5 \cdot \log t\right)\right) - t\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -720Initial program 99.6%
Taylor expanded in y around 0
lower-log.f6468.6%
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lift--.f64N/A
lower--.f6468.6%
Applied rewrites68.6%
lift-fma.f64N/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
lower-fma.f6468.6%
Applied rewrites68.6%
if -720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 740Initial program 99.6%
Taylor expanded in y around 0
lower-log.f6468.6%
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lift--.f64N/A
lower--.f6468.6%
Applied rewrites68.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6468.5%
Applied rewrites68.5%
lift-+.f64N/A
add-flipN/A
sub-negate-revN/A
lower-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f64N/A
lower-/.f6452.7%
Applied rewrites52.7%
if 740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6441.1%
Applied rewrites41.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (log (+ (fmin x y) (fmax x y))) (log z))))
(if (<= t_1 -720.0)
(- (log (+ (fmax x y) (fmin x y))) (* -1.0 (* a (log t))))
(if (<= t_1 740.0)
(fma (- a 0.5) (log t) (- (- (log (/ (/ 1.0 z) (fmax x y)))) t))
(- (+ (log (fmax x y)) (+ (log z) (* -0.5 (log t)))) t)))))double code(double x, double y, double z, double t, double a) {
double t_1 = log((fmin(x, y) + fmax(x, y))) + log(z);
double tmp;
if (t_1 <= -720.0) {
tmp = log((fmax(x, y) + fmin(x, y))) - (-1.0 * (a * log(t)));
} else if (t_1 <= 740.0) {
tmp = fma((a - 0.5), log(t), (-log(((1.0 / z) / fmax(x, y))) - t));
} else {
tmp = (log(fmax(x, y)) + (log(z) + (-0.5 * log(t)))) - t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) tmp = 0.0 if (t_1 <= -720.0) tmp = Float64(log(Float64(fmax(x, y) + fmin(x, y))) - Float64(-1.0 * Float64(a * log(t)))); elseif (t_1 <= 740.0) tmp = fma(Float64(a - 0.5), log(t), Float64(Float64(-log(Float64(Float64(1.0 / z) / fmax(x, y)))) - t)); else tmp = Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(-0.5 * log(t)))) - t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -720.0], N[(N[Log[N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 740.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[((-N[Log[N[(N[(1.0 / z), $MachinePrecision] / N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\\
\mathbf{if}\;t\_1 \leq -720:\\
\;\;\;\;\log \left(\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\right) - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{elif}\;t\_1 \leq 740:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \left(-\log \left(\frac{\frac{1}{z}}{\mathsf{max}\left(x, y\right)}\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + -0.5 \cdot \log t\right)\right) - t\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -720Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.4%
Applied rewrites99.4%
lift-*.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sub-to-mult-revN/A
lower--.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.3%
Applied rewrites41.3%
if -720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 740Initial program 99.6%
Taylor expanded in y around 0
lower-log.f6468.6%
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lift--.f64N/A
lower--.f6468.6%
Applied rewrites68.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6468.5%
Applied rewrites68.5%
lift-+.f64N/A
add-flipN/A
sub-negate-revN/A
lower-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f64N/A
lower-/.f6452.7%
Applied rewrites52.7%
if 740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6441.1%
Applied rewrites41.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (fmax x y) (fmin x y)))
(t_2 (+ (log (+ (fmin x y) (fmax x y))) (log z))))
(if (<= t_2 -720.0)
(- (log t_1) (* -1.0 (* a (log t))))
(if (<= t_2 720.0)
(- (fma (log t) (- a 0.5) (log (* z t_1))) t)
(- (+ (log (fmax x y)) (+ (log z) (* -0.5 (log t)))) t)))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmax(x, y) + fmin(x, y);
double t_2 = log((fmin(x, y) + fmax(x, y))) + log(z);
double tmp;
if (t_2 <= -720.0) {
tmp = log(t_1) - (-1.0 * (a * log(t)));
} else if (t_2 <= 720.0) {
tmp = fma(log(t), (a - 0.5), log((z * t_1))) - t;
} else {
tmp = (log(fmax(x, y)) + (log(z) + (-0.5 * log(t)))) - t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(fmax(x, y) + fmin(x, y)) t_2 = Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) tmp = 0.0 if (t_2 <= -720.0) tmp = Float64(log(t_1) - Float64(-1.0 * Float64(a * log(t)))); elseif (t_2 <= 720.0) tmp = Float64(fma(log(t), Float64(a - 0.5), log(Float64(z * t_1))) - t); else tmp = Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(-0.5 * log(t)))) - t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -720.0], N[(N[Log[t$95$1], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 720.0], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[N[(z * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
t_2 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\\
\mathbf{if}\;t\_2 \leq -720:\\
\;\;\;\;\log t\_1 - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{elif}\;t\_2 \leq 720:\\
\;\;\;\;\mathsf{fma}\left(\log t, a - 0.5, \log \left(z \cdot t\_1\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + -0.5 \cdot \log t\right)\right) - t\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -720Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.4%
Applied rewrites99.4%
lift-*.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sub-to-mult-revN/A
lower--.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.3%
Applied rewrites41.3%
if -720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites75.7%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6441.1%
Applied rewrites41.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (fmax x y) (fmin x y)))
(t_2 (+ (log (+ (fmin x y) (fmax x y))) (log z))))
(if (<= t_2 -720.0)
(- (log t_1) (* -1.0 (* a (log t))))
(if (<= t_2 720.0)
(- (fma (log t) (- a 0.5) (log (* z t_1))) t)
(fma -0.5 (log t) (- (+ (log (fmax x y)) (log z)) t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fmax(x, y) + fmin(x, y);
double t_2 = log((fmin(x, y) + fmax(x, y))) + log(z);
double tmp;
if (t_2 <= -720.0) {
tmp = log(t_1) - (-1.0 * (a * log(t)));
} else if (t_2 <= 720.0) {
tmp = fma(log(t), (a - 0.5), log((z * t_1))) - t;
} else {
tmp = fma(-0.5, log(t), ((log(fmax(x, y)) + log(z)) - t));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(fmax(x, y) + fmin(x, y)) t_2 = Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) tmp = 0.0 if (t_2 <= -720.0) tmp = Float64(log(t_1) - Float64(-1.0 * Float64(a * log(t)))); elseif (t_2 <= 720.0) tmp = Float64(fma(log(t), Float64(a - 0.5), log(Float64(z * t_1))) - t); else tmp = fma(-0.5, log(t), Float64(Float64(log(fmax(x, y)) + log(z)) - t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -720.0], N[(N[Log[t$95$1], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 720.0], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[N[(z * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(-0.5 * N[Log[t], $MachinePrecision] + N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
t_2 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\\
\mathbf{if}\;t\_2 \leq -720:\\
\;\;\;\;\log t\_1 - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{elif}\;t\_2 \leq 720:\\
\;\;\;\;\mathsf{fma}\left(\log t, a - 0.5, \log \left(z \cdot t\_1\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log t, \left(\log \left(\mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right)\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -720Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.4%
Applied rewrites99.4%
lift-*.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sub-to-mult-revN/A
lower--.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.3%
Applied rewrites41.3%
if -720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites75.7%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in y around 0
lower-log.f6468.6%
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lift--.f64N/A
lower--.f6468.6%
Applied rewrites68.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6468.5%
Applied rewrites68.5%
Taylor expanded in a around 0
Applied rewrites41.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (+ x y))) (t_2 (+ t_1 (log z))))
(if (<= t_2 -720.0)
(- (log (+ y x)) (* -1.0 (* a (log t))))
(if (<= t_2 720.0)
(- (fma (log t) (- a 0.5) (log (* z (+ y x)))) t)
(- (- t_1 (log (/ (sqrt t) z))) t)))))double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y));
double t_2 = t_1 + log(z);
double tmp;
if (t_2 <= -720.0) {
tmp = log((y + x)) - (-1.0 * (a * log(t)));
} else if (t_2 <= 720.0) {
tmp = fma(log(t), (a - 0.5), log((z * (y + x)))) - t;
} else {
tmp = (t_1 - log((sqrt(t) / z))) - t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = log(Float64(x + y)) t_2 = Float64(t_1 + log(z)) tmp = 0.0 if (t_2 <= -720.0) tmp = Float64(log(Float64(y + x)) - Float64(-1.0 * Float64(a * log(t)))); elseif (t_2 <= 720.0) tmp = Float64(fma(log(t), Float64(a - 0.5), log(Float64(z * Float64(y + x)))) - t); else tmp = Float64(Float64(t_1 - log(Float64(sqrt(t) / z))) - t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -720.0], N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 720.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], N[(N[(t$95$1 - N[Log[N[(N[Sqrt[t], $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
t_2 := t\_1 + \log z\\
\mathbf{if}\;t\_2 \leq -720:\\
\;\;\;\;\log \left(y + x\right) - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{elif}\;t\_2 \leq 720:\\
\;\;\;\;\mathsf{fma}\left(\log t, a - 0.5, \log \left(z \cdot \left(y + x\right)\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \log \left(\frac{\sqrt{t}}{z}\right)\right) - t\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -720Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.4%
Applied rewrites99.4%
lift-*.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sub-to-mult-revN/A
lower--.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.3%
Applied rewrites41.3%
if -720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites75.7%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
neg-logN/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f64N/A
Applied rewrites55.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (+ (fmin x y) (fmax x y)))) (t_2 (+ t_1 (log z))))
(if (<= t_2 -720.0)
(- (log (+ (fmax x y) (fmin x y))) (* -1.0 (* a (log t))))
(if (<= t_2 720.0)
(- (- (log (* z (fmax x y))) t) (* (- 0.5 a) (log t)))
(- (- t_1 (log (/ (sqrt t) z))) t)))))double code(double x, double y, double z, double t, double a) {
double t_1 = log((fmin(x, y) + fmax(x, y)));
double t_2 = t_1 + log(z);
double tmp;
if (t_2 <= -720.0) {
tmp = log((fmax(x, y) + fmin(x, y))) - (-1.0 * (a * log(t)));
} else if (t_2 <= 720.0) {
tmp = (log((z * fmax(x, y))) - t) - ((0.5 - a) * log(t));
} else {
tmp = (t_1 - log((sqrt(t) / z))) - t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = log((fmin(x, y) + fmax(x, y)))
t_2 = t_1 + log(z)
if (t_2 <= (-720.0d0)) then
tmp = log((fmax(x, y) + fmin(x, y))) - ((-1.0d0) * (a * log(t)))
else if (t_2 <= 720.0d0) then
tmp = (log((z * fmax(x, y))) - t) - ((0.5d0 - a) * log(t))
else
tmp = (t_1 - log((sqrt(t) / z))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log((fmin(x, y) + fmax(x, y)));
double t_2 = t_1 + Math.log(z);
double tmp;
if (t_2 <= -720.0) {
tmp = Math.log((fmax(x, y) + fmin(x, y))) - (-1.0 * (a * Math.log(t)));
} else if (t_2 <= 720.0) {
tmp = (Math.log((z * fmax(x, y))) - t) - ((0.5 - a) * Math.log(t));
} else {
tmp = (t_1 - Math.log((Math.sqrt(t) / z))) - t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((fmin(x, y) + fmax(x, y))) t_2 = t_1 + math.log(z) tmp = 0 if t_2 <= -720.0: tmp = math.log((fmax(x, y) + fmin(x, y))) - (-1.0 * (a * math.log(t))) elif t_2 <= 720.0: tmp = (math.log((z * fmax(x, y))) - t) - ((0.5 - a) * math.log(t)) else: tmp = (t_1 - math.log((math.sqrt(t) / z))) - t return tmp
function code(x, y, z, t, a) t_1 = log(Float64(fmin(x, y) + fmax(x, y))) t_2 = Float64(t_1 + log(z)) tmp = 0.0 if (t_2 <= -720.0) tmp = Float64(log(Float64(fmax(x, y) + fmin(x, y))) - Float64(-1.0 * Float64(a * log(t)))); elseif (t_2 <= 720.0) tmp = Float64(Float64(log(Float64(z * fmax(x, y))) - t) - Float64(Float64(0.5 - a) * log(t))); else tmp = Float64(Float64(t_1 - log(Float64(sqrt(t) / z))) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((min(x, y) + max(x, y))); t_2 = t_1 + log(z); tmp = 0.0; if (t_2 <= -720.0) tmp = log((max(x, y) + min(x, y))) - (-1.0 * (a * log(t))); elseif (t_2 <= 720.0) tmp = (log((z * max(x, y))) - t) - ((0.5 - a) * log(t)); else tmp = (t_1 - log((sqrt(t) / z))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -720.0], N[(N[Log[N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 720.0], N[(N[(N[Log[N[(z * N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Log[N[(N[Sqrt[t], $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right)\\
t_2 := t\_1 + \log z\\
\mathbf{if}\;t\_2 \leq -720:\\
\;\;\;\;\log \left(\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\right) - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{elif}\;t\_2 \leq 720:\\
\;\;\;\;\left(\log \left(z \cdot \mathsf{max}\left(x, y\right)\right) - t\right) - \left(0.5 - a\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \log \left(\frac{\sqrt{t}}{z}\right)\right) - t\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -720Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.4%
Applied rewrites99.4%
lift-*.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sub-to-mult-revN/A
lower--.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.3%
Applied rewrites41.3%
if -720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
Taylor expanded in y around 0
lower-log.f6468.6%
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lift--.f64N/A
lower--.f6468.6%
Applied rewrites68.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6468.5%
Applied rewrites68.5%
lift-fma.f64N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
sub-negate-revN/A
lift-log.f64N/A
lower--.f64N/A
Applied rewrites52.5%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
neg-logN/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f64N/A
Applied rewrites55.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (+ (fmin x y) (fmax x y)))) (t_2 (+ t_1 (log z))))
(if (<= t_2 -720.0)
(- (log (+ (fmax x y) (fmin x y))) (* -1.0 (* a (log t))))
(if (<= t_2 720.0)
(fma (- a 0.5) (log t) (- (log (* z (fmax x y))) t))
(- (- t_1 (log (/ (sqrt t) z))) t)))))double code(double x, double y, double z, double t, double a) {
double t_1 = log((fmin(x, y) + fmax(x, y)));
double t_2 = t_1 + log(z);
double tmp;
if (t_2 <= -720.0) {
tmp = log((fmax(x, y) + fmin(x, y))) - (-1.0 * (a * log(t)));
} else if (t_2 <= 720.0) {
tmp = fma((a - 0.5), log(t), (log((z * fmax(x, y))) - t));
} else {
tmp = (t_1 - log((sqrt(t) / z))) - t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = log(Float64(fmin(x, y) + fmax(x, y))) t_2 = Float64(t_1 + log(z)) tmp = 0.0 if (t_2 <= -720.0) tmp = Float64(log(Float64(fmax(x, y) + fmin(x, y))) - Float64(-1.0 * Float64(a * log(t)))); elseif (t_2 <= 720.0) tmp = fma(Float64(a - 0.5), log(t), Float64(log(Float64(z * fmax(x, y))) - t)); else tmp = Float64(Float64(t_1 - log(Float64(sqrt(t) / z))) - t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -720.0], N[(N[Log[N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(-1.0 * N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 720.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(z * N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Log[N[(N[Sqrt[t], $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right)\\
t_2 := t\_1 + \log z\\
\mathbf{if}\;t\_2 \leq -720:\\
\;\;\;\;\log \left(\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\right) - -1 \cdot \left(a \cdot \log t\right)\\
\mathbf{elif}\;t\_2 \leq 720:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \log \left(z \cdot \mathsf{max}\left(x, y\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \log \left(\frac{\sqrt{t}}{z}\right)\right) - t\\
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -720Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.4%
Applied rewrites99.4%
lift-*.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sub-to-mult-revN/A
lower--.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.3%
Applied rewrites41.3%
if -720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 720Initial program 99.6%
Taylor expanded in y around 0
lower-log.f6468.6%
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
add-flipN/A
sub-negate-revN/A
lift--.f64N/A
lower--.f6468.6%
Applied rewrites68.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-log.f6468.5%
Applied rewrites68.5%
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f6452.5%
Applied rewrites52.5%
if 720 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
neg-logN/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f64N/A
Applied rewrites55.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (log t))))
(if (<= (- a 0.5) -5e+81)
t_1
(if (<= (- a 0.5) 2e+30)
(- (- (log (+ x y)) (log (/ (sqrt t) z))) 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) <= -5e+81) {
tmp = t_1;
} else if ((a - 0.5) <= 2e+30) {
tmp = (log((x + y)) - log((sqrt(t) / z))) - 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) <= (-5d+81)) then
tmp = t_1
else if ((a - 0.5d0) <= 2d+30) then
tmp = (log((x + y)) - log((sqrt(t) / z))) - 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) <= -5e+81) {
tmp = t_1;
} else if ((a - 0.5) <= 2e+30) {
tmp = (Math.log((x + y)) - Math.log((Math.sqrt(t) / z))) - 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) <= -5e+81: tmp = t_1 elif (a - 0.5) <= 2e+30: tmp = (math.log((x + y)) - math.log((math.sqrt(t) / z))) - 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) <= -5e+81) tmp = t_1; elseif (Float64(a - 0.5) <= 2e+30) tmp = Float64(Float64(log(Float64(x + y)) - log(Float64(sqrt(t) / z))) - 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) <= -5e+81) tmp = t_1; elseif ((a - 0.5) <= 2e+30) tmp = (log((x + y)) - log((sqrt(t) / z))) - 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], -5e+81], t$95$1, If[LessEqual[N[(a - 0.5), $MachinePrecision], 2e+30], N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] - N[Log[N[(N[Sqrt[t], $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a - 0.5 \leq -5 \cdot 10^{+81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a - 0.5 \leq 2 \cdot 10^{+30}:\\
\;\;\;\;\left(\log \left(x + y\right) - \log \left(\frac{\sqrt{t}}{z}\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -4.9999999999999998e81 or 2e30 < (-.f64 a #s(literal 1/2 binary64)) Initial program 99.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6438.5%
Applied rewrites38.5%
if -4.9999999999999998e81 < (-.f64 a #s(literal 1/2 binary64)) < 2e30Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
add-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
neg-logN/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lower-/.f64N/A
Applied rewrites55.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (log t))))
(if (<= (- a 0.5) -5e+81)
t_1
(if (<= (- a 0.5) 2e+30)
(- (- (log z) (log (/ (sqrt t) (+ x y)))) 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) <= -5e+81) {
tmp = t_1;
} else if ((a - 0.5) <= 2e+30) {
tmp = (log(z) - log((sqrt(t) / (x + y)))) - 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) <= (-5d+81)) then
tmp = t_1
else if ((a - 0.5d0) <= 2d+30) then
tmp = (log(z) - log((sqrt(t) / (x + y)))) - 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) <= -5e+81) {
tmp = t_1;
} else if ((a - 0.5) <= 2e+30) {
tmp = (Math.log(z) - Math.log((Math.sqrt(t) / (x + y)))) - 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) <= -5e+81: tmp = t_1 elif (a - 0.5) <= 2e+30: tmp = (math.log(z) - math.log((math.sqrt(t) / (x + y)))) - 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) <= -5e+81) tmp = t_1; elseif (Float64(a - 0.5) <= 2e+30) tmp = Float64(Float64(log(z) - log(Float64(sqrt(t) / Float64(x + y)))) - 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) <= -5e+81) tmp = t_1; elseif ((a - 0.5) <= 2e+30) tmp = (log(z) - log((sqrt(t) / (x + y)))) - 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], -5e+81], t$95$1, If[LessEqual[N[(a - 0.5), $MachinePrecision], 2e+30], N[(N[(N[Log[z], $MachinePrecision] - N[Log[N[(N[Sqrt[t], $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := a \cdot \log t\\
\mathbf{if}\;a - 0.5 \leq -5 \cdot 10^{+81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a - 0.5 \leq 2 \cdot 10^{+30}:\\
\;\;\;\;\left(\log z - \log \left(\frac{\sqrt{t}}{x + y}\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -4.9999999999999998e81 or 2e30 < (-.f64 a #s(literal 1/2 binary64)) Initial program 99.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6438.5%
Applied rewrites38.5%
if -4.9999999999999998e81 < (-.f64 a #s(literal 1/2 binary64)) < 2e30Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sub-negateN/A
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/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
Applied rewrites57.0%
(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+22)
(- t)
(if (<= t_1 1020.0)
(- (- (log (* (+ x y) z)) (log (sqrt t))) t)
(- (log (+ y x)) (* -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+22) {
tmp = -t;
} else if (t_1 <= 1020.0) {
tmp = (log(((x + y) * z)) - log(sqrt(t))) - t;
} else {
tmp = log((y + x)) - (-1.0 * (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 <= (-5d+22)) then
tmp = -t
else if (t_1 <= 1020.0d0) then
tmp = (log(((x + y) * z)) - log(sqrt(t))) - t
else
tmp = log((y + x)) - ((-1.0d0) * (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 <= -5e+22) {
tmp = -t;
} else if (t_1 <= 1020.0) {
tmp = (Math.log(((x + y) * z)) - Math.log(Math.sqrt(t))) - t;
} else {
tmp = Math.log((y + x)) - (-1.0 * (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 <= -5e+22: tmp = -t elif t_1 <= 1020.0: tmp = (math.log(((x + y) * z)) - math.log(math.sqrt(t))) - t else: tmp = math.log((y + x)) - (-1.0 * (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 <= -5e+22) tmp = Float64(-t); elseif (t_1 <= 1020.0) tmp = Float64(Float64(log(Float64(Float64(x + y) * z)) - log(sqrt(t))) - t); else tmp = Float64(log(Float64(y + x)) - Float64(-1.0 * 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 <= -5e+22) tmp = -t; elseif (t_1 <= 1020.0) tmp = (log(((x + y) * z)) - log(sqrt(t))) - t; else tmp = log((y + x)) - (-1.0 * (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, -5e+22], (-t), If[LessEqual[t$95$1, 1020.0], N[(N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] - N[Log[N[Sqrt[t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] - N[(-1.0 * 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 -5 \cdot 10^{+22}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t\_1 \leq 1020:\\
\;\;\;\;\left(\log \left(\left(x + y\right) \cdot z\right) - \log \left(\sqrt{t}\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y + x\right) - -1 \cdot \left(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))) < -4.9999999999999996e22Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6438.3%
Applied rewrites38.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.3%
Applied rewrites38.3%
if -4.9999999999999996e22 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 1020Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-log.f64N/A
lift-+.f64N/A
lift-log.f64N/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-log.f64N/A
log-pow-revN/A
neg-logN/A
lower-log.f64N/A
pow-flipN/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6447.2%
Applied rewrites47.2%
if 1020 < (+.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%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.4%
Applied rewrites99.4%
lift-*.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sub-to-mult-revN/A
lower--.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.3%
Applied rewrites41.3%
(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+22)
(- t)
(if (<= t_1 700.0)
(- (log (/ (* (+ x y) z) (sqrt t))) t)
(- (log (+ y x)) (* -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+22) {
tmp = -t;
} else if (t_1 <= 700.0) {
tmp = log((((x + y) * z) / sqrt(t))) - t;
} else {
tmp = log((y + x)) - (-1.0 * (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 <= (-5d+22)) then
tmp = -t
else if (t_1 <= 700.0d0) then
tmp = log((((x + y) * z) / sqrt(t))) - t
else
tmp = log((y + x)) - ((-1.0d0) * (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 <= -5e+22) {
tmp = -t;
} else if (t_1 <= 700.0) {
tmp = Math.log((((x + y) * z) / Math.sqrt(t))) - t;
} else {
tmp = Math.log((y + x)) - (-1.0 * (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 <= -5e+22: tmp = -t elif t_1 <= 700.0: tmp = math.log((((x + y) * z) / math.sqrt(t))) - t else: tmp = math.log((y + x)) - (-1.0 * (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 <= -5e+22) tmp = Float64(-t); elseif (t_1 <= 700.0) tmp = Float64(log(Float64(Float64(Float64(x + y) * z) / sqrt(t))) - t); else tmp = Float64(log(Float64(y + x)) - Float64(-1.0 * 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 <= -5e+22) tmp = -t; elseif (t_1 <= 700.0) tmp = log((((x + y) * z) / sqrt(t))) - t; else tmp = log((y + x)) - (-1.0 * (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, -5e+22], (-t), If[LessEqual[t$95$1, 700.0], N[(N[Log[N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] - N[(-1.0 * 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 -5 \cdot 10^{+22}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\log \left(\frac{\left(x + y\right) \cdot z}{\sqrt{t}}\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(y + x\right) - -1 \cdot \left(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))) < -4.9999999999999996e22Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6438.3%
Applied rewrites38.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.3%
Applied rewrites38.3%
if -4.9999999999999996e22 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 700Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
Applied rewrites43.4%
if 700 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
add-flipN/A
associate--l-N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites99.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.4%
Applied rewrites99.4%
lift-*.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
sub-to-mult-revN/A
lower--.f64N/A
Applied rewrites99.5%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6441.3%
Applied rewrites41.3%
(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+22)
(- t)
(if (<= t_1 712.0)
(- (log (/ (* (+ x y) z) (sqrt t))) 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 <= -5e+22) {
tmp = -t;
} else if (t_1 <= 712.0) {
tmp = log((((x + y) * z) / sqrt(t))) - t;
} else {
tmp = 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 <= (-5d+22)) then
tmp = -t
else if (t_1 <= 712.0d0) then
tmp = log((((x + y) * z) / sqrt(t))) - t
else
tmp = 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 <= -5e+22) {
tmp = -t;
} else if (t_1 <= 712.0) {
tmp = Math.log((((x + y) * z) / Math.sqrt(t))) - t;
} else {
tmp = 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 <= -5e+22: tmp = -t elif t_1 <= 712.0: tmp = math.log((((x + y) * z) / math.sqrt(t))) - t else: tmp = 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 <= -5e+22) tmp = Float64(-t); elseif (t_1 <= 712.0) tmp = Float64(log(Float64(Float64(Float64(x + y) * z) / sqrt(t))) - t); else tmp = 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 <= -5e+22) tmp = -t; elseif (t_1 <= 712.0) tmp = log((((x + y) * z) / sqrt(t))) - t; else tmp = 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, -5e+22], (-t), If[LessEqual[t$95$1, 712.0], N[(N[Log[N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], N[(a * N[Log[t], $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 -5 \cdot 10^{+22}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t\_1 \leq 712:\\
\;\;\;\;\log \left(\frac{\left(x + y\right) \cdot z}{\sqrt{t}}\right) - t\\
\mathbf{else}:\\
\;\;\;\;a \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))) < -4.9999999999999996e22Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6438.3%
Applied rewrites38.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.3%
Applied rewrites38.3%
if -4.9999999999999996e22 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 712Initial program 99.6%
Taylor expanded in a around 0
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6462.5%
Applied rewrites62.5%
Applied rewrites43.4%
if 712 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) Initial program 99.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6438.5%
Applied rewrites38.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 67000000000.0) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 67000000000.0) {
tmp = 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 <= 67000000000.0d0) then
tmp = 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 <= 67000000000.0) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 67000000000.0: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 67000000000.0) tmp = 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 <= 67000000000.0) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 67000000000.0], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\mathbf{if}\;t \leq 67000000000:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
if t < 6.7e10Initial program 99.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-log.f6438.5%
Applied rewrites38.5%
if 6.7e10 < t Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6438.3%
Applied rewrites38.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.3%
Applied rewrites38.3%
(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)
-t
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6438.3%
Applied rewrites38.3%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6438.3%
Applied rewrites38.3%
herbie shell --seed 2025183
(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))))