
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * log(y)) - y) - z) + log(t)
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - y) - z) + Math.log(t);
}
def code(x, y, z, t): return (((x * math.log(y)) - y) - z) + math.log(t)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - y) - z) + log(t); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\end{array}
(FPCore (x y z t) :precision binary64 (+ (- (fma (log y) x (- z)) y) (log t)))
double code(double x, double y, double z, double t) {
return (fma(log(y), x, -z) - y) + log(t);
}
function code(x, y, z, t) return Float64(Float64(fma(log(y), x, Float64(-z)) - y) + log(t)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * x + (-z)), $MachinePrecision] - y), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(\log y, x, -z\right) - y\right) + \log t
\end{array}
Initial program 99.9%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
mul-1-negN/A
lower-neg.f6499.9
Applied rewrites99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) y)) (t_2 (* (log y) x)))
(if (<= t_1 -5e+264)
t_2
(if (<= t_1 -2e+15)
(fma (/ (- z) x) x (- y))
(if (<= t_1 1e+128) (+ (- z) (log t)) t_2)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - y;
double t_2 = log(y) * x;
double tmp;
if (t_1 <= -5e+264) {
tmp = t_2;
} else if (t_1 <= -2e+15) {
tmp = fma((-z / x), x, -y);
} else if (t_1 <= 1e+128) {
tmp = -z + log(t);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - y) t_2 = Float64(log(y) * x) tmp = 0.0 if (t_1 <= -5e+264) tmp = t_2; elseif (t_1 <= -2e+15) tmp = fma(Float64(Float64(-z) / x), x, Float64(-y)); elseif (t_1 <= 1e+128) tmp = Float64(Float64(-z) + log(t)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+264], t$95$2, If[LessEqual[t$95$1, -2e+15], N[(N[((-z) / x), $MachinePrecision] * x + (-y)), $MachinePrecision], If[LessEqual[t$95$1, 1e+128], N[((-z) + N[Log[t], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - y\\
t_2 := \log y \cdot x\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+264}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, -y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+128}:\\
\;\;\;\;\left(-z\right) + \log t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (*.f64 x (log.f64 y)) y) < -5.00000000000000033e264 or 1.0000000000000001e128 < (-.f64 (*.f64 x (log.f64 y)) y) Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6463.4
Applied rewrites63.4%
if -5.00000000000000033e264 < (-.f64 (*.f64 x (log.f64 y)) y) < -2e15Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-add-revN/A
div-subN/A
lower-+.f64N/A
lift-log.f64N/A
lower-/.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6475.9
Applied rewrites75.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lift-log.f64N/A
mul-1-negN/A
lift-neg.f6489.2
Applied rewrites89.2%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6465.3
Applied rewrites65.3%
if -2e15 < (-.f64 (*.f64 x (log.f64 y)) y) < 1.0000000000000001e128Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6485.5
Applied rewrites85.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (- (log t) y) z)))
(if (<= z -2.45e+86)
t_1
(if (<= z 3.5e+27) (- (fma (log y) x (log t)) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(t) - y) - z;
double tmp;
if (z <= -2.45e+86) {
tmp = t_1;
} else if (z <= 3.5e+27) {
tmp = fma(log(y), x, log(t)) - y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(log(t) - y) - z) tmp = 0.0 if (z <= -2.45e+86) tmp = t_1; elseif (z <= 3.5e+27) tmp = Float64(fma(log(y), x, log(t)) - y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[z, -2.45e+86], t$95$1, If[LessEqual[z, 3.5e+27], N[(N[(N[Log[y], $MachinePrecision] * x + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\log t - y\right) - z\\
\mathbf{if}\;z \leq -2.45 \cdot 10^{+86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \log t\right) - y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.45e86 or 3.5000000000000002e27 < z Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6481.4
Applied rewrites81.4%
if -2.45e86 < z < 3.5000000000000002e27Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6495.0
Applied rewrites95.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (+ (log y) (/ (- z) x)) x))) (if (<= x -1.05e+135) t_1 (if (<= x 1.1e+26) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) + (-z / x)) * x;
double tmp;
if (x <= -1.05e+135) {
tmp = t_1;
} else if (x <= 1.1e+26) {
tmp = (log(t) - y) - z;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = (log(y) + (-z / x)) * x
if (x <= (-1.05d+135)) then
tmp = t_1
else if (x <= 1.1d+26) then
tmp = (log(t) - y) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.log(y) + (-z / x)) * x;
double tmp;
if (x <= -1.05e+135) {
tmp = t_1;
} else if (x <= 1.1e+26) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) + (-z / x)) * x tmp = 0 if x <= -1.05e+135: tmp = t_1 elif x <= 1.1e+26: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) + Float64(Float64(-z) / x)) * x) tmp = 0.0 if (x <= -1.05e+135) tmp = t_1; elseif (x <= 1.1e+26) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (log(y) + (-z / x)) * x; tmp = 0.0; if (x <= -1.05e+135) tmp = t_1; elseif (x <= 1.1e+26) tmp = (log(t) - y) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] + N[((-z) / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.05e+135], t$95$1, If[LessEqual[x, 1.1e+26], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\log y + \frac{-z}{x}\right) \cdot x\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+26}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.05000000000000005e135 or 1.10000000000000004e26 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-add-revN/A
div-subN/A
lower-+.f64N/A
lift-log.f64N/A
lower-/.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.7
Applied rewrites99.7%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6482.7
Applied rewrites82.7%
if -1.05000000000000005e135 < x < 1.10000000000000004e26Initial program 100.0%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6492.2
Applied rewrites92.2%
(FPCore (x y z t) :precision binary64 (if (<= x -2.1e+135) (- (* (log y) x) y) (if (<= x 4.5e+106) (- (- (log t) y) z) (* (+ (log y) (/ (- y) x)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.1e+135) {
tmp = (log(y) * x) - y;
} else if (x <= 4.5e+106) {
tmp = (log(t) - y) - z;
} else {
tmp = (log(y) + (-y / x)) * x;
}
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)
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) :: tmp
if (x <= (-2.1d+135)) then
tmp = (log(y) * x) - y
else if (x <= 4.5d+106) then
tmp = (log(t) - y) - z
else
tmp = (log(y) + (-y / x)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.1e+135) {
tmp = (Math.log(y) * x) - y;
} else if (x <= 4.5e+106) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = (Math.log(y) + (-y / x)) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.1e+135: tmp = (math.log(y) * x) - y elif x <= 4.5e+106: tmp = (math.log(t) - y) - z else: tmp = (math.log(y) + (-y / x)) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.1e+135) tmp = Float64(Float64(log(y) * x) - y); elseif (x <= 4.5e+106) tmp = Float64(Float64(log(t) - y) - z); else tmp = Float64(Float64(log(y) + Float64(Float64(-y) / x)) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.1e+135) tmp = (log(y) * x) - y; elseif (x <= 4.5e+106) tmp = (log(t) - y) - z; else tmp = (log(y) + (-y / x)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.1e+135], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 4.5e+106], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[((-y) / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+135}:\\
\;\;\;\;\log y \cdot x - y\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+106}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(\log y + \frac{-y}{x}\right) \cdot x\\
\end{array}
\end{array}
if x < -2.1000000000000001e135Initial program 99.7%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6487.8
Applied rewrites87.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6487.8
Applied rewrites87.8%
if -2.1000000000000001e135 < x < 4.4999999999999997e106Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6489.7
Applied rewrites89.7%
if 4.4999999999999997e106 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-add-revN/A
div-subN/A
lower-+.f64N/A
lift-log.f64N/A
lower-/.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6499.7
Applied rewrites99.7%
Taylor expanded in y around inf
mul-1-negN/A
lift-neg.f6484.8
Applied rewrites84.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)) (t_2 (fma (/ (- z) x) x (- y))))
(if (<= x -3.2e+135)
t_1
(if (<= x -2.6e-91)
t_2
(if (<= x 5e-56) (- (log t) y) (if (<= x 4.6e+170) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double t_2 = fma((-z / x), x, -y);
double tmp;
if (x <= -3.2e+135) {
tmp = t_1;
} else if (x <= -2.6e-91) {
tmp = t_2;
} else if (x <= 5e-56) {
tmp = log(t) - y;
} else if (x <= 4.6e+170) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(log(y) * x) t_2 = fma(Float64(Float64(-z) / x), x, Float64(-y)) tmp = 0.0 if (x <= -3.2e+135) tmp = t_1; elseif (x <= -2.6e-91) tmp = t_2; elseif (x <= 5e-56) tmp = Float64(log(t) - y); elseif (x <= 4.6e+170) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-z) / x), $MachinePrecision] * x + (-y)), $MachinePrecision]}, If[LessEqual[x, -3.2e+135], t$95$1, If[LessEqual[x, -2.6e-91], t$95$2, If[LessEqual[x, 5e-56], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 4.6e+170], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := \mathsf{fma}\left(\frac{-z}{x}, x, -y\right)\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-91}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-56}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+170}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.19999999999999975e135 or 4.6000000000000001e170 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6476.0
Applied rewrites76.0%
if -3.19999999999999975e135 < x < -2.60000000000000014e-91 or 4.99999999999999997e-56 < x < 4.6000000000000001e170Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-add-revN/A
div-subN/A
lower-+.f64N/A
lift-log.f64N/A
lower-/.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6496.0
Applied rewrites96.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lift-log.f64N/A
mul-1-negN/A
lift-neg.f6497.7
Applied rewrites97.7%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6462.7
Applied rewrites62.7%
if -2.60000000000000014e-91 < x < 4.99999999999999997e-56Initial program 100.0%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6462.0
Applied rewrites62.0%
Taylor expanded in x around 0
lift-log.f6462.0
Applied rewrites62.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* (log y) x) y))) (if (<= x -2.1e+135) t_1 (if (<= x 4.5e+106) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - y;
double tmp;
if (x <= -2.1e+135) {
tmp = t_1;
} else if (x <= 4.5e+106) {
tmp = (log(t) - y) - z;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = (log(y) * x) - y
if (x <= (-2.1d+135)) then
tmp = t_1
else if (x <= 4.5d+106) then
tmp = (log(t) - y) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.log(y) * x) - y;
double tmp;
if (x <= -2.1e+135) {
tmp = t_1;
} else if (x <= 4.5e+106) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) * x) - y tmp = 0 if x <= -2.1e+135: tmp = t_1 elif x <= 4.5e+106: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - y) tmp = 0.0 if (x <= -2.1e+135) tmp = t_1; elseif (x <= 4.5e+106) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (log(y) * x) - y; tmp = 0.0; if (x <= -2.1e+135) tmp = t_1; elseif (x <= 4.5e+106) tmp = (log(t) - y) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[x, -2.1e+135], t$95$1, If[LessEqual[x, 4.5e+106], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - y\\
\mathbf{if}\;x \leq -2.1 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+106}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.1000000000000001e135 or 4.4999999999999997e106 < x Initial program 99.7%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6486.2
Applied rewrites86.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6486.2
Applied rewrites86.2%
if -2.1000000000000001e135 < x < 4.4999999999999997e106Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6489.7
Applied rewrites89.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (log y) x))) (if (<= x -3.2e+135) t_1 (if (<= x 4.6e+170) (- (- (log t) y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -3.2e+135) {
tmp = t_1;
} else if (x <= 4.6e+170) {
tmp = (log(t) - y) - z;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = log(y) * x
if (x <= (-3.2d+135)) then
tmp = t_1
else if (x <= 4.6d+170) then
tmp = (log(t) - y) - z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double tmp;
if (x <= -3.2e+135) {
tmp = t_1;
} else if (x <= 4.6e+170) {
tmp = (Math.log(t) - y) - z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -3.2e+135: tmp = t_1 elif x <= 4.6e+170: tmp = (math.log(t) - y) - z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -3.2e+135) tmp = t_1; elseif (x <= 4.6e+170) tmp = Float64(Float64(log(t) - y) - z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -3.2e+135) tmp = t_1; elseif (x <= 4.6e+170) tmp = (log(t) - y) - z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -3.2e+135], t$95$1, If[LessEqual[x, 4.6e+170], N[(N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+170}:\\
\;\;\;\;\left(\log t - y\right) - z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.19999999999999975e135 or 4.6000000000000001e170 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lift-log.f6476.0
Applied rewrites76.0%
if -3.19999999999999975e135 < x < 4.6000000000000001e170Initial program 99.9%
Taylor expanded in x around 0
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6486.5
Applied rewrites86.5%
(FPCore (x y z t)
:precision binary64
(if (<= z -6.5e+69)
(- z)
(if (<= z 9.5e+19)
(- (log t) y)
(if (<= z 6.2e+174) (fma (/ (- z) x) x (- y)) (- z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.5e+69) {
tmp = -z;
} else if (z <= 9.5e+19) {
tmp = log(t) - y;
} else if (z <= 6.2e+174) {
tmp = fma((-z / x), x, -y);
} else {
tmp = -z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -6.5e+69) tmp = Float64(-z); elseif (z <= 9.5e+19) tmp = Float64(log(t) - y); elseif (z <= 6.2e+174) tmp = fma(Float64(Float64(-z) / x), x, Float64(-y)); else tmp = Float64(-z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.5e+69], (-z), If[LessEqual[z, 9.5e+19], N[(N[Log[t], $MachinePrecision] - y), $MachinePrecision], If[LessEqual[z, 6.2e+174], N[(N[((-z) / x), $MachinePrecision] * x + (-y)), $MachinePrecision], (-z)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+69}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+19}:\\
\;\;\;\;\log t - y\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, -y\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -6.5000000000000001e69 or 6.2e174 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6470.2
Applied rewrites70.2%
if -6.5000000000000001e69 < z < 9.5e19Initial program 99.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift-log.f6495.9
Applied rewrites95.9%
Taylor expanded in x around 0
lift-log.f6459.5
Applied rewrites59.5%
if 9.5e19 < z < 6.2e174Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-add-revN/A
div-subN/A
lower-+.f64N/A
lift-log.f64N/A
lower-/.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6478.5
Applied rewrites78.5%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lift-log.f64N/A
mul-1-negN/A
lift-neg.f6484.2
Applied rewrites84.2%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6455.4
Applied rewrites55.4%
(FPCore (x y z t) :precision binary64 (if (<= z -4.3e+170) (- z) (if (<= z 6.2e+174) (fma (/ (- z) x) x (- y)) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.3e+170) {
tmp = -z;
} else if (z <= 6.2e+174) {
tmp = fma((-z / x), x, -y);
} else {
tmp = -z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -4.3e+170) tmp = Float64(-z); elseif (z <= 6.2e+174) tmp = fma(Float64(Float64(-z) / x), x, Float64(-y)); else tmp = Float64(-z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.3e+170], (-z), If[LessEqual[z, 6.2e+174], N[(N[((-z) / x), $MachinePrecision] * x + (-y)), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+170}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, -y\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -4.2999999999999999e170 or 6.2e174 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6478.5
Applied rewrites78.5%
if -4.2999999999999999e170 < z < 6.2e174Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
div-add-revN/A
div-subN/A
lower-+.f64N/A
lift-log.f64N/A
lower-/.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
lift-log.f6484.4
Applied rewrites84.4%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate--l+N/A
lower-+.f64N/A
lift-log.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lift-log.f64N/A
mul-1-negN/A
lift-neg.f6494.6
Applied rewrites94.6%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6444.9
Applied rewrites44.9%
(FPCore (x y z t) :precision binary64 (if (<= z -6.5e+69) (- z) (if (<= z 1.4e+35) (- y) (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.5e+69) {
tmp = -z;
} else if (z <= 1.4e+35) {
tmp = -y;
} else {
tmp = -z;
}
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)
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) :: tmp
if (z <= (-6.5d+69)) then
tmp = -z
else if (z <= 1.4d+35) then
tmp = -y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.5e+69) {
tmp = -z;
} else if (z <= 1.4e+35) {
tmp = -y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.5e+69: tmp = -z elif z <= 1.4e+35: tmp = -y else: tmp = -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.5e+69) tmp = Float64(-z); elseif (z <= 1.4e+35) tmp = Float64(-y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.5e+69) tmp = -z; elseif (z <= 1.4e+35) tmp = -y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.5e+69], (-z), If[LessEqual[z, 1.4e+35], (-y), (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+69}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+35}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -6.5000000000000001e69 or 1.39999999999999999e35 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6464.5
Applied rewrites64.5%
if -6.5000000000000001e69 < z < 1.39999999999999999e35Initial program 99.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6438.6
Applied rewrites38.6%
(FPCore (x y z t) :precision binary64 (- y))
double code(double x, double y, double z, double t) {
return -y;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -y
end function
public static double code(double x, double y, double z, double t) {
return -y;
}
def code(x, y, z, t): return -y
function code(x, y, z, t) return Float64(-y) end
function tmp = code(x, y, z, t) tmp = -y; end
code[x_, y_, z_, t_] := (-y)
\begin{array}{l}
\\
-y
\end{array}
Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6430.0
Applied rewrites30.0%
herbie shell --seed 2025088
(FPCore (x y z t)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (- (* x (log y)) y) z) (log t)))