
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
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) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
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) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
(FPCore (x y z) :precision binary64 (/ 1.0 (fma (* y z) (* z x) (* x y))))
double code(double x, double y, double z) {
return 1.0 / fma((y * z), (z * x), (x * y));
}
function code(x, y, z) return Float64(1.0 / fma(Float64(y * z), Float64(z * x), Float64(x * y))) end
code[x_, y_, z_] := N[(1.0 / N[(N[(y * z), $MachinePrecision] * N[(z * x), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{fma}\left(y \cdot z, z \cdot x, x \cdot y\right)}
\end{array}
Initial program 91.0%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f6490.6
Applied rewrites90.6%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
pow2N/A
associate-*l*N/A
associate-*l*N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lower-*.f6497.7
Applied rewrites97.7%
(FPCore (x y z) :precision binary64 (if (<= z 1.08e+142) (/ (/ (/ 1.0 x) (fma z z 1.0)) y) (/ 1.0 (* (* (* x y) z) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.08e+142) {
tmp = ((1.0 / x) / fma(z, z, 1.0)) / y;
} else {
tmp = 1.0 / (((x * y) * z) * z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 1.08e+142) tmp = Float64(Float64(Float64(1.0 / x) / fma(z, z, 1.0)) / y); else tmp = Float64(1.0 / Float64(Float64(Float64(x * y) * z) * z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 1.08e+142], N[(N[(N[(1.0 / x), $MachinePrecision] / N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.08 \cdot 10^{+142}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{\mathsf{fma}\left(z, z, 1\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z}\\
\end{array}
\end{array}
if z < 1.08e142Initial program 93.4%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f6493.3
Applied rewrites93.3%
if 1.08e142 < z Initial program 74.1%
Taylor expanded in z around inf
pow2N/A
lift-*.f6474.1
Applied rewrites74.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6473.3
pow273.3
+-commutative73.3
pow273.3
Applied rewrites73.3%
Taylor expanded in z around inf
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6488.2
Applied rewrites88.2%
Taylor expanded in z around inf
Applied rewrites88.2%
(FPCore (x y z) :precision binary64 (if (<= (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))) 0.0) (/ 1.0 (* (* (* x y) z) z)) (/ (/ 1.0 (* (fma z z 1.0) y)) x)))
double code(double x, double y, double z) {
double tmp;
if (((1.0 / x) / (y * (1.0 + (z * z)))) <= 0.0) {
tmp = 1.0 / (((x * y) * z) * z);
} else {
tmp = (1.0 / (fma(z, z, 1.0) * y)) / x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) <= 0.0) tmp = Float64(1.0 / Float64(Float64(Float64(x * y) * z) * z)); else tmp = Float64(Float64(1.0 / Float64(fma(z, z, 1.0) * y)) / x); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 / N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[(z * z + 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \leq 0:\\
\;\;\;\;\frac{1}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot y}}{x}\\
\end{array}
\end{array}
if (/.f64 (/.f64 #s(literal 1 binary64) x) (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))) < 0.0Initial program 87.4%
Taylor expanded in z around inf
pow2N/A
lift-*.f6454.2
Applied rewrites54.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6458.0
pow258.0
+-commutative58.0
pow258.0
Applied rewrites58.0%
Taylor expanded in z around inf
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6475.0
Applied rewrites75.0%
Taylor expanded in z around inf
Applied rewrites68.2%
if 0.0 < (/.f64 (/.f64 #s(literal 1 binary64) x) (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))) Initial program 99.5%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-/l/N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.6
Applied rewrites99.6%
(FPCore (x y z) :precision binary64 (if (<= (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))) 0.0) (/ 1.0 (* (* (* x y) z) z)) (/ (/ 1.0 x) (fma (* y z) z y))))
double code(double x, double y, double z) {
double tmp;
if (((1.0 / x) / (y * (1.0 + (z * z)))) <= 0.0) {
tmp = 1.0 / (((x * y) * z) * z);
} else {
tmp = (1.0 / x) / fma((y * z), z, y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) <= 0.0) tmp = Float64(1.0 / Float64(Float64(Float64(x * y) * z) * z)); else tmp = Float64(Float64(1.0 / x) / fma(Float64(y * z), z, y)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 / N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \leq 0:\\
\;\;\;\;\frac{1}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{\mathsf{fma}\left(y \cdot z, z, y\right)}\\
\end{array}
\end{array}
if (/.f64 (/.f64 #s(literal 1 binary64) x) (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))) < 0.0Initial program 87.4%
Taylor expanded in z around inf
pow2N/A
lift-*.f6454.2
Applied rewrites54.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6458.0
pow258.0
+-commutative58.0
pow258.0
Applied rewrites58.0%
Taylor expanded in z around inf
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6475.0
Applied rewrites75.0%
Taylor expanded in z around inf
Applied rewrites68.2%
if 0.0 < (/.f64 (/.f64 #s(literal 1 binary64) x) (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))) Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
pow2N/A
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
pow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
(FPCore (x y z) :precision binary64 (if (<= (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))) 1e-317) (/ 1.0 (* (* (* x y) z) z)) (/ 1.0 (* (* (fma z z 1.0) y) x))))
double code(double x, double y, double z) {
double tmp;
if (((1.0 / x) / (y * (1.0 + (z * z)))) <= 1e-317) {
tmp = 1.0 / (((x * y) * z) * z);
} else {
tmp = 1.0 / ((fma(z, z, 1.0) * y) * x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) <= 1e-317) tmp = Float64(1.0 / Float64(Float64(Float64(x * y) * z) * z)); else tmp = Float64(1.0 / Float64(Float64(fma(z, z, 1.0) * y) * x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-317], N[(1.0 / N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(z * z + 1.0), $MachinePrecision] * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \leq 10^{-317}:\\
\;\;\;\;\frac{1}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\mathsf{fma}\left(z, z, 1\right) \cdot y\right) \cdot x}\\
\end{array}
\end{array}
if (/.f64 (/.f64 #s(literal 1 binary64) x) (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))) < 1.00000023e-317Initial program 87.4%
Taylor expanded in z around inf
pow2N/A
lift-*.f6454.1
Applied rewrites54.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6458.0
pow258.0
+-commutative58.0
pow258.0
Applied rewrites58.0%
Taylor expanded in z around inf
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6475.0
Applied rewrites75.0%
Taylor expanded in z around inf
Applied rewrites68.3%
if 1.00000023e-317 < (/.f64 (/.f64 #s(literal 1 binary64) x) (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))) Initial program 99.5%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.1
Applied rewrites99.1%
(FPCore (x y z)
:precision binary64
(if (<= z 1.0)
(/ (/ 1.0 x) y)
(if (<= z 1.92e+143)
(/ (/ 1.0 (* (* z z) x)) y)
(/ 1.0 (* (* (* x y) z) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else if (z <= 1.92e+143) {
tmp = (1.0 / ((z * z) * x)) / y;
} else {
tmp = 1.0 / (((x * y) * z) * z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / x) / y
else if (z <= 1.92d+143) then
tmp = (1.0d0 / ((z * z) * x)) / y
else
tmp = 1.0d0 / (((x * y) * z) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else if (z <= 1.92e+143) {
tmp = (1.0 / ((z * z) * x)) / y;
} else {
tmp = 1.0 / (((x * y) * z) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / x) / y elif z <= 1.92e+143: tmp = (1.0 / ((z * z) * x)) / y else: tmp = 1.0 / (((x * y) * z) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / x) / y); elseif (z <= 1.92e+143) tmp = Float64(Float64(1.0 / Float64(Float64(z * z) * x)) / y); else tmp = Float64(1.0 / Float64(Float64(Float64(x * y) * z) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / x) / y; elseif (z <= 1.92e+143) tmp = (1.0 / ((z * z) * x)) / y; else tmp = 1.0 / (((x * y) * z) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 1.92e+143], N[(N[(1.0 / N[(N[(z * z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{elif}\;z \leq 1.92 \cdot 10^{+143}:\\
\;\;\;\;\frac{\frac{1}{\left(z \cdot z\right) \cdot x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z}\\
\end{array}
\end{array}
if z < 1Initial program 93.8%
Taylor expanded in z around 0
Applied rewrites71.3%
if 1 < z < 1.9199999999999999e143Initial program 91.2%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f6491.7
Applied rewrites91.7%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6489.4
Applied rewrites89.4%
if 1.9199999999999999e143 < z Initial program 74.0%
Taylor expanded in z around inf
pow2N/A
lift-*.f6474.0
Applied rewrites74.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6473.3
pow273.3
+-commutative73.3
pow273.3
Applied rewrites73.3%
Taylor expanded in z around inf
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6488.3
Applied rewrites88.3%
Taylor expanded in z around inf
Applied rewrites88.3%
(FPCore (x y z) :precision binary64 (if (<= z 1e+141) (/ 1.0 (* (* (fma z z 1.0) x) y)) (/ 1.0 (* (* (* x y) z) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1e+141) {
tmp = 1.0 / ((fma(z, z, 1.0) * x) * y);
} else {
tmp = 1.0 / (((x * y) * z) * z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 1e+141) tmp = Float64(1.0 / Float64(Float64(fma(z, z, 1.0) * x) * y)); else tmp = Float64(1.0 / Float64(Float64(Float64(x * y) * z) * z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 1e+141], N[(1.0 / N[(N[(N[(z * z + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 10^{+141}:\\
\;\;\;\;\frac{1}{\left(\mathsf{fma}\left(z, z, 1\right) \cdot x\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z}\\
\end{array}
\end{array}
if z < 1.00000000000000002e141Initial program 93.4%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f6493.1
Applied rewrites93.1%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-fma.f6492.8
Applied rewrites92.8%
if 1.00000000000000002e141 < z Initial program 74.3%
Taylor expanded in z around inf
pow2N/A
lift-*.f6474.3
Applied rewrites74.3%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6473.5
pow273.5
+-commutative73.5
pow273.5
Applied rewrites73.5%
Taylor expanded in z around inf
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6488.3
Applied rewrites88.3%
Taylor expanded in z around inf
Applied rewrites88.3%
(FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 x) y) (if (<= z 1e+141) (/ 1.0 (* (* (* z z) x) y)) (/ 1.0 (* (* (* x y) z) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else if (z <= 1e+141) {
tmp = 1.0 / (((z * z) * x) * y);
} else {
tmp = 1.0 / (((x * y) * z) * z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / x) / y
else if (z <= 1d+141) then
tmp = 1.0d0 / (((z * z) * x) * y)
else
tmp = 1.0d0 / (((x * y) * z) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else if (z <= 1e+141) {
tmp = 1.0 / (((z * z) * x) * y);
} else {
tmp = 1.0 / (((x * y) * z) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / x) / y elif z <= 1e+141: tmp = 1.0 / (((z * z) * x) * y) else: tmp = 1.0 / (((x * y) * z) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / x) / y); elseif (z <= 1e+141) tmp = Float64(1.0 / Float64(Float64(Float64(z * z) * x) * y)); else tmp = Float64(1.0 / Float64(Float64(Float64(x * y) * z) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / x) / y; elseif (z <= 1e+141) tmp = 1.0 / (((z * z) * x) * y); else tmp = 1.0 / (((x * y) * z) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 1e+141], N[(1.0 / N[(N[(N[(z * z), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{elif}\;z \leq 10^{+141}:\\
\;\;\;\;\frac{1}{\left(\left(z \cdot z\right) \cdot x\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z}\\
\end{array}
\end{array}
if z < 1Initial program 93.8%
Taylor expanded in z around 0
Applied rewrites71.3%
if 1 < z < 1.00000000000000002e141Initial program 91.1%
Taylor expanded in z around inf
pow2N/A
lift-*.f6489.4
Applied rewrites89.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6491.9
pow291.9
+-commutative91.9
pow291.9
Applied rewrites91.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6489.0
Applied rewrites89.0%
if 1.00000000000000002e141 < z Initial program 74.3%
Taylor expanded in z around inf
pow2N/A
lift-*.f6474.3
Applied rewrites74.3%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6473.5
pow273.5
+-commutative73.5
pow273.5
Applied rewrites73.5%
Taylor expanded in z around inf
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6488.3
Applied rewrites88.3%
Taylor expanded in z around inf
Applied rewrites88.3%
(FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 x) y) (/ 1.0 (* (* (* x y) z) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (((x * y) * z) * z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.0d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / (((x * y) * z) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (((x * y) * z) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / x) / y else: tmp = 1.0 / (((x * y) * z) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(Float64(Float64(x * y) * z) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / x) / y; else tmp = 1.0 / (((x * y) * z) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\left(x \cdot y\right) \cdot z\right) \cdot z}\\
\end{array}
\end{array}
if z < 1Initial program 93.8%
Taylor expanded in z around 0
Applied rewrites71.3%
if 1 < z Initial program 82.4%
Taylor expanded in z around inf
pow2N/A
lift-*.f6481.5
Applied rewrites81.5%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6482.3
pow282.3
+-commutative82.3
pow282.3
Applied rewrites82.3%
Taylor expanded in z around inf
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6490.9
Applied rewrites90.9%
Taylor expanded in z around inf
Applied rewrites90.0%
(FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 x) y) (/ 1.0 (* (* (* y z) z) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (((y * z) * 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 <= 1.0d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / (((y * z) * z) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (((y * z) * z) * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / x) / y else: tmp = 1.0 / (((y * z) * z) * x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(Float64(Float64(y * z) * z) * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / x) / y; else tmp = 1.0 / (((y * z) * z) * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(N[(N[(y * z), $MachinePrecision] * z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\left(y \cdot z\right) \cdot z\right) \cdot x}\\
\end{array}
\end{array}
if z < 1Initial program 93.8%
Taylor expanded in z around 0
Applied rewrites71.3%
if 1 < z Initial program 82.4%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f6482.2
Applied rewrites82.2%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f6488.8
Applied rewrites88.8%
(FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 x) y) (/ 1.0 (* (* (* z z) y) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (((z * 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 <= 1.0d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / (((z * z) * y) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (((z * z) * y) * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / x) / y else: tmp = 1.0 / (((z * z) * y) * x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(Float64(Float64(z * z) * y) * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / x) / y; else tmp = 1.0 / (((z * z) * y) * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\left(z \cdot z\right) \cdot y\right) \cdot x}\\
\end{array}
\end{array}
if z < 1Initial program 93.8%
Taylor expanded in z around 0
Applied rewrites71.3%
if 1 < z Initial program 82.4%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6481.5
Applied rewrites81.5%
(FPCore (x y z) :precision binary64 (/ 1.0 (* y x)))
double code(double x, double y, double z) {
return 1.0 / (y * 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 / (y * x)
end function
public static double code(double x, double y, double z) {
return 1.0 / (y * x);
}
def code(x, y, z): return 1.0 / (y * x)
function code(x, y, z) return Float64(1.0 / Float64(y * x)) end
function tmp = code(x, y, z) tmp = 1.0 / (y * x); end
code[x_, y_, z_] := N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{y \cdot x}
\end{array}
Initial program 91.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6458.2
Applied rewrites58.2%
herbie shell --seed 2025113
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))