
(FPCore (x y z t a b) :precision binary64 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
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, b)
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), intent (in) :: b
code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
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, b)
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), intent (in) :: b
code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
(FPCore (x y z t a b) :precision binary64 (+ x (+ y (fma b (- a 0.5) (* z (- 1.0 (log t)))))))
double code(double x, double y, double z, double t, double a, double b) {
return x + (y + fma(b, (a - 0.5), (z * (1.0 - log(t)))));
}
function code(x, y, z, t, a, b) return Float64(x + Float64(y + fma(b, Float64(a - 0.5), Float64(z * Float64(1.0 - log(t)))))) end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(y + N[(b * N[(a - 0.5), $MachinePrecision] + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(y + \mathsf{fma}\left(b, a - 0.5, z \cdot \left(1 - \log t\right)\right)\right)
Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.8%
Applied rewrites99.8%
(FPCore (x y z t a b) :precision binary64 (fma (- a 0.5) b (- z (- (- (* (log t) z) y) x))))
double code(double x, double y, double z, double t, double a, double b) {
return fma((a - 0.5), b, (z - (((log(t) * z) - y) - x)));
}
function code(x, y, z, t, a, b) return fma(Float64(a - 0.5), b, Float64(z - Float64(Float64(Float64(log(t) * z) - y) - x))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a - 0.5), $MachinePrecision] * b + N[(z - N[(N[(N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision] - y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(a - 0.5, b, z - \left(\left(\log t \cdot z - y\right) - x\right)\right)
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.8%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f6499.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (fmin x y) (fmax x y)) -2e-185) (+ (fmin x y) (fma b (- a 0.5) (* z (- 1.0 (log t))))) (+ (- (+ (fmax x y) z) (* z (log t))) (* (- a 0.5) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((fmin(x, y) + fmax(x, y)) <= -2e-185) {
tmp = fmin(x, y) + fma(b, (a - 0.5), (z * (1.0 - log(t))));
} else {
tmp = ((fmax(x, y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(fmin(x, y) + fmax(x, y)) <= -2e-185) tmp = Float64(fmin(x, y) + fma(b, Float64(a - 0.5), Float64(z * Float64(1.0 - log(t))))); else tmp = Float64(Float64(Float64(fmax(x, y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision], -2e-185], N[(N[Min[x, y], $MachinePrecision] + N[(b * N[(a - 0.5), $MachinePrecision] + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Max[x, y], $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right) \leq -2 \cdot 10^{-185}:\\
\;\;\;\;\mathsf{min}\left(x, y\right) + \mathsf{fma}\left(b, a - 0.5, z \cdot \left(1 - \log t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{max}\left(x, y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\\
\end{array}
if (+.f64 x y) < -2e-185Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6479.4%
Applied rewrites79.4%
if -2e-185 < (+.f64 x y) Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites78.3%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (fmin x y) (fmax x y)) -2e-185) (+ (fmin x y) (fma b (- a 0.5) (* z (- 1.0 (log t))))) (- (fma (- a 0.5) b (+ (fmax x y) z)) (* (log t) z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((fmin(x, y) + fmax(x, y)) <= -2e-185) {
tmp = fmin(x, y) + fma(b, (a - 0.5), (z * (1.0 - log(t))));
} else {
tmp = fma((a - 0.5), b, (fmax(x, y) + z)) - (log(t) * z);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(fmin(x, y) + fmax(x, y)) <= -2e-185) tmp = Float64(fmin(x, y) + fma(b, Float64(a - 0.5), Float64(z * Float64(1.0 - log(t))))); else tmp = Float64(fma(Float64(a - 0.5), b, Float64(fmax(x, y) + z)) - Float64(log(t) * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision], -2e-185], N[(N[Min[x, y], $MachinePrecision] + N[(b * N[(a - 0.5), $MachinePrecision] + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a - 0.5), $MachinePrecision] * b + N[(N[Max[x, y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right) \leq -2 \cdot 10^{-185}:\\
\;\;\;\;\mathsf{min}\left(x, y\right) + \mathsf{fma}\left(b, a - 0.5, z \cdot \left(1 - \log t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, \mathsf{max}\left(x, y\right) + z\right) - \log t \cdot z\\
\end{array}
if (+.f64 x y) < -2e-185Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6479.4%
Applied rewrites79.4%
if -2e-185 < (+.f64 x y) Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites78.3%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
lift-*.f64N/A
lower-fma.f6478.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6478.3%
Applied rewrites78.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (log t)))
(t_2 (* (- a 0.5) b))
(t_3 (+ (- (+ (+ (fmin x y) (fmax x y)) z) t_1) t_2)))
(if (<= t_3 -2e-21)
(+ (fmin x y) (fma b (- a 0.5) (* z (- 1.0 (log t)))))
(if (<= t_3 5e+112)
(fma (- a 0.5) b (+ (fmax x y) (fmin x y)))
(if (<= t_3 2e+298)
(- (fma -0.5 b (+ (fmax x y) z)) (* (log t) z))
(+ (- z t_1) t_2))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * log(t);
double t_2 = (a - 0.5) * b;
double t_3 = (((fmin(x, y) + fmax(x, y)) + z) - t_1) + t_2;
double tmp;
if (t_3 <= -2e-21) {
tmp = fmin(x, y) + fma(b, (a - 0.5), (z * (1.0 - log(t))));
} else if (t_3 <= 5e+112) {
tmp = fma((a - 0.5), b, (fmax(x, y) + fmin(x, y)));
} else if (t_3 <= 2e+298) {
tmp = fma(-0.5, b, (fmax(x, y) + z)) - (log(t) * z);
} else {
tmp = (z - t_1) + t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z * log(t)) t_2 = Float64(Float64(a - 0.5) * b) t_3 = Float64(Float64(Float64(Float64(fmin(x, y) + fmax(x, y)) + z) - t_1) + t_2) tmp = 0.0 if (t_3 <= -2e-21) tmp = Float64(fmin(x, y) + fma(b, Float64(a - 0.5), Float64(z * Float64(1.0 - log(t))))); elseif (t_3 <= 5e+112) tmp = fma(Float64(a - 0.5), b, Float64(fmax(x, y) + fmin(x, y))); elseif (t_3 <= 2e+298) tmp = Float64(fma(-0.5, b, Float64(fmax(x, y) + z)) - Float64(log(t) * z)); else tmp = Float64(Float64(z - t_1) + t_2); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] - t$95$1), $MachinePrecision] + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-21], N[(N[Min[x, y], $MachinePrecision] + N[(b * N[(a - 0.5), $MachinePrecision] + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5e+112], N[(N[(a - 0.5), $MachinePrecision] * b + N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+298], N[(N[(-0.5 * b + N[(N[Max[x, y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(z - t$95$1), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := z \cdot \log t\\
t_2 := \left(a - 0.5\right) \cdot b\\
t_3 := \left(\left(\left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + z\right) - t\_1\right) + t\_2\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{min}\left(x, y\right) + \mathsf{fma}\left(b, a - 0.5, z \cdot \left(1 - \log t\right)\right)\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+112}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\right)\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, \mathsf{max}\left(x, y\right) + z\right) - \log t \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(z - t\_1\right) + t\_2\\
\end{array}
if (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < -1.99999999999999982e-21Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6479.4%
Applied rewrites79.4%
if -1.99999999999999982e-21 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < 5e112Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6478.6%
Applied rewrites78.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6478.6%
Applied rewrites78.6%
if 5e112 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < 1.9999999999999999e298Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites78.3%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
lift-*.f64N/A
lower-fma.f6478.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6478.3%
Applied rewrites78.3%
Taylor expanded in a around 0
Applied rewrites54.0%
if 1.9999999999999999e298 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites78.3%
Taylor expanded in y around 0
lower-+.f6479.4%
Applied rewrites79.4%
Taylor expanded in x around 0
Applied rewrites58.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -4.4e+111)
(+ x (+ y (* z (- 1.0 (log t)))))
(if (<= z 5.2e+102)
(- x (- (- (* (- 0.5 a) b) z) y))
(+ (- z (* z (log t))) (* (- a 0.5) b)))))double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.4e+111) {
tmp = x + (y + (z * (1.0 - log(t))));
} else if (z <= 5.2e+102) {
tmp = x - ((((0.5 - a) * b) - z) - y);
} else {
tmp = (z - (z * log(t))) + ((a - 0.5) * b);
}
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, b)
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), intent (in) :: b
real(8) :: tmp
if (z <= (-4.4d+111)) then
tmp = x + (y + (z * (1.0d0 - log(t))))
else if (z <= 5.2d+102) then
tmp = x - ((((0.5d0 - a) * b) - z) - y)
else
tmp = (z - (z * log(t))) + ((a - 0.5d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.4e+111) {
tmp = x + (y + (z * (1.0 - Math.log(t))));
} else if (z <= 5.2e+102) {
tmp = x - ((((0.5 - a) * b) - z) - y);
} else {
tmp = (z - (z * Math.log(t))) + ((a - 0.5) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -4.4e+111: tmp = x + (y + (z * (1.0 - math.log(t)))) elif z <= 5.2e+102: tmp = x - ((((0.5 - a) * b) - z) - y) else: tmp = (z - (z * math.log(t))) + ((a - 0.5) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.4e+111) tmp = Float64(x + Float64(y + Float64(z * Float64(1.0 - log(t))))); elseif (z <= 5.2e+102) tmp = Float64(x - Float64(Float64(Float64(Float64(0.5 - a) * b) - z) - y)); else tmp = Float64(Float64(z - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -4.4e+111) tmp = x + (y + (z * (1.0 - log(t)))); elseif (z <= 5.2e+102) tmp = x - ((((0.5 - a) * b) - z) - y); else tmp = (z - (z * log(t))) + ((a - 0.5) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.4e+111], N[(x + N[(y + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e+102], N[(x - N[(N[(N[(N[(0.5 - a), $MachinePrecision] * b), $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(z - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+111}:\\
\;\;\;\;x + \left(y + z \cdot \left(1 - \log t\right)\right)\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+102}:\\
\;\;\;\;x - \left(\left(\left(0.5 - a\right) \cdot b - z\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\\
\end{array}
if z < -4.39999999999999997e111Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.8%
Applied rewrites99.8%
Taylor expanded in b around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6463.1%
Applied rewrites63.1%
if -4.39999999999999997e111 < z < 5.20000000000000013e102Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6465.1%
Applied rewrites65.1%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
sum-to-mult-revN/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
Applied rewrites79.4%
if 5.20000000000000013e102 < z Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites78.3%
Taylor expanded in y around 0
lower-+.f6479.4%
Applied rewrites79.4%
Taylor expanded in x around 0
Applied rewrites58.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)) (t_2 (- x (- (- (* (- 0.5 a) b) z) y))))
(if (<= t_1 -2e+89)
t_2
(if (<= t_1 5e+58) (+ x (+ y (* z (- 1.0 (log t))))) t_2))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double t_2 = x - ((((0.5 - a) * b) - z) - y);
double tmp;
if (t_1 <= -2e+89) {
tmp = t_2;
} else if (t_1 <= 5e+58) {
tmp = x + (y + (z * (1.0 - log(t))));
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (a - 0.5d0) * b
t_2 = x - ((((0.5d0 - a) * b) - z) - y)
if (t_1 <= (-2d+89)) then
tmp = t_2
else if (t_1 <= 5d+58) then
tmp = x + (y + (z * (1.0d0 - log(t))))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double t_2 = x - ((((0.5 - a) * b) - z) - y);
double tmp;
if (t_1 <= -2e+89) {
tmp = t_2;
} else if (t_1 <= 5e+58) {
tmp = x + (y + (z * (1.0 - Math.log(t))));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - 0.5) * b t_2 = x - ((((0.5 - a) * b) - z) - y) tmp = 0 if t_1 <= -2e+89: tmp = t_2 elif t_1 <= 5e+58: tmp = x + (y + (z * (1.0 - math.log(t)))) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) t_2 = Float64(x - Float64(Float64(Float64(Float64(0.5 - a) * b) - z) - y)) tmp = 0.0 if (t_1 <= -2e+89) tmp = t_2; elseif (t_1 <= 5e+58) tmp = Float64(x + Float64(y + Float64(z * Float64(1.0 - log(t))))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - 0.5) * b; t_2 = x - ((((0.5 - a) * b) - z) - y); tmp = 0.0; if (t_1 <= -2e+89) tmp = t_2; elseif (t_1 <= 5e+58) tmp = x + (y + (z * (1.0 - log(t)))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(N[(N[(N[(0.5 - a), $MachinePrecision] * b), $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+89], t$95$2, If[LessEqual[t$95$1, 5e+58], N[(x + N[(y + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
t_2 := x - \left(\left(\left(0.5 - a\right) \cdot b - z\right) - y\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+89}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+58}:\\
\;\;\;\;x + \left(y + z \cdot \left(1 - \log t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.99999999999999999e89 or 4.99999999999999986e58 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6465.1%
Applied rewrites65.1%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
sum-to-mult-revN/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
Applied rewrites79.4%
if -1.99999999999999999e89 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.99999999999999986e58Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.8%
Applied rewrites99.8%
Taylor expanded in b around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6463.1%
Applied rewrites63.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -9.5e+164)
(- z (* (log t) z))
(if (<= z 4.2e+157)
(- x (- (- (* (- 0.5 a) b) z) y))
(* z (- 1.0 (log t))))))double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -9.5e+164) {
tmp = z - (log(t) * z);
} else if (z <= 4.2e+157) {
tmp = x - ((((0.5 - a) * b) - z) - y);
} else {
tmp = z * (1.0 - 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, b)
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), intent (in) :: b
real(8) :: tmp
if (z <= (-9.5d+164)) then
tmp = z - (log(t) * z)
else if (z <= 4.2d+157) then
tmp = x - ((((0.5d0 - a) * b) - z) - y)
else
tmp = z * (1.0d0 - log(t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -9.5e+164) {
tmp = z - (Math.log(t) * z);
} else if (z <= 4.2e+157) {
tmp = x - ((((0.5 - a) * b) - z) - y);
} else {
tmp = z * (1.0 - Math.log(t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -9.5e+164: tmp = z - (math.log(t) * z) elif z <= 4.2e+157: tmp = x - ((((0.5 - a) * b) - z) - y) else: tmp = z * (1.0 - math.log(t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -9.5e+164) tmp = Float64(z - Float64(log(t) * z)); elseif (z <= 4.2e+157) tmp = Float64(x - Float64(Float64(Float64(Float64(0.5 - a) * b) - z) - y)); else tmp = Float64(z * Float64(1.0 - log(t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -9.5e+164) tmp = z - (log(t) * z); elseif (z <= 4.2e+157) tmp = x - ((((0.5 - a) * b) - z) - y); else tmp = z * (1.0 - log(t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -9.5e+164], N[(z - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+157], N[(x - N[(N[(N[(N[(0.5 - a), $MachinePrecision] * b), $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+164}:\\
\;\;\;\;z - \log t \cdot z\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+157}:\\
\;\;\;\;x - \left(\left(\left(0.5 - a\right) \cdot b - z\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(1 - \log t\right)\\
\end{array}
if z < -9.49999999999999976e164Initial program 99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-log.f6422.5%
Applied rewrites22.5%
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-lft-inN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lower-neg.f6422.5%
Applied rewrites22.5%
lift-fma.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
fp-cancel-sub-signN/A
*-rgt-identityN/A
lift-*.f64N/A
lower--.f6422.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.5%
Applied rewrites22.5%
if -9.49999999999999976e164 < z < 4.2e157Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6465.1%
Applied rewrites65.1%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
sum-to-mult-revN/A
add-flipN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
Applied rewrites79.4%
if 4.2e157 < z Initial program 99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-log.f6422.5%
Applied rewrites22.5%
(FPCore (x y z t a b) :precision binary64 (if (<= z -9.5e+164) (- z (* (log t) z)) (if (<= z 4.2e+157) (fma (- a 0.5) b (+ y x)) (* z (- 1.0 (log t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -9.5e+164) {
tmp = z - (log(t) * z);
} else if (z <= 4.2e+157) {
tmp = fma((a - 0.5), b, (y + x));
} else {
tmp = z * (1.0 - log(t));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -9.5e+164) tmp = Float64(z - Float64(log(t) * z)); elseif (z <= 4.2e+157) tmp = fma(Float64(a - 0.5), b, Float64(y + x)); else tmp = Float64(z * Float64(1.0 - log(t))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -9.5e+164], N[(z - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+157], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+164}:\\
\;\;\;\;z - \log t \cdot z\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+157}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(1 - \log t\right)\\
\end{array}
if z < -9.49999999999999976e164Initial program 99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-log.f6422.5%
Applied rewrites22.5%
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-lft-inN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lower-neg.f6422.5%
Applied rewrites22.5%
lift-fma.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
fp-cancel-sub-signN/A
*-rgt-identityN/A
lift-*.f64N/A
lower--.f6422.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.5%
Applied rewrites22.5%
if -9.49999999999999976e164 < z < 4.2e157Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6478.6%
Applied rewrites78.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6478.6%
Applied rewrites78.6%
if 4.2e157 < z Initial program 99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-log.f6422.5%
Applied rewrites22.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (- 1.0 (log t)))))
(if (<= z -9.5e+164)
t_1
(if (<= z 4.2e+157) (fma (- a 0.5) b (+ y x)) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (1.0 - log(t));
double tmp;
if (z <= -9.5e+164) {
tmp = t_1;
} else if (z <= 4.2e+157) {
tmp = fma((a - 0.5), b, (y + x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(1.0 - log(t))) tmp = 0.0 if (z <= -9.5e+164) tmp = t_1; elseif (z <= 4.2e+157) tmp = fma(Float64(a - 0.5), b, Float64(y + x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+164], t$95$1, If[LessEqual[z, 4.2e+157], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := z \cdot \left(1 - \log t\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+157}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -9.49999999999999976e164 or 4.2e157 < z Initial program 99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-log.f6422.5%
Applied rewrites22.5%
if -9.49999999999999976e164 < z < 4.2e157Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6478.6%
Applied rewrites78.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6478.6%
Applied rewrites78.6%
(FPCore (x y z t a b) :precision binary64 (fma (- a 0.5) b (+ y x)))
double code(double x, double y, double z, double t, double a, double b) {
return fma((a - 0.5), b, (y + x));
}
function code(x, y, z, t, a, b) return fma(Float64(a - 0.5), b, Float64(y + x)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(a - 0.5, b, y + x\right)
Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6478.6%
Applied rewrites78.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6478.6%
Applied rewrites78.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))))
(if (<= (- (+ (+ (fmin x y) (fmax x y)) z) (* z (log t))) -2e-185)
(+ (fmin x y) t_1)
(+ (fmax x y) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double tmp;
if ((((fmin(x, y) + fmax(x, y)) + z) - (z * log(t))) <= -2e-185) {
tmp = fmin(x, y) + t_1;
} else {
tmp = fmax(x, y) + 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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = b * (a - 0.5d0)
if ((((fmin(x, y) + fmax(x, y)) + z) - (z * log(t))) <= (-2d-185)) then
tmp = fmin(x, y) + t_1
else
tmp = fmax(x, y) + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double tmp;
if ((((fmin(x, y) + fmax(x, y)) + z) - (z * Math.log(t))) <= -2e-185) {
tmp = fmin(x, y) + t_1;
} else {
tmp = fmax(x, y) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = b * (a - 0.5) tmp = 0 if (((fmin(x, y) + fmax(x, y)) + z) - (z * math.log(t))) <= -2e-185: tmp = fmin(x, y) + t_1 else: tmp = fmax(x, y) + t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) tmp = 0.0 if (Float64(Float64(Float64(fmin(x, y) + fmax(x, y)) + z) - Float64(z * log(t))) <= -2e-185) tmp = Float64(fmin(x, y) + t_1); else tmp = Float64(fmax(x, y) + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = b * (a - 0.5); tmp = 0.0; if ((((min(x, y) + max(x, y)) + z) - (z * log(t))) <= -2e-185) tmp = min(x, y) + t_1; else tmp = max(x, y) + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-185], N[(N[Min[x, y], $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[Max[x, y], $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;\left(\left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + z\right) - z \cdot \log t \leq -2 \cdot 10^{-185}:\\
\;\;\;\;\mathsf{min}\left(x, y\right) + t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(x, y\right) + t\_1\\
\end{array}
if (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) < -2e-185Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6478.6%
Applied rewrites78.6%
Taylor expanded in y around 0
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
if -2e-185 < (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6478.6%
Applied rewrites78.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6457.5%
Applied rewrites57.5%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (fmin x y) (fmax x y)) -4e+50) (* 1.0 (fmin x y)) (+ (fmax x y) (* b (- a 0.5)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((fmin(x, y) + fmax(x, y)) <= -4e+50) {
tmp = 1.0 * fmin(x, y);
} else {
tmp = fmax(x, y) + (b * (a - 0.5));
}
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, b)
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), intent (in) :: b
real(8) :: tmp
if ((fmin(x, y) + fmax(x, y)) <= (-4d+50)) then
tmp = 1.0d0 * fmin(x, y)
else
tmp = fmax(x, y) + (b * (a - 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((fmin(x, y) + fmax(x, y)) <= -4e+50) {
tmp = 1.0 * fmin(x, y);
} else {
tmp = fmax(x, y) + (b * (a - 0.5));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (fmin(x, y) + fmax(x, y)) <= -4e+50: tmp = 1.0 * fmin(x, y) else: tmp = fmax(x, y) + (b * (a - 0.5)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(fmin(x, y) + fmax(x, y)) <= -4e+50) tmp = Float64(1.0 * fmin(x, y)); else tmp = Float64(fmax(x, y) + Float64(b * Float64(a - 0.5))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((min(x, y) + max(x, y)) <= -4e+50) tmp = 1.0 * min(x, y); else tmp = max(x, y) + (b * (a - 0.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision], -4e+50], N[(1.0 * N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(N[Max[x, y], $MachinePrecision] + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right) \leq -4 \cdot 10^{+50}:\\
\;\;\;\;1 \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(x, y\right) + b \cdot \left(a - 0.5\right)\\
\end{array}
if (+.f64 x y) < -4.0000000000000003e50Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in x around inf
Applied rewrites22.6%
if -4.0000000000000003e50 < (+.f64 x y) Initial program 99.8%
Taylor expanded in z around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6478.6%
Applied rewrites78.6%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6457.5%
Applied rewrites57.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (fmin x y) (fmax x y))))
(if (<= t_1 -4e+50)
(* 1.0 (fmin x y))
(if (<= t_1 2e+180)
(* (- a 0.5) b)
(* (/ (fmax x y) (fmin x y)) (fmin x y))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmin(x, y) + fmax(x, y);
double tmp;
if (t_1 <= -4e+50) {
tmp = 1.0 * fmin(x, y);
} else if (t_1 <= 2e+180) {
tmp = (a - 0.5) * b;
} else {
tmp = (fmax(x, y) / fmin(x, y)) * fmin(x, y);
}
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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = fmin(x, y) + fmax(x, y)
if (t_1 <= (-4d+50)) then
tmp = 1.0d0 * fmin(x, y)
else if (t_1 <= 2d+180) then
tmp = (a - 0.5d0) * b
else
tmp = (fmax(x, y) / fmin(x, y)) * fmin(x, y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fmin(x, y) + fmax(x, y);
double tmp;
if (t_1 <= -4e+50) {
tmp = 1.0 * fmin(x, y);
} else if (t_1 <= 2e+180) {
tmp = (a - 0.5) * b;
} else {
tmp = (fmax(x, y) / fmin(x, y)) * fmin(x, y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = fmin(x, y) + fmax(x, y) tmp = 0 if t_1 <= -4e+50: tmp = 1.0 * fmin(x, y) elif t_1 <= 2e+180: tmp = (a - 0.5) * b else: tmp = (fmax(x, y) / fmin(x, y)) * fmin(x, y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (t_1 <= -4e+50) tmp = Float64(1.0 * fmin(x, y)); elseif (t_1 <= 2e+180) tmp = Float64(Float64(a - 0.5) * b); else tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) * fmin(x, y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = min(x, y) + max(x, y); tmp = 0.0; if (t_1 <= -4e+50) tmp = 1.0 * min(x, y); elseif (t_1 <= 2e+180) tmp = (a - 0.5) * b; else tmp = (max(x, y) / min(x, y)) * min(x, y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+50], N[(1.0 * N[Min[x, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+180], N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision], N[(N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+50}:\\
\;\;\;\;1 \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+180}:\\
\;\;\;\;\left(a - 0.5\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)} \cdot \mathsf{min}\left(x, y\right)\\
\end{array}
if (+.f64 x y) < -4.0000000000000003e50Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in x around inf
Applied rewrites22.6%
if -4.0000000000000003e50 < (+.f64 x y) < 2e180Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f6438.0%
Applied rewrites38.0%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6438.0%
Applied rewrites38.0%
if 2e180 < (+.f64 x y) Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in y around inf
lower-/.f6416.2%
Applied rewrites16.2%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (fmin x y) (fmax x y)) -4e+50) (* 1.0 (fmin x y)) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((fmin(x, y) + fmax(x, y)) <= -4e+50) {
tmp = 1.0 * fmin(x, y);
} else {
tmp = (a - 0.5) * b;
}
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, b)
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), intent (in) :: b
real(8) :: tmp
if ((fmin(x, y) + fmax(x, y)) <= (-4d+50)) then
tmp = 1.0d0 * fmin(x, y)
else
tmp = (a - 0.5d0) * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((fmin(x, y) + fmax(x, y)) <= -4e+50) {
tmp = 1.0 * fmin(x, y);
} else {
tmp = (a - 0.5) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (fmin(x, y) + fmax(x, y)) <= -4e+50: tmp = 1.0 * fmin(x, y) else: tmp = (a - 0.5) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(fmin(x, y) + fmax(x, y)) <= -4e+50) tmp = Float64(1.0 * fmin(x, y)); else tmp = Float64(Float64(a - 0.5) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((min(x, y) + max(x, y)) <= -4e+50) tmp = 1.0 * min(x, y); else tmp = (a - 0.5) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision], -4e+50], N[(1.0 * N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right) \leq -4 \cdot 10^{+50}:\\
\;\;\;\;1 \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a - 0.5\right) \cdot b\\
\end{array}
if (+.f64 x y) < -4.0000000000000003e50Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in x around inf
Applied rewrites22.6%
if -4.0000000000000003e50 < (+.f64 x y) Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in b around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f6438.0%
Applied rewrites38.0%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6438.0%
Applied rewrites38.0%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (fmin x y) (fmax x y)) -4e+50) (* 1.0 (fmin x y)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((fmin(x, y) + fmax(x, y)) <= -4e+50) {
tmp = 1.0 * fmin(x, y);
} else {
tmp = a * b;
}
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, b)
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), intent (in) :: b
real(8) :: tmp
if ((fmin(x, y) + fmax(x, y)) <= (-4d+50)) then
tmp = 1.0d0 * fmin(x, y)
else
tmp = a * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((fmin(x, y) + fmax(x, y)) <= -4e+50) {
tmp = 1.0 * fmin(x, y);
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (fmin(x, y) + fmax(x, y)) <= -4e+50: tmp = 1.0 * fmin(x, y) else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(fmin(x, y) + fmax(x, y)) <= -4e+50) tmp = Float64(1.0 * fmin(x, y)); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((min(x, y) + max(x, y)) <= -4e+50) tmp = 1.0 * min(x, y); else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision], -4e+50], N[(1.0 * N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right) \leq -4 \cdot 10^{+50}:\\
\;\;\;\;1 \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
if (+.f64 x y) < -4.0000000000000003e50Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
sum-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites78.5%
Taylor expanded in x around inf
Applied rewrites22.6%
if -4.0000000000000003e50 < (+.f64 x y) Initial program 99.8%
Taylor expanded in a around inf
lower-*.f6426.1%
Applied rewrites26.1%
(FPCore (x y z t a b) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
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, b)
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), intent (in) :: b
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
def code(x, y, z, t, a, b): return a * b
function code(x, y, z, t, a, b) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_] := N[(a * b), $MachinePrecision]
a \cdot b
Initial program 99.8%
Taylor expanded in a around inf
lower-*.f6426.1%
Applied rewrites26.1%
herbie shell --seed 2025181
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))