
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - 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 = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z): return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z))) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z)); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - 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 = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z): return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z))) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z)); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}
(FPCore (x y z) :precision binary64 (fma (fma z 6.0 -4.0) (- x y) x))
double code(double x, double y, double z) {
return fma(fma(z, 6.0, -4.0), (x - y), x);
}
function code(x, y, z) return fma(fma(z, 6.0, -4.0), Float64(x - y), x) end
code[x_, y_, z_] := N[(N[(z * 6.0 + -4.0), $MachinePrecision] * N[(x - y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(z, 6, -4\right), x - y, x\right)
\end{array}
Initial program 99.5%
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (if (<= z -0.58) (* (* (- y x) z) -6.0) (if (<= z 0.6) (fma x -3.0 (* 4.0 y)) (* (* -6.0 (- y x)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.58) {
tmp = ((y - x) * z) * -6.0;
} else if (z <= 0.6) {
tmp = fma(x, -3.0, (4.0 * y));
} else {
tmp = (-6.0 * (y - x)) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -0.58) tmp = Float64(Float64(Float64(y - x) * z) * -6.0); elseif (z <= 0.6) tmp = fma(x, -3.0, Float64(4.0 * y)); else tmp = Float64(Float64(-6.0 * Float64(y - x)) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -0.58], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * -6.0), $MachinePrecision], If[LessEqual[z, 0.6], N[(x * -3.0 + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], N[(N[(-6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.58:\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot -6\\
\mathbf{elif}\;z \leq 0.6:\\
\;\;\;\;\mathsf{fma}\left(x, -3, 4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-6 \cdot \left(y - x\right)\right) \cdot z\\
\end{array}
\end{array}
if z < -0.57999999999999996Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6497.5
Applied rewrites97.5%
if -0.57999999999999996 < z < 0.599999999999999978Initial program 99.3%
Taylor expanded in z around 0
Applied rewrites97.8%
lift--.f64N/A
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
distribute-lft-out--N/A
metadata-evalN/A
associate--l+N/A
distribute-rgt1-inN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6497.9
Applied rewrites97.9%
if 0.599999999999999978 < z Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6497.6
Applied rewrites97.6%
lift-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identity97.6
Applied rewrites97.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (/ 2.0 3.0) z)) (t_1 (* (* -6.0 (- y x)) z))) (if (<= t_0 -500000.0) t_1 (if (<= t_0 1.0) (fma x -3.0 (* 4.0 y)) t_1))))
double code(double x, double y, double z) {
double t_0 = (2.0 / 3.0) - z;
double t_1 = (-6.0 * (y - x)) * z;
double tmp;
if (t_0 <= -500000.0) {
tmp = t_1;
} else if (t_0 <= 1.0) {
tmp = fma(x, -3.0, (4.0 * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(2.0 / 3.0) - z) t_1 = Float64(Float64(-6.0 * Float64(y - x)) * z) tmp = 0.0 if (t_0 <= -500000.0) tmp = t_1; elseif (t_0 <= 1.0) tmp = fma(x, -3.0, Float64(4.0 * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$0, -500000.0], t$95$1, If[LessEqual[t$95$0, 1.0], N[(x * -3.0 + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{3} - z\\
t_1 := \left(-6 \cdot \left(y - x\right)\right) \cdot z\\
\mathbf{if}\;t\_0 \leq -500000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(x, -3, 4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < -5e5 or 1 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.3
Applied rewrites98.3%
lift-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identity98.3
Applied rewrites98.3%
if -5e5 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 1Initial program 99.3%
Taylor expanded in z around 0
Applied rewrites96.9%
lift--.f64N/A
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
distribute-lft-out--N/A
metadata-evalN/A
associate--l+N/A
distribute-rgt1-inN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6497.0
Applied rewrites97.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (fma -6.0 z 4.0) y))) (if (<= y -9e+57) t_0 (if (<= y 7e-11) (* (fma z 6.0 -3.0) x) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(-6.0, z, 4.0) * y;
double tmp;
if (y <= -9e+57) {
tmp = t_0;
} else if (y <= 7e-11) {
tmp = fma(z, 6.0, -3.0) * x;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(fma(-6.0, z, 4.0) * y) tmp = 0.0 if (y <= -9e+57) tmp = t_0; elseif (y <= 7e-11) tmp = Float64(fma(z, 6.0, -3.0) * x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-6.0 * z + 4.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -9e+57], t$95$0, If[LessEqual[y, 7e-11], N[(N[(z * 6.0 + -3.0), $MachinePrecision] * x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-6, z, 4\right) \cdot y\\
\mathbf{if}\;y \leq -9 \cdot 10^{+57}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(z, 6, -3\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -8.99999999999999991e57 or 7.00000000000000038e-11 < y Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites78.8%
if -8.99999999999999991e57 < y < 7.00000000000000038e-11Initial program 99.5%
Taylor expanded in x around inf
Applied rewrites72.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (/ 2.0 3.0) z)) (t_1 (* (fma -6.0 z 4.0) y)))
(if (<= t_0 0.666666666664)
t_1
(if (<= t_0 1.0)
(fma (- x y) -4.0 x)
(if (<= t_0 5e+252) (* (* z 6.0) x) t_1)))))
double code(double x, double y, double z) {
double t_0 = (2.0 / 3.0) - z;
double t_1 = fma(-6.0, z, 4.0) * y;
double tmp;
if (t_0 <= 0.666666666664) {
tmp = t_1;
} else if (t_0 <= 1.0) {
tmp = fma((x - y), -4.0, x);
} else if (t_0 <= 5e+252) {
tmp = (z * 6.0) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(2.0 / 3.0) - z) t_1 = Float64(fma(-6.0, z, 4.0) * y) tmp = 0.0 if (t_0 <= 0.666666666664) tmp = t_1; elseif (t_0 <= 1.0) tmp = fma(Float64(x - y), -4.0, x); elseif (t_0 <= 5e+252) tmp = Float64(Float64(z * 6.0) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-6.0 * z + 4.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$0, 0.666666666664], t$95$1, If[LessEqual[t$95$0, 1.0], N[(N[(x - y), $MachinePrecision] * -4.0 + x), $MachinePrecision], If[LessEqual[t$95$0, 5e+252], N[(N[(z * 6.0), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{3} - z\\
t_1 := \mathsf{fma}\left(-6, z, 4\right) \cdot y\\
\mathbf{if}\;t\_0 \leq 0.666666666664:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(x - y, -4, x\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+252}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 0.66666666666399998 or 4.9999999999999997e252 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites53.5%
if 0.66666666666399998 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 1Initial program 99.3%
Taylor expanded in z around 0
Applied rewrites98.7%
if 1 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 4.9999999999999997e252Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in x around inf
*-commutativeN/A
metadata-evalN/A
associate-+l-N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
associate-+l-N/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites50.6%
Taylor expanded in z around inf
*-commutativeN/A
*-rgt-identityN/A
lower-*.f64N/A
*-rgt-identity49.4
Applied rewrites49.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (/ 2.0 3.0) z)))
(if (<= t_0 -500000.0)
(* (* 6.0 x) z)
(if (<= t_0 1.0)
(fma (- x y) -4.0 x)
(if (<= t_0 5e+252) (* (* z 6.0) x) (* (* y -6.0) z))))))
double code(double x, double y, double z) {
double t_0 = (2.0 / 3.0) - z;
double tmp;
if (t_0 <= -500000.0) {
tmp = (6.0 * x) * z;
} else if (t_0 <= 1.0) {
tmp = fma((x - y), -4.0, x);
} else if (t_0 <= 5e+252) {
tmp = (z * 6.0) * x;
} else {
tmp = (y * -6.0) * z;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(2.0 / 3.0) - z) tmp = 0.0 if (t_0 <= -500000.0) tmp = Float64(Float64(6.0 * x) * z); elseif (t_0 <= 1.0) tmp = fma(Float64(x - y), -4.0, x); elseif (t_0 <= 5e+252) tmp = Float64(Float64(z * 6.0) * x); else tmp = Float64(Float64(y * -6.0) * z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, -500000.0], N[(N[(6.0 * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[(N[(x - y), $MachinePrecision] * -4.0 + x), $MachinePrecision], If[LessEqual[t$95$0, 5e+252], N[(N[(z * 6.0), $MachinePrecision] * x), $MachinePrecision], N[(N[(y * -6.0), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{3} - z\\
\mathbf{if}\;t\_0 \leq -500000:\\
\;\;\;\;\left(6 \cdot x\right) \cdot z\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(x - y, -4, x\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+252}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot -6\right) \cdot z\\
\end{array}
\end{array}
if (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < -5e5Initial program 99.8%
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
metadata-evalN/A
associate-+l-N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
associate-+l-N/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites52.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-rgt-identityN/A
lower-*.f64N/A
*-rgt-identity52.4
Applied rewrites52.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identity52.4
Applied rewrites52.4%
if -5e5 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 1Initial program 99.3%
Taylor expanded in z around 0
Applied rewrites96.9%
if 1 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 4.9999999999999997e252Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in x around inf
*-commutativeN/A
metadata-evalN/A
associate-+l-N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
associate-+l-N/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites50.6%
Taylor expanded in z around inf
*-commutativeN/A
*-rgt-identityN/A
lower-*.f64N/A
*-rgt-identity49.4
Applied rewrites49.4%
if 4.9999999999999997e252 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-*.f64N/A
lower-*.f64N/A
*-rgt-identity58.6
Applied rewrites58.6%
(FPCore (x y z)
:precision binary64
(if (<= z -7e+252)
(* (* y -6.0) z)
(if (<= z -6.6e-7)
(* (* z 6.0) x)
(if (<= z 2.6e-130)
(* 4.0 y)
(if (<= z 5.2e+16) (* -3.0 x) (* (* 6.0 x) z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7e+252) {
tmp = (y * -6.0) * z;
} else if (z <= -6.6e-7) {
tmp = (z * 6.0) * x;
} else if (z <= 2.6e-130) {
tmp = 4.0 * y;
} else if (z <= 5.2e+16) {
tmp = -3.0 * x;
} else {
tmp = (6.0 * x) * 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 <= (-7d+252)) then
tmp = (y * (-6.0d0)) * z
else if (z <= (-6.6d-7)) then
tmp = (z * 6.0d0) * x
else if (z <= 2.6d-130) then
tmp = 4.0d0 * y
else if (z <= 5.2d+16) then
tmp = (-3.0d0) * x
else
tmp = (6.0d0 * x) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7e+252) {
tmp = (y * -6.0) * z;
} else if (z <= -6.6e-7) {
tmp = (z * 6.0) * x;
} else if (z <= 2.6e-130) {
tmp = 4.0 * y;
} else if (z <= 5.2e+16) {
tmp = -3.0 * x;
} else {
tmp = (6.0 * x) * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7e+252: tmp = (y * -6.0) * z elif z <= -6.6e-7: tmp = (z * 6.0) * x elif z <= 2.6e-130: tmp = 4.0 * y elif z <= 5.2e+16: tmp = -3.0 * x else: tmp = (6.0 * x) * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7e+252) tmp = Float64(Float64(y * -6.0) * z); elseif (z <= -6.6e-7) tmp = Float64(Float64(z * 6.0) * x); elseif (z <= 2.6e-130) tmp = Float64(4.0 * y); elseif (z <= 5.2e+16) tmp = Float64(-3.0 * x); else tmp = Float64(Float64(6.0 * x) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7e+252) tmp = (y * -6.0) * z; elseif (z <= -6.6e-7) tmp = (z * 6.0) * x; elseif (z <= 2.6e-130) tmp = 4.0 * y; elseif (z <= 5.2e+16) tmp = -3.0 * x; else tmp = (6.0 * x) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7e+252], N[(N[(y * -6.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, -6.6e-7], N[(N[(z * 6.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 2.6e-130], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 5.2e+16], N[(-3.0 * x), $MachinePrecision], N[(N[(6.0 * x), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+252}:\\
\;\;\;\;\left(y \cdot -6\right) \cdot z\\
\mathbf{elif}\;z \leq -6.6 \cdot 10^{-7}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot x\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-130}:\\
\;\;\;\;4 \cdot y\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+16}:\\
\;\;\;\;-3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(6 \cdot x\right) \cdot z\\
\end{array}
\end{array}
if z < -6.9999999999999999e252Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-*.f64N/A
lower-*.f64N/A
*-rgt-identity58.6
Applied rewrites58.6%
if -6.9999999999999999e252 < z < -6.6000000000000003e-7Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in x around inf
*-commutativeN/A
metadata-evalN/A
associate-+l-N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
associate-+l-N/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites50.7%
Taylor expanded in z around inf
*-commutativeN/A
*-rgt-identityN/A
lower-*.f64N/A
*-rgt-identity48.5
Applied rewrites48.5%
if -6.6000000000000003e-7 < z < 2.6000000000000001e-130Initial program 99.3%
Taylor expanded in z around 0
Applied rewrites99.2%
Taylor expanded in x around 0
lower-*.f6449.7
Applied rewrites49.7%
if 2.6000000000000001e-130 < z < 5.2e16Initial program 99.2%
Taylor expanded in z around 0
Applied rewrites84.4%
Taylor expanded in x around inf
lower-*.f6440.6
Applied rewrites40.6%
if 5.2e16 < z Initial program 99.8%
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
metadata-evalN/A
associate-+l-N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
associate-+l-N/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites52.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-rgt-identityN/A
lower-*.f64N/A
*-rgt-identity52.6
Applied rewrites52.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identity52.7
Applied rewrites52.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* 6.0 x) z)))
(if (<= z -7e+252)
(* (* y -6.0) z)
(if (<= z -6.6e-7)
t_0
(if (<= z 2.6e-130) (* 4.0 y) (if (<= z 5.2e+16) (* -3.0 x) t_0))))))
double code(double x, double y, double z) {
double t_0 = (6.0 * x) * z;
double tmp;
if (z <= -7e+252) {
tmp = (y * -6.0) * z;
} else if (z <= -6.6e-7) {
tmp = t_0;
} else if (z <= 2.6e-130) {
tmp = 4.0 * y;
} else if (z <= 5.2e+16) {
tmp = -3.0 * x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (6.0d0 * x) * z
if (z <= (-7d+252)) then
tmp = (y * (-6.0d0)) * z
else if (z <= (-6.6d-7)) then
tmp = t_0
else if (z <= 2.6d-130) then
tmp = 4.0d0 * y
else if (z <= 5.2d+16) then
tmp = (-3.0d0) * x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (6.0 * x) * z;
double tmp;
if (z <= -7e+252) {
tmp = (y * -6.0) * z;
} else if (z <= -6.6e-7) {
tmp = t_0;
} else if (z <= 2.6e-130) {
tmp = 4.0 * y;
} else if (z <= 5.2e+16) {
tmp = -3.0 * x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (6.0 * x) * z tmp = 0 if z <= -7e+252: tmp = (y * -6.0) * z elif z <= -6.6e-7: tmp = t_0 elif z <= 2.6e-130: tmp = 4.0 * y elif z <= 5.2e+16: tmp = -3.0 * x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(6.0 * x) * z) tmp = 0.0 if (z <= -7e+252) tmp = Float64(Float64(y * -6.0) * z); elseif (z <= -6.6e-7) tmp = t_0; elseif (z <= 2.6e-130) tmp = Float64(4.0 * y); elseif (z <= 5.2e+16) tmp = Float64(-3.0 * x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (6.0 * x) * z; tmp = 0.0; if (z <= -7e+252) tmp = (y * -6.0) * z; elseif (z <= -6.6e-7) tmp = t_0; elseif (z <= 2.6e-130) tmp = 4.0 * y; elseif (z <= 5.2e+16) tmp = -3.0 * x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(6.0 * x), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -7e+252], N[(N[(y * -6.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, -6.6e-7], t$95$0, If[LessEqual[z, 2.6e-130], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 5.2e+16], N[(-3.0 * x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(6 \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -7 \cdot 10^{+252}:\\
\;\;\;\;\left(y \cdot -6\right) \cdot z\\
\mathbf{elif}\;z \leq -6.6 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-130}:\\
\;\;\;\;4 \cdot y\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+16}:\\
\;\;\;\;-3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.9999999999999999e252Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-*.f64N/A
lower-*.f64N/A
*-rgt-identity58.6
Applied rewrites58.6%
if -6.9999999999999999e252 < z < -6.6000000000000003e-7 or 5.2e16 < z Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in x around inf
*-commutativeN/A
metadata-evalN/A
associate-+l-N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt1-inN/A
associate-+l-N/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites51.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-rgt-identityN/A
lower-*.f64N/A
*-rgt-identity50.8
Applied rewrites50.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identity50.8
Applied rewrites50.8%
if -6.6000000000000003e-7 < z < 2.6000000000000001e-130Initial program 99.3%
Taylor expanded in z around 0
Applied rewrites99.2%
Taylor expanded in x around 0
lower-*.f6449.7
Applied rewrites49.7%
if 2.6000000000000001e-130 < z < 5.2e16Initial program 99.2%
Taylor expanded in z around 0
Applied rewrites84.4%
Taylor expanded in x around inf
lower-*.f6440.6
Applied rewrites40.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z x) 6.0)))
(if (<= z -7e+252)
(* (* y -6.0) z)
(if (<= z -6.6e-7)
t_0
(if (<= z 2.6e-130) (* 4.0 y) (if (<= z 5.2e+16) (* -3.0 x) t_0))))))
double code(double x, double y, double z) {
double t_0 = (z * x) * 6.0;
double tmp;
if (z <= -7e+252) {
tmp = (y * -6.0) * z;
} else if (z <= -6.6e-7) {
tmp = t_0;
} else if (z <= 2.6e-130) {
tmp = 4.0 * y;
} else if (z <= 5.2e+16) {
tmp = -3.0 * x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (z * x) * 6.0d0
if (z <= (-7d+252)) then
tmp = (y * (-6.0d0)) * z
else if (z <= (-6.6d-7)) then
tmp = t_0
else if (z <= 2.6d-130) then
tmp = 4.0d0 * y
else if (z <= 5.2d+16) then
tmp = (-3.0d0) * x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z * x) * 6.0;
double tmp;
if (z <= -7e+252) {
tmp = (y * -6.0) * z;
} else if (z <= -6.6e-7) {
tmp = t_0;
} else if (z <= 2.6e-130) {
tmp = 4.0 * y;
} else if (z <= 5.2e+16) {
tmp = -3.0 * x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * x) * 6.0 tmp = 0 if z <= -7e+252: tmp = (y * -6.0) * z elif z <= -6.6e-7: tmp = t_0 elif z <= 2.6e-130: tmp = 4.0 * y elif z <= 5.2e+16: tmp = -3.0 * x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * x) * 6.0) tmp = 0.0 if (z <= -7e+252) tmp = Float64(Float64(y * -6.0) * z); elseif (z <= -6.6e-7) tmp = t_0; elseif (z <= 2.6e-130) tmp = Float64(4.0 * y); elseif (z <= 5.2e+16) tmp = Float64(-3.0 * x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * x) * 6.0; tmp = 0.0; if (z <= -7e+252) tmp = (y * -6.0) * z; elseif (z <= -6.6e-7) tmp = t_0; elseif (z <= 2.6e-130) tmp = 4.0 * y; elseif (z <= 5.2e+16) tmp = -3.0 * x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * x), $MachinePrecision] * 6.0), $MachinePrecision]}, If[LessEqual[z, -7e+252], N[(N[(y * -6.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, -6.6e-7], t$95$0, If[LessEqual[z, 2.6e-130], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 5.2e+16], N[(-3.0 * x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot x\right) \cdot 6\\
\mathbf{if}\;z \leq -7 \cdot 10^{+252}:\\
\;\;\;\;\left(y \cdot -6\right) \cdot z\\
\mathbf{elif}\;z \leq -6.6 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-130}:\\
\;\;\;\;4 \cdot y\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+16}:\\
\;\;\;\;-3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.9999999999999999e252Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites58.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-*.f64N/A
lower-*.f64N/A
*-rgt-identity58.6
Applied rewrites58.6%
if -6.9999999999999999e252 < z < -6.6000000000000003e-7 or 5.2e16 < z Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6497.7
Applied rewrites97.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
remove-double-negN/A
mul-1-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identity50.8
Applied rewrites50.8%
if -6.6000000000000003e-7 < z < 2.6000000000000001e-130Initial program 99.3%
Taylor expanded in z around 0
Applied rewrites99.2%
Taylor expanded in x around 0
lower-*.f6449.7
Applied rewrites49.7%
if 2.6000000000000001e-130 < z < 5.2e16Initial program 99.2%
Taylor expanded in z around 0
Applied rewrites84.4%
Taylor expanded in x around inf
lower-*.f6440.6
Applied rewrites40.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z x) 6.0)))
(if (<= z -6.6e-7)
t_0
(if (<= z 2.6e-130) (* 4.0 y) (if (<= z 5.2e+16) (* -3.0 x) t_0)))))
double code(double x, double y, double z) {
double t_0 = (z * x) * 6.0;
double tmp;
if (z <= -6.6e-7) {
tmp = t_0;
} else if (z <= 2.6e-130) {
tmp = 4.0 * y;
} else if (z <= 5.2e+16) {
tmp = -3.0 * x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (z * x) * 6.0d0
if (z <= (-6.6d-7)) then
tmp = t_0
else if (z <= 2.6d-130) then
tmp = 4.0d0 * y
else if (z <= 5.2d+16) then
tmp = (-3.0d0) * x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z * x) * 6.0;
double tmp;
if (z <= -6.6e-7) {
tmp = t_0;
} else if (z <= 2.6e-130) {
tmp = 4.0 * y;
} else if (z <= 5.2e+16) {
tmp = -3.0 * x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * x) * 6.0 tmp = 0 if z <= -6.6e-7: tmp = t_0 elif z <= 2.6e-130: tmp = 4.0 * y elif z <= 5.2e+16: tmp = -3.0 * x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * x) * 6.0) tmp = 0.0 if (z <= -6.6e-7) tmp = t_0; elseif (z <= 2.6e-130) tmp = Float64(4.0 * y); elseif (z <= 5.2e+16) tmp = Float64(-3.0 * x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * x) * 6.0; tmp = 0.0; if (z <= -6.6e-7) tmp = t_0; elseif (z <= 2.6e-130) tmp = 4.0 * y; elseif (z <= 5.2e+16) tmp = -3.0 * x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * x), $MachinePrecision] * 6.0), $MachinePrecision]}, If[LessEqual[z, -6.6e-7], t$95$0, If[LessEqual[z, 2.6e-130], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 5.2e+16], N[(-3.0 * x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot x\right) \cdot 6\\
\mathbf{if}\;z \leq -6.6 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-130}:\\
\;\;\;\;4 \cdot y\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+16}:\\
\;\;\;\;-3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.6000000000000003e-7 or 5.2e16 < z Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6497.9
Applied rewrites97.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
remove-double-negN/A
mul-1-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identity51.0
Applied rewrites51.0%
if -6.6000000000000003e-7 < z < 2.6000000000000001e-130Initial program 99.3%
Taylor expanded in z around 0
Applied rewrites99.2%
Taylor expanded in x around 0
lower-*.f6449.7
Applied rewrites49.7%
if 2.6000000000000001e-130 < z < 5.2e16Initial program 99.2%
Taylor expanded in z around 0
Applied rewrites84.4%
Taylor expanded in x around inf
lower-*.f6440.6
Applied rewrites40.6%
(FPCore (x y z) :precision binary64 (if (<= y -1.75e+75) (* 4.0 y) (if (<= y 1.35e-169) (* -3.0 x) (* 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.75e+75) {
tmp = 4.0 * y;
} else if (y <= 1.35e-169) {
tmp = -3.0 * x;
} else {
tmp = 4.0 * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.75d+75)) then
tmp = 4.0d0 * y
else if (y <= 1.35d-169) then
tmp = (-3.0d0) * x
else
tmp = 4.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.75e+75) {
tmp = 4.0 * y;
} else if (y <= 1.35e-169) {
tmp = -3.0 * x;
} else {
tmp = 4.0 * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.75e+75: tmp = 4.0 * y elif y <= 1.35e-169: tmp = -3.0 * x else: tmp = 4.0 * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.75e+75) tmp = Float64(4.0 * y); elseif (y <= 1.35e-169) tmp = Float64(-3.0 * x); else tmp = Float64(4.0 * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.75e+75) tmp = 4.0 * y; elseif (y <= 1.35e-169) tmp = -3.0 * x; else tmp = 4.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.75e+75], N[(4.0 * y), $MachinePrecision], If[LessEqual[y, 1.35e-169], N[(-3.0 * x), $MachinePrecision], N[(4.0 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{+75}:\\
\;\;\;\;4 \cdot y\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-169}:\\
\;\;\;\;-3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;4 \cdot y\\
\end{array}
\end{array}
if y < -1.7499999999999999e75 or 1.3500000000000001e-169 < y Initial program 99.5%
Taylor expanded in z around 0
Applied rewrites51.3%
Taylor expanded in x around 0
lower-*.f6435.8
Applied rewrites35.8%
if -1.7499999999999999e75 < y < 1.3500000000000001e-169Initial program 99.5%
Taylor expanded in z around 0
Applied rewrites51.9%
Taylor expanded in x around inf
lower-*.f6439.3
Applied rewrites39.3%
(FPCore (x y z) :precision binary64 (* -3.0 x))
double code(double x, double y, double z) {
return -3.0 * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (-3.0d0) * x
end function
public static double code(double x, double y, double z) {
return -3.0 * x;
}
def code(x, y, z): return -3.0 * x
function code(x, y, z) return Float64(-3.0 * x) end
function tmp = code(x, y, z) tmp = -3.0 * x; end
code[x_, y_, z_] := N[(-3.0 * x), $MachinePrecision]
\begin{array}{l}
\\
-3 \cdot x
\end{array}
Initial program 99.5%
Taylor expanded in z around 0
Applied rewrites51.6%
Taylor expanded in x around inf
lower-*.f6426.6
Applied rewrites26.6%
herbie shell --seed 2025130
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
:precision binary64
(+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))