
(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / 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 = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / 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 = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
(FPCore (x y z) :precision binary64 (- (fma (/ z x) (fma z (- y -0.0007936500793651) -0.0027777777777778) (fma (log x) (- x 0.5) (- 0.91893853320467 x))) (/ -0.083333333333333 x)))
double code(double x, double y, double z) {
return fma((z / x), fma(z, (y - -0.0007936500793651), -0.0027777777777778), fma(log(x), (x - 0.5), (0.91893853320467 - x))) - (-0.083333333333333 / x);
}
function code(x, y, z) return Float64(fma(Float64(z / x), fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), fma(log(x), Float64(x - 0.5), Float64(0.91893853320467 - x))) - Float64(-0.083333333333333 / x)) end
code[x_, y_, z_] := N[(N[(N[(z / x), $MachinePrecision] * N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(\frac{z}{x}, \mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), \mathsf{fma}\left(\log x, x - 0.5, 0.91893853320467 - x\right)\right) - \frac{-0.083333333333333}{x}
Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
(FPCore (x y z)
:precision binary64
(if (<= x 1.2e+200)
(-
(fma (log x) (- x 0.5) (- 0.91893853320467 x))
(/
(fma
(fma (- -0.0007936500793651 y) z 0.0027777777777778)
z
-0.083333333333333)
x))
(-
(fma
z
(/ (fma 0.0007936500793651 z -0.0027777777777778) x)
(/ 0.083333333333333 x))
(fma (- 0.5 x) (log x) (- x 0.91893853320467)))))double code(double x, double y, double z) {
double tmp;
if (x <= 1.2e+200) {
tmp = fma(log(x), (x - 0.5), (0.91893853320467 - x)) - (fma(fma((-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x);
} else {
tmp = fma(z, (fma(0.0007936500793651, z, -0.0027777777777778) / x), (0.083333333333333 / x)) - fma((0.5 - x), log(x), (x - 0.91893853320467));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.2e+200) tmp = Float64(fma(log(x), Float64(x - 0.5), Float64(0.91893853320467 - x)) - Float64(fma(fma(Float64(-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x)); else tmp = Float64(fma(z, Float64(fma(0.0007936500793651, z, -0.0027777777777778) / x), Float64(0.083333333333333 / x)) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.2e+200], N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(-0.0007936500793651 - y), $MachinePrecision] * z + 0.0027777777777778), $MachinePrecision] * z + -0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 1.2 \cdot 10^{+200}:\\
\;\;\;\;\mathsf{fma}\left(\log x, x - 0.5, 0.91893853320467 - x\right) - \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.0007936500793651 - y, z, 0.0027777777777778\right), z, -0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{x}, \frac{0.083333333333333}{x}\right) - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\\
\end{array}
if x < 1.2e200Initial program 93.7%
Applied rewrites93.7%
if 1.2e200 < x Initial program 93.7%
Taylor expanded in y around 0
Applied rewrites78.3%
Applied rewrites78.3%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-fma.f64N/A
lower-/.f6480.9%
Applied rewrites80.9%
(FPCore (x y z)
:precision binary64
(if (<= x 1.15e+206)
(-
(fma (log x) (- x 0.5) (- 0.91893853320467 x))
(/
(fma
(fma (- -0.0007936500793651 y) z 0.0027777777777778)
z
-0.083333333333333)
x))
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/ (+ (* -0.0027777777777778 z) 0.083333333333333) x))))double code(double x, double y, double z) {
double tmp;
if (x <= 1.15e+206) {
tmp = fma(log(x), (x - 0.5), (0.91893853320467 - x)) - (fma(fma((-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x);
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((-0.0027777777777778 * z) + 0.083333333333333) / x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.15e+206) tmp = Float64(fma(log(x), Float64(x - 0.5), Float64(0.91893853320467 - x)) - Float64(fma(fma(Float64(-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x)); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(-0.0027777777777778 * z) + 0.083333333333333) / x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.15e+206], N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(-0.0007936500793651 - y), $MachinePrecision] * z + 0.0027777777777778), $MachinePrecision] * z + -0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(-0.0027777777777778 * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 1.15 \cdot 10^{+206}:\\
\;\;\;\;\mathsf{fma}\left(\log x, x - 0.5, 0.91893853320467 - x\right) - \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.0007936500793651 - y, z, 0.0027777777777778\right), z, -0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{-0.0027777777777778 \cdot z + 0.083333333333333}{x}\\
\end{array}
if x < 1.1500000000000001e206Initial program 93.7%
Applied rewrites93.7%
if 1.1500000000000001e206 < x Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites63.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(-
(fma (/ z x) (* y z) (fma (log x) (- x 0.5) (- 0.91893853320467 x)))
(/ -0.083333333333333 x))))
(if (<= y -9.5e+22)
t_0
(if (<= y 4.8e-91)
(-
(/
(fma
(fma 0.0007936500793651 z -0.0027777777777778)
z
0.083333333333333)
x)
(fma (- 0.5 x) (log x) (- x 0.91893853320467)))
t_0))))double code(double x, double y, double z) {
double t_0 = fma((z / x), (y * z), fma(log(x), (x - 0.5), (0.91893853320467 - x))) - (-0.083333333333333 / x);
double tmp;
if (y <= -9.5e+22) {
tmp = t_0;
} else if (y <= 4.8e-91) {
tmp = (fma(fma(0.0007936500793651, z, -0.0027777777777778), z, 0.083333333333333) / x) - fma((0.5 - x), log(x), (x - 0.91893853320467));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(fma(Float64(z / x), Float64(y * z), fma(log(x), Float64(x - 0.5), Float64(0.91893853320467 - x))) - Float64(-0.083333333333333 / x)) tmp = 0.0 if (y <= -9.5e+22) tmp = t_0; elseif (y <= 4.8e-91) tmp = Float64(Float64(fma(fma(0.0007936500793651, z, -0.0027777777777778), z, 0.083333333333333) / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(z / x), $MachinePrecision] * N[(y * z), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.5e+22], t$95$0, If[LessEqual[y, 4.8e-91], N[(N[(N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{z}{x}, y \cdot z, \mathsf{fma}\left(\log x, x - 0.5, 0.91893853320467 - x\right)\right) - \frac{-0.083333333333333}{x}\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{+22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-91}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -9.4999999999999994e22 or 4.8000000000000002e-91 < y Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in y around inf
lower-*.f6484.6%
Applied rewrites84.6%
if -9.4999999999999994e22 < y < 4.8000000000000002e-91Initial program 93.7%
Taylor expanded in y around 0
Applied rewrites78.3%
Applied rewrites78.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(fma
(fma (* y z) z 0.083333333333333)
(/ 1.0 x)
(fma (- x 0.5) (log x) (- 0.91893853320467 x)))))
(if (<= y -2.4e+25)
t_0
(if (<= y 1e-113)
(-
(/
(fma
(fma 0.0007936500793651 z -0.0027777777777778)
z
0.083333333333333)
x)
(fma (- 0.5 x) (log x) (- x 0.91893853320467)))
t_0))))double code(double x, double y, double z) {
double t_0 = fma(fma((y * z), z, 0.083333333333333), (1.0 / x), fma((x - 0.5), log(x), (0.91893853320467 - x)));
double tmp;
if (y <= -2.4e+25) {
tmp = t_0;
} else if (y <= 1e-113) {
tmp = (fma(fma(0.0007936500793651, z, -0.0027777777777778), z, 0.083333333333333) / x) - fma((0.5 - x), log(x), (x - 0.91893853320467));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(fma(Float64(y * z), z, 0.083333333333333), Float64(1.0 / x), fma(Float64(x - 0.5), log(x), Float64(0.91893853320467 - x))) tmp = 0.0 if (y <= -2.4e+25) tmp = t_0; elseif (y <= 1e-113) tmp = Float64(Float64(fma(fma(0.0007936500793651, z, -0.0027777777777778), z, 0.083333333333333) / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y * z), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] * N[(1.0 / x), $MachinePrecision] + N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4e+25], t$95$0, If[LessEqual[y, 1e-113], N[(N[(N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(y \cdot z, z, 0.083333333333333\right), \frac{1}{x}, \mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467 - x\right)\right)\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 10^{-113}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -2.4e25 or 9.9999999999999998e-114 < y Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Applied rewrites93.7%
Taylor expanded in y around inf
lower-*.f6482.2%
Applied rewrites82.2%
if -2.4e25 < y < 9.9999999999999998e-114Initial program 93.7%
Taylor expanded in y around 0
Applied rewrites78.3%
Applied rewrites78.3%
(FPCore (x y z)
:precision binary64
(if (<=
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))
100.0)
(* (* (/ (- y -0.0007936500793651) x) z) z)
(-
(/
(fma (fma 0.0007936500793651 z -0.0027777777777778) z 0.083333333333333)
x)
(fma (- 0.5 x) (log x) (- x 0.91893853320467)))))double code(double x, double y, double z) {
double tmp;
if ((((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) <= 100.0) {
tmp = (((y - -0.0007936500793651) / x) * z) * z;
} else {
tmp = (fma(fma(0.0007936500793651, z, -0.0027777777777778), z, 0.083333333333333) / x) - fma((0.5 - x), log(x), (x - 0.91893853320467));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) <= 100.0) tmp = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z); else tmp = Float64(Float64(fma(fma(0.0007936500793651, z, -0.0027777777777778), z, 0.083333333333333) / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467))); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], 100.0], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision], N[(N[(N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \leq 100:\\
\;\;\;\;\left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\\
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 100Initial program 93.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.4%
Applied rewrites41.4%
Applied rewrites43.3%
if 100 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 93.7%
Taylor expanded in y around 0
Applied rewrites78.3%
Applied rewrites78.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))))
(if (<= t_0 100.0)
(* (* (/ (- y -0.0007936500793651) x) z) z)
(if (<= t_0 5e+306)
(fma
(/ 1.0 x)
0.083333333333333
(fma (- x 0.5) (log x) (- 0.91893853320467 x)))
(fma (* z (+ 0.0007936500793651 y)) (/ z x) (/ 0.083333333333333 x))))))double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= 100.0) {
tmp = (((y - -0.0007936500793651) / x) * z) * z;
} else if (t_0 <= 5e+306) {
tmp = fma((1.0 / x), 0.083333333333333, fma((x - 0.5), log(x), (0.91893853320467 - x)));
} else {
tmp = fma((z * (0.0007936500793651 + y)), (z / x), (0.083333333333333 / x));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) tmp = 0.0 if (t_0 <= 100.0) tmp = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z); elseif (t_0 <= 5e+306) tmp = fma(Float64(1.0 / x), 0.083333333333333, fma(Float64(x - 0.5), log(x), Float64(0.91893853320467 - x))); else tmp = fma(Float64(z * Float64(0.0007936500793651 + y)), Float64(z / x), Float64(0.083333333333333 / x)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 100.0], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t$95$0, 5e+306], N[(N[(1.0 / x), $MachinePrecision] * 0.083333333333333 + N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\
\mathbf{if}\;t\_0 \leq 100:\\
\;\;\;\;\left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{x}, 0.083333333333333, \mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467 - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(0.0007936500793651 + y\right), \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 100Initial program 93.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.4%
Applied rewrites41.4%
Applied rewrites43.3%
if 100 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.9999999999999999e306Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites57.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6457.8%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate--r-N/A
sub-negate-revN/A
lift--.f64N/A
add-flipN/A
Applied rewrites57.9%
if 4.9999999999999999e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-add-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
metadata-evalN/A
lift-fma.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites64.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f6463.7%
Applied rewrites63.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))))
(if (<= t_0 100.0)
(* (* (/ (- y -0.0007936500793651) x) z) z)
(if (<= t_0 5e+306)
(-
(/ 0.083333333333333 x)
(fma (- 0.5 x) (log x) (- x 0.91893853320467)))
(fma (* z (+ 0.0007936500793651 y)) (/ z x) (/ 0.083333333333333 x))))))double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= 100.0) {
tmp = (((y - -0.0007936500793651) / x) * z) * z;
} else if (t_0 <= 5e+306) {
tmp = (0.083333333333333 / x) - fma((0.5 - x), log(x), (x - 0.91893853320467));
} else {
tmp = fma((z * (0.0007936500793651 + y)), (z / x), (0.083333333333333 / x));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) tmp = 0.0 if (t_0 <= 100.0) tmp = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z); elseif (t_0 <= 5e+306) tmp = Float64(Float64(0.083333333333333 / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467))); else tmp = fma(Float64(z * Float64(0.0007936500793651 + y)), Float64(z / x), Float64(0.083333333333333 / x)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 100.0], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t$95$0, 5e+306], N[(N[(0.083333333333333 / x), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\
\mathbf{if}\;t\_0 \leq 100:\\
\;\;\;\;\left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\frac{0.083333333333333}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(0.0007936500793651 + y\right), \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 100Initial program 93.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.4%
Applied rewrites41.4%
Applied rewrites43.3%
if 100 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.9999999999999999e306Initial program 93.7%
Taylor expanded in z around 0
Applied rewrites57.8%
lift--.f64N/A
sub-to-multN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-unsound-/.f6457.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6457.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6457.8%
Applied rewrites57.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-mult-revN/A
lift--.f64N/A
add-flipN/A
lift-+.f64N/A
Applied rewrites57.9%
if 4.9999999999999999e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-add-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
metadata-evalN/A
lift-fma.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites64.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f6463.7%
Applied rewrites63.7%
(FPCore (x y z)
:precision binary64
(if (<= x 9.6e+39)
(+
(+ 0.91893853320467 (* -0.5 (log x)))
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))
(* x (- (* -1.0 (log (/ 1.0 x))) 1.0))))double code(double x, double y, double z) {
double tmp;
if (x <= 9.6e+39) {
tmp = (0.91893853320467 + (-0.5 * log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = x * ((-1.0 * log((1.0 / x))) - 1.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) :: tmp
if (x <= 9.6d+39) then
tmp = (0.91893853320467d0 + ((-0.5d0) * log(x))) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
else
tmp = x * (((-1.0d0) * log((1.0d0 / x))) - 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 9.6e+39) {
tmp = (0.91893853320467 + (-0.5 * Math.log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = x * ((-1.0 * Math.log((1.0 / x))) - 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 9.6e+39: tmp = (0.91893853320467 + (-0.5 * math.log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) else: tmp = x * ((-1.0 * math.log((1.0 / x))) - 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 9.6e+39) tmp = Float64(Float64(0.91893853320467 + Float64(-0.5 * log(x))) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)); else tmp = Float64(x * Float64(Float64(-1.0 * log(Float64(1.0 / x))) - 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 9.6e+39) tmp = (0.91893853320467 + (-0.5 * log(x))) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); else tmp = x * ((-1.0 * log((1.0 / x))) - 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 9.6e+39], N[(N[(0.91893853320467 + N[(-0.5 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-1.0 * N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 9.6 \cdot 10^{+39}:\\
\;\;\;\;\left(0.91893853320467 + -0.5 \cdot \log x\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right)\\
\end{array}
if x < 9.6000000000000004e39Initial program 93.7%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6461.6%
Applied rewrites61.6%
if 9.6000000000000004e39 < x Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-/.f6422.9%
Applied rewrites22.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6436.2%
Applied rewrites36.2%
(FPCore (x y z)
:precision binary64
(if (<= x 9.6e+39)
(*
(fma
(fma z (- y -0.0007936500793651) -0.0027777777777778)
z
0.083333333333333)
(/ 1.0 x))
(* x (- (* -1.0 (log (/ 1.0 x))) 1.0))))double code(double x, double y, double z) {
double tmp;
if (x <= 9.6e+39) {
tmp = fma(fma(z, (y - -0.0007936500793651), -0.0027777777777778), z, 0.083333333333333) * (1.0 / x);
} else {
tmp = x * ((-1.0 * log((1.0 / x))) - 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 9.6e+39) tmp = Float64(fma(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), z, 0.083333333333333) * Float64(1.0 / x)); else tmp = Float64(x * Float64(Float64(-1.0 * log(Float64(1.0 / x))) - 1.0)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 9.6e+39], N[(N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-1.0 * N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 9.6 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), z, 0.083333333333333\right) \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right)\\
\end{array}
if x < 9.6000000000000004e39Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
lower-*.f6461.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
metadata-evalN/A
lift-fma.f64N/A
lower-fma.f6461.9%
Applied rewrites61.9%
if 9.6000000000000004e39 < x Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-/.f6422.9%
Applied rewrites22.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6436.2%
Applied rewrites36.2%
(FPCore (x y z)
:precision binary64
(if (<= x 9.6e+39)
(/
(fma
(fma z (- y -0.0007936500793651) -0.0027777777777778)
z
0.083333333333333)
x)
(* x (- (* -1.0 (log (/ 1.0 x))) 1.0))))double code(double x, double y, double z) {
double tmp;
if (x <= 9.6e+39) {
tmp = fma(fma(z, (y - -0.0007936500793651), -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = x * ((-1.0 * log((1.0 / x))) - 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 9.6e+39) tmp = Float64(fma(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(x * Float64(Float64(-1.0 * log(Float64(1.0 / x))) - 1.0)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 9.6e+39], N[(N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(x * N[(N[(-1.0 * N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 9.6 \cdot 10^{+39}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right)\\
\end{array}
if x < 9.6000000000000004e39Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
metadata-evalN/A
lift-fma.f64N/A
lower-fma.f6462.0%
Applied rewrites62.0%
if 9.6000000000000004e39 < x Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-/.f6422.9%
Applied rewrites22.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6436.2%
Applied rewrites36.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* (/ (- y -0.0007936500793651) x) z) z))
(t_1
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_1 -5000000000000.0)
t_0
(if (<= t_1 0.1)
(fma -0.0027777777777778 (/ z x) (* 0.083333333333333 (/ 1.0 x)))
t_0))))double code(double x, double y, double z) {
double t_0 = (((y - -0.0007936500793651) / x) * z) * z;
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = fma(-0.0027777777777778, (z / x), (0.083333333333333 * (1.0 / x)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z) t_1 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= -5000000000000.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = fma(-0.0027777777777778, Float64(z / x), Float64(0.083333333333333 * Float64(1.0 / x))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$1, -5000000000000.0], t$95$0, If[LessEqual[t$95$1, 0.1], N[(-0.0027777777777778 * N[(z / x), $MachinePrecision] + N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
t_1 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq -5000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, 0.083333333333333 \cdot \frac{1}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -5e12 or 0.10000000000000001 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 93.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.4%
Applied rewrites41.4%
Applied rewrites43.3%
if -5e12 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 0.10000000000000001Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6428.7%
Applied rewrites28.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* (/ (- y -0.0007936500793651) x) z) z))
(t_1
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_1 -5000000000000.0)
t_0
(if (<= t_1 0.1)
(/
(+
0.083333333333333
(* z (- (* 0.0007936500793651 z) 0.0027777777777778)))
x)
t_0))))double code(double x, double y, double z) {
double t_0 = (((y - -0.0007936500793651) / x) * z) * z;
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / 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 = (((y - (-0.0007936500793651d0)) / x) * z) * z
t_1 = ((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0
if (t_1 <= (-5000000000000.0d0)) then
tmp = t_0
else if (t_1 <= 0.1d0) then
tmp = (0.083333333333333d0 + (z * ((0.0007936500793651d0 * z) - 0.0027777777777778d0))) / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (((y - -0.0007936500793651) / x) * z) * z;
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (((y - -0.0007936500793651) / x) * z) * z t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333 tmp = 0 if t_1 <= -5000000000000.0: tmp = t_0 elif t_1 <= 0.1: tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z) t_1 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= -5000000000000.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(0.0007936500793651 * z) - 0.0027777777777778))) / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (((y - -0.0007936500793651) / x) * z) * z; t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333; tmp = 0.0; if (t_1 <= -5000000000000.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$1, -5000000000000.0], t$95$0, If[LessEqual[t$95$1, 0.1], N[(N[(0.083333333333333 + N[(z * N[(N[(0.0007936500793651 * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
t_1 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq -5000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -5e12 or 0.10000000000000001 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 93.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.4%
Applied rewrites41.4%
Applied rewrites43.3%
if -5e12 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 0.10000000000000001Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in y around 0
lower-*.f6445.6%
Applied rewrites45.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* (/ (- y -0.0007936500793651) x) z) z))
(t_1
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_1 -5000000000000.0)
t_0
(if (<= t_1 0.1)
(/ (+ 0.083333333333333 (* -0.0027777777777778 z)) x)
t_0))))double code(double x, double y, double z) {
double t_0 = (((y - -0.0007936500793651) / x) * z) * z;
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / 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 = (((y - (-0.0007936500793651d0)) / x) * z) * z
t_1 = ((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0
if (t_1 <= (-5000000000000.0d0)) then
tmp = t_0
else if (t_1 <= 0.1d0) then
tmp = (0.083333333333333d0 + ((-0.0027777777777778d0) * z)) / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (((y - -0.0007936500793651) / x) * z) * z;
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (((y - -0.0007936500793651) / x) * z) * z t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333 tmp = 0 if t_1 <= -5000000000000.0: tmp = t_0 elif t_1 <= 0.1: tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z) t_1 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= -5000000000000.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = Float64(Float64(0.083333333333333 + Float64(-0.0027777777777778 * z)) / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (((y - -0.0007936500793651) / x) * z) * z; t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333; tmp = 0.0; if (t_1 <= -5000000000000.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$1, -5000000000000.0], t$95$0, If[LessEqual[t$95$1, 0.1], N[(N[(0.083333333333333 + N[(-0.0027777777777778 * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
t_1 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq -5000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -5e12 or 0.10000000000000001 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 93.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.4%
Applied rewrites41.4%
Applied rewrites43.3%
if -5e12 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 0.10000000000000001Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-*.f6428.7%
Applied rewrites28.7%
(FPCore (x y z) :precision binary64 (fma (* z (+ 0.0007936500793651 y)) (/ z x) (/ 0.083333333333333 x)))
double code(double x, double y, double z) {
return fma((z * (0.0007936500793651 + y)), (z / x), (0.083333333333333 / x));
}
function code(x, y, z) return fma(Float64(z * Float64(0.0007936500793651 + y)), Float64(z / x), Float64(0.083333333333333 / x)) end
code[x_, y_, z_] := N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(z \cdot \left(0.0007936500793651 + y\right), \frac{z}{x}, \frac{0.083333333333333}{x}\right)
Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-add-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
metadata-evalN/A
lift-fma.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites64.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f6463.7%
Applied rewrites63.7%
(FPCore (x y z)
:precision binary64
(if (<=
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
5.0)
(fma (* y z) (/ z x) (/ 0.083333333333333 x))
(* (* (/ (- y -0.0007936500793651) x) z) z)))double code(double x, double y, double z) {
double tmp;
if ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) <= 5.0) {
tmp = fma((y * z), (z / x), (0.083333333333333 / x));
} else {
tmp = (((y - -0.0007936500793651) / x) * z) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) <= 5.0) tmp = fma(Float64(y * z), Float64(z / x), Float64(0.083333333333333 / x)); else tmp = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision], 5.0], N[(N[(y * z), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333 \leq 5:\\
\;\;\;\;\mathsf{fma}\left(y \cdot z, \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-add-revN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
metadata-evalN/A
lift-fma.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites64.2%
Taylor expanded in y around inf
lower-*.f6450.2%
Applied rewrites50.2%
if 5 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 93.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.4%
Applied rewrites41.4%
Applied rewrites43.3%
(FPCore (x y z) :precision binary64 (/ (fma (fma z (- y -0.0007936500793651) -0.0027777777777778) z 0.083333333333333) x))
double code(double x, double y, double z) {
return fma(fma(z, (y - -0.0007936500793651), -0.0027777777777778), z, 0.083333333333333) / x;
}
function code(x, y, z) return Float64(fma(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), z, 0.083333333333333) / x) end
code[x_, y_, z_] := N[(N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\frac{\mathsf{fma}\left(\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}
Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
metadata-evalN/A
lift-fma.f64N/A
lower-fma.f6462.0%
Applied rewrites62.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* (- y -0.0007936500793651) (* z z)) x))
(t_1
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_1 -5000000000000.0)
t_0
(if (<= t_1 0.1)
(/ (+ 0.083333333333333 (* -0.0027777777777778 z)) x)
t_0))))double code(double x, double y, double z) {
double t_0 = ((y - -0.0007936500793651) * (z * z)) / x;
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / 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 = ((y - (-0.0007936500793651d0)) * (z * z)) / x
t_1 = ((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0
if (t_1 <= (-5000000000000.0d0)) then
tmp = t_0
else if (t_1 <= 0.1d0) then
tmp = (0.083333333333333d0 + ((-0.0027777777777778d0) * z)) / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y - -0.0007936500793651) * (z * z)) / x;
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y - -0.0007936500793651) * (z * z)) / x t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333 tmp = 0 if t_1 <= -5000000000000.0: tmp = t_0 elif t_1 <= 0.1: tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y - -0.0007936500793651) * Float64(z * z)) / x) t_1 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= -5000000000000.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = Float64(Float64(0.083333333333333 + Float64(-0.0027777777777778 * z)) / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y - -0.0007936500793651) * (z * z)) / x; t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333; tmp = 0.0; if (t_1 <= -5000000000000.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$1, -5000000000000.0], t$95$0, If[LessEqual[t$95$1, 0.1], N[(N[(0.083333333333333 + N[(-0.0027777777777778 * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{\left(y - -0.0007936500793651\right) \cdot \left(z \cdot z\right)}{x}\\
t_1 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq -5000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -5e12 or 0.10000000000000001 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 93.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.4%
Applied rewrites41.4%
lift-*.f64N/A
*-commutativeN/A
lift-fma.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-*l/N/A
lower-/.f64N/A
+-commutativeN/A
associate-*l*N/A
lift-/.f64N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-*.f6441.4%
lift-pow.f64N/A
unpow2N/A
lower-*.f6441.4%
Applied rewrites41.4%
if -5e12 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 0.10000000000000001Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-*.f6428.7%
Applied rewrites28.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (- y -0.0007936500793651) x) (* z z)))
(t_1
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_1 -5000000000000.0)
t_0
(if (<= t_1 0.1)
(/ (+ 0.083333333333333 (* -0.0027777777777778 z)) x)
t_0))))double code(double x, double y, double z) {
double t_0 = ((y - -0.0007936500793651) / x) * (z * z);
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / 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 = ((y - (-0.0007936500793651d0)) / x) * (z * z)
t_1 = ((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0
if (t_1 <= (-5000000000000.0d0)) then
tmp = t_0
else if (t_1 <= 0.1d0) then
tmp = (0.083333333333333d0 + ((-0.0027777777777778d0) * z)) / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y - -0.0007936500793651) / x) * (z * z);
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y - -0.0007936500793651) / x) * (z * z) t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333 tmp = 0 if t_1 <= -5000000000000.0: tmp = t_0 elif t_1 <= 0.1: tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y - -0.0007936500793651) / x) * Float64(z * z)) t_1 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= -5000000000000.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = Float64(Float64(0.083333333333333 + Float64(-0.0027777777777778 * z)) / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y - -0.0007936500793651) / x) * (z * z); t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333; tmp = 0.0; if (t_1 <= -5000000000000.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$1, -5000000000000.0], t$95$0, If[LessEqual[t$95$1, 0.1], N[(N[(0.083333333333333 + N[(-0.0027777777777778 * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{y - -0.0007936500793651}{x} \cdot \left(z \cdot z\right)\\
t_1 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq -5000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -5e12 or 0.10000000000000001 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 93.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.4%
Applied rewrites41.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6441.4%
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6441.4%
lift-pow.f64N/A
unpow2N/A
lower-*.f6441.4%
Applied rewrites41.4%
if -5e12 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 0.10000000000000001Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-*.f6428.7%
Applied rewrites28.7%
(FPCore (x y z) :precision binary64 (/ (+ 0.083333333333333 (* -0.0027777777777778 z)) x))
double code(double x, double y, double z) {
return (0.083333333333333 + (-0.0027777777777778 * z)) / 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 = (0.083333333333333d0 + ((-0.0027777777777778d0) * z)) / x
end function
public static double code(double x, double y, double z) {
return (0.083333333333333 + (-0.0027777777777778 * z)) / x;
}
def code(x, y, z): return (0.083333333333333 + (-0.0027777777777778 * z)) / x
function code(x, y, z) return Float64(Float64(0.083333333333333 + Float64(-0.0027777777777778 * z)) / x) end
function tmp = code(x, y, z) tmp = (0.083333333333333 + (-0.0027777777777778 * z)) / x; end
code[x_, y_, z_] := N[(N[(0.083333333333333 + N[(-0.0027777777777778 * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\frac{0.083333333333333 + -0.0027777777777778 \cdot z}{x}
Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-*.f6428.7%
Applied rewrites28.7%
(FPCore (x y z) :precision binary64 (* (/ 1.0 x) 0.083333333333333))
double code(double x, double y, double z) {
return (1.0 / x) * 0.083333333333333;
}
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) * 0.083333333333333d0
end function
public static double code(double x, double y, double z) {
return (1.0 / x) * 0.083333333333333;
}
def code(x, y, z): return (1.0 / x) * 0.083333333333333
function code(x, y, z) return Float64(Float64(1.0 / x) * 0.083333333333333) end
function tmp = code(x, y, z) tmp = (1.0 / x) * 0.083333333333333; end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] * 0.083333333333333), $MachinePrecision]
\frac{1}{x} \cdot 0.083333333333333
Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-/.f6422.9%
Applied rewrites22.9%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6422.9%
Applied rewrites22.9%
(FPCore (x y z) :precision binary64 (/ 0.083333333333333 x))
double code(double x, double y, double z) {
return 0.083333333333333 / 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 = 0.083333333333333d0 / x
end function
public static double code(double x, double y, double z) {
return 0.083333333333333 / x;
}
def code(x, y, z): return 0.083333333333333 / x
function code(x, y, z) return Float64(0.083333333333333 / x) end
function tmp = code(x, y, z) tmp = 0.083333333333333 / x; end
code[x_, y_, z_] := N[(0.083333333333333 / x), $MachinePrecision]
\frac{0.083333333333333}{x}
Initial program 93.7%
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
add-flipN/A
div-subN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.0%
Applied rewrites62.0%
Taylor expanded in z around 0
lower-/.f6422.9%
Applied rewrites22.9%
herbie shell --seed 2025205
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
(+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))