
(FPCore (x y z) :precision binary64 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * exp(z)) - (x * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z): return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z) return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) end
function tmp = code(x, y, z) tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * exp(z)) - (x * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z): return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z) return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) end
function tmp = code(x, y, z) tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
(FPCore (x y z) :precision binary64 (if (<= z -145.0) (+ x (/ -1.0 x)) (+ x (/ y (* y (- (* 1.1283791670955126 (/ (exp z) y)) x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -145.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x + (y / (y * ((1.1283791670955126 * (exp(z) / y)) - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-145.0d0)) then
tmp = x + ((-1.0d0) / x)
else
tmp = x + (y / (y * ((1.1283791670955126d0 * (exp(z) / y)) - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -145.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x + (y / (y * ((1.1283791670955126 * (Math.exp(z) / y)) - x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -145.0: tmp = x + (-1.0 / x) else: tmp = x + (y / (y * ((1.1283791670955126 * (math.exp(z) / y)) - x))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -145.0) tmp = Float64(x + Float64(-1.0 / x)); else tmp = Float64(x + Float64(y / Float64(y * Float64(Float64(1.1283791670955126 * Float64(exp(z) / y)) - x)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -145.0) tmp = x + (-1.0 / x); else tmp = x + (y / (y * ((1.1283791670955126 * (exp(z) / y)) - x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -145.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(y * N[(N[(1.1283791670955126 * N[(N[Exp[z], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq -145:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{y \cdot \left(1.1283791670955126 \cdot \frac{e^{z}}{y} - x\right)}\\
\end{array}
if z < -145Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
if -145 < z Initial program 95.3%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-exp.f6497.0%
Applied rewrites97.0%
(FPCore (x y z)
:precision binary64
(if (<= z -0.038)
(+ x (/ -1.0 x))
(if (<= z 1.65)
(+
x
(/
y
(-
(+
1.1283791670955126
(*
z
(+
1.1283791670955126
(* z (+ 0.5641895835477563 (* 0.18806319451591877 z))))))
(* x y))))
(+ (* (* 0.8862269254527579 y) (exp (- z))) x))))double code(double x, double y, double z) {
double tmp;
if (z <= -0.038) {
tmp = x + (-1.0 / x);
} else if (z <= 1.65) {
tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
} else {
tmp = ((0.8862269254527579 * y) * exp(-z)) + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-0.038d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 1.65d0) then
tmp = x + (y / ((1.1283791670955126d0 + (z * (1.1283791670955126d0 + (z * (0.5641895835477563d0 + (0.18806319451591877d0 * z)))))) - (x * y)))
else
tmp = ((0.8862269254527579d0 * y) * exp(-z)) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.038) {
tmp = x + (-1.0 / x);
} else if (z <= 1.65) {
tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
} else {
tmp = ((0.8862269254527579 * y) * Math.exp(-z)) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.038: tmp = x + (-1.0 / x) elif z <= 1.65: tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y))) else: tmp = ((0.8862269254527579 * y) * math.exp(-z)) + x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.038) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 1.65) tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(z * Float64(1.1283791670955126 + Float64(z * Float64(0.5641895835477563 + Float64(0.18806319451591877 * z)))))) - Float64(x * y)))); else tmp = Float64(Float64(Float64(0.8862269254527579 * y) * exp(Float64(-z))) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.038) tmp = x + (-1.0 / x); elseif (z <= 1.65) tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y))); else tmp = ((0.8862269254527579 * y) * exp(-z)) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.038], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(z * N[(1.1283791670955126 + N[(z * N[(0.5641895835477563 + N[(0.18806319451591877 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.8862269254527579 * y), $MachinePrecision] * N[Exp[(-z)], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -0.038:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 1.65:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 + 0.18806319451591877 \cdot z\right)\right)\right) - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\left(0.8862269254527579 \cdot y\right) \cdot e^{-z} + x\\
\end{array}
if z < -0.037999999999999999Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
if -0.037999999999999999 < z < 1.6499999999999999Initial program 95.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6483.9%
Applied rewrites83.9%
if 1.6499999999999999 < z Initial program 95.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-exp.f6463.4%
Applied rewrites63.4%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6463.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lift-exp.f64N/A
rec-expN/A
lower-*.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f6463.4%
Applied rewrites63.4%
(FPCore (x y z)
:precision binary64
(if (<= z -0.038)
(+ x (/ -1.0 x))
(if (<= z 24.5)
(+
x
(/
y
(-
(+
1.1283791670955126
(*
z
(+
1.1283791670955126
(* z (+ 0.5641895835477563 (* 0.18806319451591877 z))))))
(* x y))))
(* 1.0 x))))double code(double x, double y, double z) {
double tmp;
if (z <= -0.038) {
tmp = x + (-1.0 / x);
} else if (z <= 24.5) {
tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
} else {
tmp = 1.0 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-0.038d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 24.5d0) then
tmp = x + (y / ((1.1283791670955126d0 + (z * (1.1283791670955126d0 + (z * (0.5641895835477563d0 + (0.18806319451591877d0 * z)))))) - (x * y)))
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.038) {
tmp = x + (-1.0 / x);
} else if (z <= 24.5) {
tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.038: tmp = x + (-1.0 / x) elif z <= 24.5: tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y))) else: tmp = 1.0 * x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.038) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 24.5) tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(z * Float64(1.1283791670955126 + Float64(z * Float64(0.5641895835477563 + Float64(0.18806319451591877 * z)))))) - Float64(x * y)))); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.038) tmp = x + (-1.0 / x); elseif (z <= 24.5) tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y))); else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.038], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 24.5], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(z * N[(1.1283791670955126 + N[(z * N[(0.5641895835477563 + N[(0.18806319451591877 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -0.038:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 24.5:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 + 0.18806319451591877 \cdot z\right)\right)\right) - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -0.037999999999999999Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
if -0.037999999999999999 < z < 24.5Initial program 95.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6483.9%
Applied rewrites83.9%
if 24.5 < z Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
lift-+.f64N/A
sum-to-multN/A
lower-unsound-*.f64N/A
metadata-evalN/A
lower-unsound-+.f64N/A
metadata-evalN/A
lower-unsound-/.f6461.7%
Applied rewrites61.7%
Taylor expanded in x around inf
Applied rewrites68.8%
(FPCore (x y z)
:precision binary64
(if (<= z -220.0)
(+ x (/ -1.0 x))
(if (<= z 640.0)
(+
x
(/
y
(-
(+
1.1283791670955126
(* z (+ 1.1283791670955126 (* 0.5641895835477563 z))))
(* x y))))
(* 1.0 x))))double code(double x, double y, double z) {
double tmp;
if (z <= -220.0) {
tmp = x + (-1.0 / x);
} else if (z <= 640.0) {
tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (0.5641895835477563 * z)))) - (x * y)));
} else {
tmp = 1.0 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-220.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 640.0d0) then
tmp = x + (y / ((1.1283791670955126d0 + (z * (1.1283791670955126d0 + (0.5641895835477563d0 * z)))) - (x * y)))
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -220.0) {
tmp = x + (-1.0 / x);
} else if (z <= 640.0) {
tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (0.5641895835477563 * z)))) - (x * y)));
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -220.0: tmp = x + (-1.0 / x) elif z <= 640.0: tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (0.5641895835477563 * z)))) - (x * y))) else: tmp = 1.0 * x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -220.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 640.0) tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(z * Float64(1.1283791670955126 + Float64(0.5641895835477563 * z)))) - Float64(x * y)))); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -220.0) tmp = x + (-1.0 / x); elseif (z <= 640.0) tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (0.5641895835477563 * z)))) - (x * y))); else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -220.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 640.0], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(z * N[(1.1283791670955126 + N[(0.5641895835477563 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -220:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 640:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + 0.5641895835477563 \cdot z\right)\right) - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -220Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
if -220 < z < 640Initial program 95.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6483.2%
Applied rewrites83.2%
if 640 < z Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
lift-+.f64N/A
sum-to-multN/A
lower-unsound-*.f64N/A
metadata-evalN/A
lower-unsound-+.f64N/A
metadata-evalN/A
lower-unsound-/.f6461.7%
Applied rewrites61.7%
Taylor expanded in x around inf
Applied rewrites68.8%
(FPCore (x y z)
:precision binary64
(if (<= z -0.038)
(+ x (/ -1.0 x))
(if (<= z 640.0)
(+
x
(/
y
(- (+ 1.1283791670955126 (* 1.1283791670955126 z)) (* x y))))
(* 1.0 x))))double code(double x, double y, double z) {
double tmp;
if (z <= -0.038) {
tmp = x + (-1.0 / x);
} else if (z <= 640.0) {
tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y)));
} else {
tmp = 1.0 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-0.038d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 640.0d0) then
tmp = x + (y / ((1.1283791670955126d0 + (1.1283791670955126d0 * z)) - (x * y)))
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.038) {
tmp = x + (-1.0 / x);
} else if (z <= 640.0) {
tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y)));
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.038: tmp = x + (-1.0 / x) elif z <= 640.0: tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y))) else: tmp = 1.0 * x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.038) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 640.0) tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(1.1283791670955126 * z)) - Float64(x * y)))); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.038) tmp = x + (-1.0 / x); elseif (z <= 640.0) tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y))); else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.038], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 640.0], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(1.1283791670955126 * z), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -0.038:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 640:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + 1.1283791670955126 \cdot z\right) - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -0.037999999999999999Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
if -0.037999999999999999 < z < 640Initial program 95.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6482.0%
Applied rewrites82.0%
if 640 < z Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
lift-+.f64N/A
sum-to-multN/A
lower-unsound-*.f64N/A
metadata-evalN/A
lower-unsound-+.f64N/A
metadata-evalN/A
lower-unsound-/.f6461.7%
Applied rewrites61.7%
Taylor expanded in x around inf
Applied rewrites68.8%
(FPCore (x y z) :precision binary64 (if (<= (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))) 1e+169) (+ x (/ 1.0 (/ (- (* (exp z) 1.1283791670955126) (* y x)) y))) (+ x (/ -1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((x + (y / ((1.1283791670955126 * exp(z)) - (x * y)))) <= 1e+169) {
tmp = x + (1.0 / (((exp(z) * 1.1283791670955126) - (y * x)) / y));
} else {
tmp = x + (-1.0 / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))) <= 1d+169) then
tmp = x + (1.0d0 / (((exp(z) * 1.1283791670955126d0) - (y * x)) / y))
else
tmp = x + ((-1.0d0) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)))) <= 1e+169) {
tmp = x + (1.0 / (((Math.exp(z) * 1.1283791670955126) - (y * x)) / y));
} else {
tmp = x + (-1.0 / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))) <= 1e+169: tmp = x + (1.0 / (((math.exp(z) * 1.1283791670955126) - (y * x)) / y)) else: tmp = x + (-1.0 / x) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) <= 1e+169) tmp = Float64(x + Float64(1.0 / Float64(Float64(Float64(exp(z) * 1.1283791670955126) - Float64(y * x)) / y))); else tmp = Float64(x + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x + (y / ((1.1283791670955126 * exp(z)) - (x * y)))) <= 1e+169) tmp = x + (1.0 / (((exp(z) * 1.1283791670955126) - (y * x)) / y)); else tmp = x + (-1.0 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+169], N[(x + N[(1.0 / N[(N[(N[(N[Exp[z], $MachinePrecision] * 1.1283791670955126), $MachinePrecision] - N[(y * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \leq 10^{+169}:\\
\;\;\;\;x + \frac{1}{\frac{e^{z} \cdot 1.1283791670955126 - y \cdot x}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{x}\\
\end{array}
if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 9.9999999999999993e168Initial program 95.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6495.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.4%
Applied rewrites95.4%
if 9.9999999999999993e168 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))) (if (<= t_0 1e+169) t_0 (+ x (/ -1.0 x)))))
double code(double x, double y, double z) {
double t_0 = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
double tmp;
if (t_0 <= 1e+169) {
tmp = t_0;
} else {
tmp = x + (-1.0 / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
if (t_0 <= 1d+169) then
tmp = t_0
else
tmp = x + ((-1.0d0) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
double tmp;
if (t_0 <= 1e+169) {
tmp = t_0;
} else {
tmp = x + (-1.0 / x);
}
return tmp;
}
def code(x, y, z): t_0 = x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y))) tmp = 0 if t_0 <= 1e+169: tmp = t_0 else: tmp = x + (-1.0 / x) return tmp
function code(x, y, z) t_0 = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) tmp = 0.0 if (t_0 <= 1e+169) tmp = t_0; else tmp = Float64(x + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); tmp = 0.0; if (t_0 <= 1e+169) tmp = t_0; else tmp = x + (-1.0 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+169], t$95$0, N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\
\mathbf{if}\;t\_0 \leq 10^{+169}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{x}\\
\end{array}
if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 9.9999999999999993e168Initial program 95.3%
if 9.9999999999999993e168 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
(FPCore (x y z)
:precision binary64
(if (<= z -850.0)
(+ x (/ -1.0 x))
(if (<= z 390000.0)
(+ x (/ y (- 1.1283791670955126 (* x y))))
(* 1.0 x))))double code(double x, double y, double z) {
double tmp;
if (z <= -850.0) {
tmp = x + (-1.0 / x);
} else if (z <= 390000.0) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = 1.0 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-850.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 390000.0d0) then
tmp = x + (y / (1.1283791670955126d0 - (x * y)))
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -850.0) {
tmp = x + (-1.0 / x);
} else if (z <= 390000.0) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -850.0: tmp = x + (-1.0 / x) elif z <= 390000.0: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = 1.0 * x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -850.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 390000.0) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(x * y)))); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -850.0) tmp = x + (-1.0 / x); elseif (z <= 390000.0) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -850.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 390000.0], N[(x + N[(y / N[(1.1283791670955126 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -850:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 390000:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -850Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
if -850 < z < 3.9e5Initial program 95.3%
Taylor expanded in z around 0
Applied rewrites81.1%
if 3.9e5 < z Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
lift-+.f64N/A
sum-to-multN/A
lower-unsound-*.f64N/A
metadata-evalN/A
lower-unsound-+.f64N/A
metadata-evalN/A
lower-unsound-/.f6461.7%
Applied rewrites61.7%
Taylor expanded in x around inf
Applied rewrites68.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x)))
(t_1 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))))
(if (<= t_1 -2000000.0) t_0 (if (<= t_1 50000.0) (* 1.0 x) t_0))))double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
double tmp;
if (t_1 <= -2000000.0) {
tmp = t_0;
} else if (t_1 <= 50000.0) {
tmp = 1.0 * x;
} else {
tmp = t_0;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
t_1 = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
if (t_1 <= (-2000000.0d0)) then
tmp = t_0
else if (t_1 <= 50000.0d0) then
tmp = 1.0d0 * x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
double tmp;
if (t_1 <= -2000000.0) {
tmp = t_0;
} else if (t_1 <= 50000.0) {
tmp = 1.0 * x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) t_1 = x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y))) tmp = 0 if t_1 <= -2000000.0: tmp = t_0 elif t_1 <= 50000.0: tmp = 1.0 * x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) t_1 = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) tmp = 0.0 if (t_1 <= -2000000.0) tmp = t_0; elseif (t_1 <= 50000.0) tmp = Float64(1.0 * x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (-1.0 / x); t_1 = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); tmp = 0.0; if (t_1 <= -2000000.0) tmp = t_0; elseif (t_1 <= 50000.0) tmp = 1.0 * x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2000000.0], t$95$0, If[LessEqual[t$95$1, 50000.0], N[(1.0 * x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
t_1 := x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\
\mathbf{if}\;t\_1 \leq -2000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 50000:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < -2e6 or 5e4 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
if -2e6 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 5e4Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
lift-+.f64N/A
sum-to-multN/A
lower-unsound-*.f64N/A
metadata-evalN/A
lower-unsound-+.f64N/A
metadata-evalN/A
lower-unsound-/.f6461.7%
Applied rewrites61.7%
Taylor expanded in x around inf
Applied rewrites68.8%
(FPCore (x y z) :precision binary64 (if (<= z -9.2e-265) (* 1.0 x) (if (<= z 9.5) (+ x (* 0.8862269254527579 y)) (* 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.2e-265) {
tmp = 1.0 * x;
} else if (z <= 9.5) {
tmp = x + (0.8862269254527579 * y);
} else {
tmp = 1.0 * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-9.2d-265)) then
tmp = 1.0d0 * x
else if (z <= 9.5d0) then
tmp = x + (0.8862269254527579d0 * y)
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -9.2e-265) {
tmp = 1.0 * x;
} else if (z <= 9.5) {
tmp = x + (0.8862269254527579 * y);
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.2e-265: tmp = 1.0 * x elif z <= 9.5: tmp = x + (0.8862269254527579 * y) else: tmp = 1.0 * x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.2e-265) tmp = Float64(1.0 * x); elseif (z <= 9.5) tmp = Float64(x + Float64(0.8862269254527579 * y)); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9.2e-265) tmp = 1.0 * x; elseif (z <= 9.5) tmp = x + (0.8862269254527579 * y); else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.2e-265], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 9.5], N[(x + N[(0.8862269254527579 * y), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{-265}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 9.5:\\
\;\;\;\;x + 0.8862269254527579 \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -9.1999999999999996e-265 or 9.5 < z Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
lift-+.f64N/A
sum-to-multN/A
lower-unsound-*.f64N/A
metadata-evalN/A
lower-unsound-+.f64N/A
metadata-evalN/A
lower-unsound-/.f6461.7%
Applied rewrites61.7%
Taylor expanded in x around inf
Applied rewrites68.8%
if -9.1999999999999996e-265 < z < 9.5Initial program 95.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-exp.f6463.4%
Applied rewrites63.4%
Taylor expanded in z around 0
lower-*.f6460.0%
Applied rewrites60.0%
(FPCore (x y z) :precision binary64 (* 1.0 x))
double code(double x, double y, double z) {
return 1.0 * x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 * x
end function
public static double code(double x, double y, double z) {
return 1.0 * x;
}
def code(x, y, z): return 1.0 * x
function code(x, y, z) return Float64(1.0 * x) end
function tmp = code(x, y, z) tmp = 1.0 * x; end
code[x_, y_, z_] := N[(1.0 * x), $MachinePrecision]
1 \cdot x
Initial program 95.3%
Taylor expanded in x around inf
lower-/.f6468.8%
Applied rewrites68.8%
lift-+.f64N/A
sum-to-multN/A
lower-unsound-*.f64N/A
metadata-evalN/A
lower-unsound-+.f64N/A
metadata-evalN/A
lower-unsound-/.f6461.7%
Applied rewrites61.7%
Taylor expanded in x around inf
Applied rewrites68.8%
herbie shell --seed 2025258
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))