
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (+ (log (+ y x)) (- (log z) t)) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return (log((y + x)) + (log(z) - t)) + ((a - 0.5) * log(t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (log((y + x)) + (log(z) - t)) + ((a - 0.5d0) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log((y + x)) + (Math.log(z) - t)) + ((a - 0.5) * Math.log(t));
}
def code(x, y, z, t, a): return (math.log((y + x)) + (math.log(z) - t)) + ((a - 0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(log(Float64(y + x)) + Float64(log(z) - t)) + Float64(Float64(a - 0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = (log((y + x)) + (log(z) - t)) + ((a - 0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log \left(y + x\right) + \left(\log z - t\right)\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Initial program 99.6%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.6
Applied rewrites99.6%
(FPCore (x y z t a) :precision binary64 (+ (log (+ x y)) (+ (- (log z) t) (* (log t) (- a 0.5)))))
double code(double x, double y, double z, double t, double a) {
return log((x + y)) + ((log(z) - t) + (log(t) * (a - 0.5)));
}
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) + (log(t) * (a - 0.5d0)))
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) + (Math.log(t) * (a - 0.5)));
}
def code(x, y, z, t, a): return math.log((x + y)) + ((math.log(z) - t) + (math.log(t) * (a - 0.5)))
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(Float64(log(z) - t) + Float64(log(t) * Float64(a - 0.5)))) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) + ((log(z) - t) + (log(t) * (a - 0.5))); end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\left(\log z - t\right) + \log t \cdot \left(a - 0.5\right)\right)
\end{array}
Initial program 99.6%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.6
Applied rewrites99.6%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites99.6%
(FPCore (x y z t a) :precision binary64 (- (+ (log z) (log y)) (- t (* (log t) (- a 0.5)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) + log(y)) - (t - (log(t) * (a - 0.5)));
}
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(z) + log(y)) - (t - (log(t) * (a - 0.5d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) + Math.log(y)) - (t - (Math.log(t) * (a - 0.5)));
}
def code(x, y, z, t, a): return (math.log(z) + math.log(y)) - (t - (math.log(t) * (a - 0.5)))
function code(x, y, z, t, a) return Float64(Float64(log(z) + log(y)) - Float64(t - Float64(log(t) * Float64(a - 0.5)))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) + log(y)) - (t - (log(t) * (a - 0.5))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(t - N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z + \log y\right) - \left(t - \log t \cdot \left(a - 0.5\right)\right)
\end{array}
Initial program 99.6%
Taylor expanded in x around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6452.9
Applied rewrites52.9%
lift-*.f64N/A
lift-log.f64N/A
log-prodN/A
lower-+.f64N/A
lift-log.f64N/A
lower-log.f6468.9
Applied rewrites68.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.43) (+ (log (+ x y)) (fma (log t) (- a 0.5) (log z))) (+ (- (+ (log y) (log z)) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.43) {
tmp = log((x + y)) + fma(log(t), (a - 0.5), log(z));
} else {
tmp = ((log(y) + log(z)) - t) + (a * log(t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.43) tmp = Float64(log(Float64(x + y)) + fma(log(t), Float64(a - 0.5), log(z))); else tmp = Float64(Float64(Float64(log(y) + log(z)) - t) + Float64(a * log(t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.43], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.43:\\
\;\;\;\;\log \left(x + y\right) + \mathsf{fma}\left(\log t, a - 0.5, \log z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\log y + \log z\right) - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if t < 0.429999999999999993Initial program 99.3%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.3
Applied rewrites99.3%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-log.f6498.6
Applied rewrites98.6%
if 0.429999999999999993 < t Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.2%
Taylor expanded in a around inf
Applied rewrites73.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.43) (- (+ (log z) (log y)) (* (- (log t)) (- a 0.5))) (+ (- (+ (log y) (log z)) t) (* a (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.43) {
tmp = (log(z) + log(y)) - (-log(t) * (a - 0.5));
} else {
tmp = ((log(y) + log(z)) - t) + (a * log(t));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 0.43d0) then
tmp = (log(z) + log(y)) - (-log(t) * (a - 0.5d0))
else
tmp = ((log(y) + log(z)) - t) + (a * log(t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.43) {
tmp = (Math.log(z) + Math.log(y)) - (-Math.log(t) * (a - 0.5));
} else {
tmp = ((Math.log(y) + Math.log(z)) - t) + (a * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.43: tmp = (math.log(z) + math.log(y)) - (-math.log(t) * (a - 0.5)) else: tmp = ((math.log(y) + math.log(z)) - t) + (a * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.43) tmp = Float64(Float64(log(z) + log(y)) - Float64(Float64(-log(t)) * Float64(a - 0.5))); else tmp = Float64(Float64(Float64(log(y) + log(z)) - t) + Float64(a * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.43) tmp = (log(z) + log(y)) - (-log(t) * (a - 0.5)); else tmp = ((log(y) + log(z)) - t) + (a * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.43], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - N[((-N[Log[t], $MachinePrecision]) * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.43:\\
\;\;\;\;\left(\log z + \log y\right) - \left(-\log t\right) \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\log y + \log z\right) - t\right) + a \cdot \log t\\
\end{array}
\end{array}
if t < 0.429999999999999993Initial program 99.3%
Taylor expanded in x around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6449.1
Applied rewrites49.1%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6449.1
Applied rewrites49.1%
lift-*.f64N/A
lift-log.f64N/A
log-prodN/A
lower-+.f64N/A
lift-log.f64N/A
lower-log.f6463.6
Applied rewrites63.6%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift-log.f64N/A
lift--.f6463.3
Applied rewrites63.3%
if 0.429999999999999993 < t Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites74.2%
Taylor expanded in a around inf
Applied rewrites73.8%
(FPCore (x y z t a)
:precision binary64
(if (<= a -0.5)
(+ (- (+ (log y) (log z)) t) (* a (log t)))
(if (<= a 1.35)
(- (+ (log z) (log y)) (fma (log t) 0.5 t))
(fma (- a 0.5) (log t) (- t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -0.5) {
tmp = ((log(y) + log(z)) - t) + (a * log(t));
} else if (a <= 1.35) {
tmp = (log(z) + log(y)) - fma(log(t), 0.5, t);
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -0.5) tmp = Float64(Float64(Float64(log(y) + log(z)) - t) + Float64(a * log(t))); elseif (a <= 1.35) tmp = Float64(Float64(log(z) + log(y)) - fma(log(t), 0.5, t)); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -0.5], N[(N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.35], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * 0.5 + t), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.5:\\
\;\;\;\;\left(\left(\log y + \log z\right) - t\right) + a \cdot \log t\\
\mathbf{elif}\;a \leq 1.35:\\
\;\;\;\;\left(\log z + \log y\right) - \mathsf{fma}\left(\log t, 0.5, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\end{array}
\end{array}
if a < -0.5Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites74.2%
Taylor expanded in a around inf
Applied rewrites73.7%
if -0.5 < a < 1.3500000000000001Initial program 99.5%
Taylor expanded in x around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6448.0
Applied rewrites48.0%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6448.0
Applied rewrites48.0%
lift-*.f64N/A
lift-log.f64N/A
log-prodN/A
lower-+.f64N/A
lift-log.f64N/A
lower-log.f6463.3
Applied rewrites63.3%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f6462.7
Applied rewrites62.7%
if 1.3500000000000001 < a Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites74.6%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6474.6
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6458.9
Applied rewrites58.9%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6498.7
Applied rewrites98.7%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.52)
(+ (+ (log (+ y x)) (- t)) (* (- a 0.5) (log t)))
(if (<= a 1.35)
(- (+ (log z) (log y)) (fma (log t) 0.5 t))
(fma (- a 0.5) (log t) (- t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.52) {
tmp = (log((y + x)) + -t) + ((a - 0.5) * log(t));
} else if (a <= 1.35) {
tmp = (log(z) + log(y)) - fma(log(t), 0.5, t);
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.52) tmp = Float64(Float64(log(Float64(y + x)) + Float64(-t)) + Float64(Float64(a - 0.5) * log(t))); elseif (a <= 1.35) tmp = Float64(Float64(log(z) + log(y)) - fma(log(t), 0.5, t)); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.52], N[(N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] + (-t)), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.35], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * 0.5 + t), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.52:\\
\;\;\;\;\left(\log \left(y + x\right) + \left(-t\right)\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{elif}\;a \leq 1.35:\\
\;\;\;\;\left(\log z + \log y\right) - \mathsf{fma}\left(\log t, 0.5, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\end{array}
\end{array}
if a < -1.52Initial program 99.7%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.7
Applied rewrites99.7%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6498.8
Applied rewrites98.8%
if -1.52 < a < 1.3500000000000001Initial program 99.5%
Taylor expanded in x around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6448.0
Applied rewrites48.0%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6448.0
Applied rewrites48.0%
lift-*.f64N/A
lift-log.f64N/A
log-prodN/A
lower-+.f64N/A
lift-log.f64N/A
lower-log.f6463.3
Applied rewrites63.3%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f6462.7
Applied rewrites62.7%
if 1.3500000000000001 < a Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites74.6%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6474.6
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6458.9
Applied rewrites58.9%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6498.7
Applied rewrites98.7%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.52)
(+ (+ (log (+ y x)) (- t)) (* (- a 0.5) (log t)))
(if (<= a 1.35)
(+ (log y) (- (fma -0.5 (log t) (log z)) t))
(fma (- a 0.5) (log t) (- t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.52) {
tmp = (log((y + x)) + -t) + ((a - 0.5) * log(t));
} else if (a <= 1.35) {
tmp = log(y) + (fma(-0.5, log(t), log(z)) - t);
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.52) tmp = Float64(Float64(log(Float64(y + x)) + Float64(-t)) + Float64(Float64(a - 0.5) * log(t))); elseif (a <= 1.35) tmp = Float64(log(y) + Float64(fma(-0.5, log(t), log(z)) - t)); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.52], N[(N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] + (-t)), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.35], N[(N[Log[y], $MachinePrecision] + N[(N[(-0.5 * N[Log[t], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.52:\\
\;\;\;\;\left(\log \left(y + x\right) + \left(-t\right)\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{elif}\;a \leq 1.35:\\
\;\;\;\;\log y + \left(\mathsf{fma}\left(-0.5, \log t, \log z\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\end{array}
\end{array}
if a < -1.52Initial program 99.7%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.7
Applied rewrites99.7%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6498.8
Applied rewrites98.8%
if -1.52 < a < 1.3500000000000001Initial program 99.5%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.5
Applied rewrites99.5%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites99.5%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6498.4
Applied rewrites98.4%
Taylor expanded in x around 0
lift-log.f6462.7
Applied rewrites62.7%
if 1.3500000000000001 < a Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites74.6%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6474.6
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6458.9
Applied rewrites58.9%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6498.7
Applied rewrites98.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (+ x y)))
(t_2 (+ (- (+ t_1 (log z)) t) (* (- a 0.5) (log t)))))
(if (<= t_2 -10000.0)
(fma (- a 0.5) (log t) (- t))
(if (<= t_2 1020.0)
(- (log (* z y)) (* (- (log t)) (- a 0.5)))
(+ t_1 (* (log t) a))))))
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)) - t) + ((a - 0.5) * log(t));
double tmp;
if (t_2 <= -10000.0) {
tmp = fma((a - 0.5), log(t), -t);
} else if (t_2 <= 1020.0) {
tmp = log((z * y)) - (-log(t) * (a - 0.5));
} else {
tmp = t_1 + (log(t) * a);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = log(Float64(x + y)) t_2 = Float64(Float64(Float64(t_1 + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_2 <= -10000.0) tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); elseif (t_2 <= 1020.0) tmp = Float64(log(Float64(z * y)) - Float64(Float64(-log(t)) * Float64(a - 0.5))); else tmp = Float64(t_1 + Float64(log(t) * a)); 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[(N[(N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -10000.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision], If[LessEqual[t$95$2, 1020.0], N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] - N[((-N[Log[t], $MachinePrecision]) * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
t_2 := \left(\left(t\_1 + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{if}\;t\_2 \leq -10000:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\mathbf{elif}\;t\_2 \leq 1020:\\
\;\;\;\;\log \left(z \cdot y\right) - \left(-\log t\right) \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \log t \cdot a\\
\end{array}
\end{array}
if (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < -1e4Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites74.7%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6474.7
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6458.5
Applied rewrites58.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6498.9
Applied rewrites98.9%
if -1e4 < (+.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.0%
Taylor expanded in x around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6445.6
Applied rewrites45.6%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6445.6
Applied rewrites45.6%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lift-neg.f64N/A
lift-log.f64N/A
lift--.f6444.7
Applied rewrites44.7%
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
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.6
Applied rewrites99.6%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites99.6%
Taylor expanded in a around inf
*-commutativeN/A
lift-log.f64N/A
lift-*.f6484.1
Applied rewrites84.1%
(FPCore (x y z t a) :precision binary64 (if (<= (+ (log (+ x y)) (log z)) 710.0) (fma (- a 0.5) (log t) (- (log (* z (+ y x))) t)) (+ (+ (log (+ y x)) (- t)) (* (- a 0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((log((x + y)) + log(z)) <= 710.0) {
tmp = fma((a - 0.5), log(t), (log((z * (y + x))) - t));
} else {
tmp = (log((y + x)) + -t) + ((a - 0.5) * log(t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(log(Float64(x + y)) + log(z)) <= 710.0) tmp = fma(Float64(a - 0.5), log(t), Float64(log(Float64(z * Float64(y + x))) - t)); else tmp = Float64(Float64(log(Float64(y + x)) + Float64(-t)) + Float64(Float64(a - 0.5) * log(t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 710.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] + (-t)), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log \left(x + y\right) + \log z \leq 710:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \log \left(z \cdot \left(y + x\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(y + x\right) + \left(-t\right)\right) + \left(a - 0.5\right) \cdot \log t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 710Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f64N/A
lower--.f64N/A
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6495.6
Applied rewrites95.6%
if 710 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.7
Applied rewrites99.7%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6478.0
Applied rewrites78.0%
(FPCore (x y z t a) :precision binary64 (if (<= (+ (log (+ x y)) (log z)) 710.0) (- (log (* z y)) (- t (* (log t) (- a 0.5)))) (+ (+ (log (+ y x)) (- t)) (* (- a 0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((log((x + y)) + log(z)) <= 710.0) {
tmp = log((z * y)) - (t - (log(t) * (a - 0.5)));
} else {
tmp = (log((y + x)) + -t) + ((a - 0.5) * log(t));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((log((x + y)) + log(z)) <= 710.0d0) then
tmp = log((z * y)) - (t - (log(t) * (a - 0.5d0)))
else
tmp = (log((y + x)) + -t) + ((a - 0.5d0) * log(t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((Math.log((x + y)) + Math.log(z)) <= 710.0) {
tmp = Math.log((z * y)) - (t - (Math.log(t) * (a - 0.5)));
} else {
tmp = (Math.log((y + x)) + -t) + ((a - 0.5) * Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (math.log((x + y)) + math.log(z)) <= 710.0: tmp = math.log((z * y)) - (t - (math.log(t) * (a - 0.5))) else: tmp = (math.log((y + x)) + -t) + ((a - 0.5) * math.log(t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(log(Float64(x + y)) + log(z)) <= 710.0) tmp = Float64(log(Float64(z * y)) - Float64(t - Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(log(Float64(y + x)) + Float64(-t)) + Float64(Float64(a - 0.5) * log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((log((x + y)) + log(z)) <= 710.0) tmp = log((z * y)) - (t - (log(t) * (a - 0.5))); else tmp = (log((y + x)) + -t) + ((a - 0.5) * log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 710.0], N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] - N[(t - N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] + (-t)), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log \left(x + y\right) + \log z \leq 710:\\
\;\;\;\;\log \left(z \cdot y\right) - \left(t - \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log \left(y + x\right) + \left(-t\right)\right) + \left(a - 0.5\right) \cdot \log t\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 710Initial program 99.6%
Taylor expanded in x around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6462.5
Applied rewrites62.5%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6462.5
Applied rewrites62.5%
if 710 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.7
Applied rewrites99.7%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6478.0
Applied rewrites78.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (+ x y)))
(t_2 (+ (- (+ t_1 (log z)) t) (* (- a 0.5) (log t)))))
(if (<= t_2 -10000.0)
(fma (- a 0.5) (log t) (- t))
(if (<= t_2 1020.0)
(- (log (* z y)) (- t (* (log t) -0.5)))
(+ t_1 (* (log t) a))))))
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)) - t) + ((a - 0.5) * log(t));
double tmp;
if (t_2 <= -10000.0) {
tmp = fma((a - 0.5), log(t), -t);
} else if (t_2 <= 1020.0) {
tmp = log((z * y)) - (t - (log(t) * -0.5));
} else {
tmp = t_1 + (log(t) * a);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = log(Float64(x + y)) t_2 = Float64(Float64(Float64(t_1 + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) tmp = 0.0 if (t_2 <= -10000.0) tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); elseif (t_2 <= 1020.0) tmp = Float64(log(Float64(z * y)) - Float64(t - Float64(log(t) * -0.5))); else tmp = Float64(t_1 + Float64(log(t) * a)); 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[(N[(N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -10000.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision], If[LessEqual[t$95$2, 1020.0], N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] - N[(t - N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
t_2 := \left(\left(t\_1 + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
\mathbf{if}\;t\_2 \leq -10000:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\mathbf{elif}\;t\_2 \leq 1020:\\
\;\;\;\;\log \left(z \cdot y\right) - \left(t - \log t \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \log t \cdot a\\
\end{array}
\end{array}
if (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < -1e4Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites74.7%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6474.7
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6458.5
Applied rewrites58.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6498.9
Applied rewrites98.9%
if -1e4 < (+.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.0%
Taylor expanded in x around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6445.6
Applied rewrites45.6%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6445.6
Applied rewrites45.6%
Taylor expanded in a around 0
Applied rewrites44.6%
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
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.6
Applied rewrites99.6%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites99.6%
Taylor expanded in a around inf
*-commutativeN/A
lift-log.f64N/A
lift-*.f6484.1
Applied rewrites84.1%
(FPCore (x y z t a) :precision binary64 (if (<= (+ (log (+ x y)) (log z)) 710.0) (- (log (* z y)) (- t (* (log t) (- a 0.5)))) (fma (- a 0.5) (log t) (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((log((x + y)) + log(z)) <= 710.0) {
tmp = log((z * y)) - (t - (log(t) * (a - 0.5)));
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(log(Float64(x + y)) + log(z)) <= 710.0) tmp = Float64(log(Float64(z * y)) - Float64(t - Float64(log(t) * Float64(a - 0.5)))); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 710.0], N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] - N[(t - N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log \left(x + y\right) + \log z \leq 710:\\
\;\;\;\;\log \left(z \cdot y\right) - \left(t - \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 710Initial program 99.6%
Taylor expanded in x around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6462.5
Applied rewrites62.5%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6462.5
Applied rewrites62.5%
if 710 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites67.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6467.5
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6416.8
Applied rewrites16.8%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
(FPCore (x y z t a) :precision binary64 (if (<= (+ (log (+ x y)) (log z)) 710.0) (fma (- a 0.5) (log t) (- (log (* z y)) t)) (fma (- a 0.5) (log t) (- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((log((x + y)) + log(z)) <= 710.0) {
tmp = fma((a - 0.5), log(t), (log((z * y)) - t));
} else {
tmp = fma((a - 0.5), log(t), -t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(log(Float64(x + y)) + log(z)) <= 710.0) tmp = fma(Float64(a - 0.5), log(t), Float64(log(Float64(z * y)) - t)); else tmp = fma(Float64(a - 0.5), log(t), Float64(-t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], 710.0], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(z * y), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\log \left(x + y\right) + \log z \leq 710:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, \log \left(z \cdot y\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
\end{array}
\end{array}
if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 710Initial program 99.6%
Taylor expanded in x around 0
+-commutativeN/A
sum-logN/A
lower-log.f64N/A
lower-*.f6462.5
Applied rewrites62.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6462.5
Applied rewrites62.5%
if 710 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites67.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6467.5
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6416.8
Applied rewrites16.8%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
(FPCore (x y z t a) :precision binary64 (fma (- a 0.5) (log t) (- t)))
double code(double x, double y, double z, double t, double a) {
return fma((a - 0.5), log(t), -t);
}
function code(x, y, z, t, a) return fma(Float64(a - 0.5), log(t), Float64(-t)) end
code[x_, y_, z_, t_, a_] := N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a - 0.5, \log t, -t\right)
\end{array}
Initial program 99.6%
Taylor expanded in x around inf
Applied rewrites68.9%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-log.f6468.9
lift-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift-log.f64N/A
sum-logN/A
lower-log.f64N/A
lower-*.f6453.5
Applied rewrites53.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (log t) a)))
(if (<= a -420000.0)
t_1
(if (<= a 56000000000000.0) (+ (log (+ x y)) (- t)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * a;
double tmp;
if (a <= -420000.0) {
tmp = t_1;
} else if (a <= 56000000000000.0) {
tmp = log((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 = log(t) * a
if (a <= (-420000.0d0)) then
tmp = t_1
else if (a <= 56000000000000.0d0) then
tmp = log((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 = Math.log(t) * a;
double tmp;
if (a <= -420000.0) {
tmp = t_1;
} else if (a <= 56000000000000.0) {
tmp = Math.log((x + y)) + -t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * a tmp = 0 if a <= -420000.0: tmp = t_1 elif a <= 56000000000000.0: tmp = math.log((x + y)) + -t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * a) tmp = 0.0 if (a <= -420000.0) tmp = t_1; elseif (a <= 56000000000000.0) tmp = Float64(log(Float64(x + y)) + Float64(-t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * a; tmp = 0.0; if (a <= -420000.0) tmp = t_1; elseif (a <= 56000000000000.0) tmp = log((x + y)) + -t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -420000.0], t$95$1, If[LessEqual[a, 56000000000000.0], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + (-t)), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot a\\
\mathbf{if}\;a \leq -420000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 56000000000000:\\
\;\;\;\;\log \left(x + y\right) + \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.2e5 or 5.6e13 < a Initial program 99.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6475.8
Applied rewrites75.8%
if -4.2e5 < a < 5.6e13Initial program 99.5%
lift--.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift-log.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lift-log.f6499.5
Applied rewrites99.5%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-+.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites99.5%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6455.7
Applied rewrites55.7%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.55e+24) (* (log t) a) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.55e+24) {
tmp = log(t) * a;
} 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.55d+24) then
tmp = log(t) * a
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.55e+24) {
tmp = Math.log(t) * a;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.55e+24: tmp = math.log(t) * a else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.55e+24) tmp = Float64(log(t) * a); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.55e+24) tmp = log(t) * a; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.55e+24], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.55 \cdot 10^{+24}:\\
\;\;\;\;\log t \cdot a\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.55000000000000005e24Initial program 99.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6451.3
Applied rewrites51.3%
if 1.55000000000000005e24 < t Initial program 99.9%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6476.6
Applied rewrites76.6%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.6%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6437.4
Applied rewrites37.4%
herbie shell --seed 2025112
(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))))