
(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 14 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 (- y x) (fma -6.0 z 4.0) x))
double code(double x, double y, double z) {
return fma((y - x), fma(-6.0, z, 4.0), x);
}
function code(x, y, z) return fma(Float64(y - x), fma(-6.0, z, 4.0), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(-6.0 * z + 4.0), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, \mathsf{fma}\left(-6, z, 4\right), x\right)
\end{array}
Initial program 99.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lift--.f64N/A
lower-fma.f6499.8
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (if (<= z -0.56) (* (fma (- x) z (* z y)) -6.0) (if (<= z 0.5) (fma -3.0 x (* 4.0 y)) (* (* -6.0 (- y x)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.56) {
tmp = fma(-x, z, (z * y)) * -6.0;
} else if (z <= 0.5) {
tmp = fma(-3.0, x, (4.0 * y));
} else {
tmp = (-6.0 * (y - x)) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -0.56) tmp = Float64(fma(Float64(-x), z, Float64(z * y)) * -6.0); elseif (z <= 0.5) tmp = fma(-3.0, x, 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.56], N[(N[((-x) * z + N[(z * y), $MachinePrecision]), $MachinePrecision] * -6.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(-3.0 * x + 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.56:\\
\;\;\;\;\mathsf{fma}\left(-x, z, z \cdot y\right) \cdot -6\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-6 \cdot \left(y - x\right)\right) \cdot z\\
\end{array}
\end{array}
if z < -0.56000000000000005Initial 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 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6495.5
Applied rewrites95.5%
if -0.56000000000000005 < z < 0.5Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6497.8
Applied rewrites97.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6497.8
Applied rewrites97.8%
if 0.5 < 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%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f6497.7
Applied rewrites97.7%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift--.f6497.7
Applied rewrites97.7%
(FPCore (x y z) :precision binary64 (if (<= z -0.56) (* (* (- y x) z) -6.0) (if (<= z 0.5) (fma -3.0 x (* 4.0 y)) (* (* -6.0 (- y x)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.56) {
tmp = ((y - x) * z) * -6.0;
} else if (z <= 0.5) {
tmp = fma(-3.0, x, (4.0 * y));
} else {
tmp = (-6.0 * (y - x)) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -0.56) tmp = Float64(Float64(Float64(y - x) * z) * -6.0); elseif (z <= 0.5) tmp = fma(-3.0, x, 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.56], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * -6.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(-3.0 * x + 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.56:\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot -6\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-6 \cdot \left(y - x\right)\right) \cdot z\\
\end{array}
\end{array}
if z < -0.56000000000000005Initial 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%
if -0.56000000000000005 < z < 0.5Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6497.8
Applied rewrites97.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6497.8
Applied rewrites97.8%
if 0.5 < 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%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f6497.7
Applied rewrites97.7%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift--.f6497.7
Applied rewrites97.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* -6.0 (- y x)) z))) (if (<= z -0.56) t_0 (if (<= z 0.5) (fma -3.0 x (* 4.0 y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (-6.0 * (y - x)) * z;
double tmp;
if (z <= -0.56) {
tmp = t_0;
} else if (z <= 0.5) {
tmp = fma(-3.0, x, (4.0 * y));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(-6.0 * Float64(y - x)) * z) tmp = 0.0 if (z <= -0.56) tmp = t_0; elseif (z <= 0.5) tmp = fma(-3.0, x, Float64(4.0 * y)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -0.56], t$95$0, If[LessEqual[z, 0.5], N[(-3.0 * x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-6 \cdot \left(y - x\right)\right) \cdot z\\
\mathbf{if}\;z \leq -0.56:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.56000000000000005 or 0.5 < 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%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f6497.6
Applied rewrites97.6%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift--.f6497.7
Applied rewrites97.7%
if -0.56000000000000005 < z < 0.5Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6497.8
Applied rewrites97.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6497.8
Applied rewrites97.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (fma -6.0 z 4.0) y)))
(if (<= z -1e+78)
(* (- x) (* -6.0 z))
(if (<= z -1.26e-12)
t_0
(if (<= z 0.08)
(fma -3.0 x (* 4.0 y))
(if (<= z 2.9e+50) t_0 (* (* z x) 6.0)))))))
double code(double x, double y, double z) {
double t_0 = fma(-6.0, z, 4.0) * y;
double tmp;
if (z <= -1e+78) {
tmp = -x * (-6.0 * z);
} else if (z <= -1.26e-12) {
tmp = t_0;
} else if (z <= 0.08) {
tmp = fma(-3.0, x, (4.0 * y));
} else if (z <= 2.9e+50) {
tmp = t_0;
} else {
tmp = (z * x) * 6.0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(fma(-6.0, z, 4.0) * y) tmp = 0.0 if (z <= -1e+78) tmp = Float64(Float64(-x) * Float64(-6.0 * z)); elseif (z <= -1.26e-12) tmp = t_0; elseif (z <= 0.08) tmp = fma(-3.0, x, Float64(4.0 * y)); elseif (z <= 2.9e+50) tmp = t_0; else tmp = Float64(Float64(z * x) * 6.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[z, -1e+78], N[((-x) * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.26e-12], t$95$0, If[LessEqual[z, 0.08], N[(-3.0 * x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e+50], t$95$0, N[(N[(z * x), $MachinePrecision] * 6.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-6, z, 4\right) \cdot y\\
\mathbf{if}\;z \leq -1 \cdot 10^{+78}:\\
\;\;\;\;\left(-x\right) \cdot \left(-6 \cdot z\right)\\
\mathbf{elif}\;z \leq -1.26 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.08:\\
\;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+50}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot 6\\
\end{array}
\end{array}
if z < -1.00000000000000001e78Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6454.4
Applied rewrites54.4%
if -1.00000000000000001e78 < z < -1.26000000000000008e-12 or 0.0800000000000000017 < z < 2.9e50Initial program 99.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lift--.f64N/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lift-fma.f6448.9
Applied rewrites48.9%
if -1.26000000000000008e-12 < z < 0.0800000000000000017Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6498.7
Applied rewrites98.7%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6498.8
Applied rewrites98.8%
if 2.9e50 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.8
Applied rewrites52.8%
(FPCore (x y z)
:precision binary64
(if (<= z -1e+78)
(* (- x) (* -6.0 z))
(if (<= z -25500000.0)
(* (* y z) -6.0)
(if (<= z 0.66)
(fma -3.0 x (* 4.0 y))
(if (<= z 2.9e+50) (* y (* -6.0 z)) (* (* z x) 6.0))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1e+78) {
tmp = -x * (-6.0 * z);
} else if (z <= -25500000.0) {
tmp = (y * z) * -6.0;
} else if (z <= 0.66) {
tmp = fma(-3.0, x, (4.0 * y));
} else if (z <= 2.9e+50) {
tmp = y * (-6.0 * z);
} else {
tmp = (z * x) * 6.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1e+78) tmp = Float64(Float64(-x) * Float64(-6.0 * z)); elseif (z <= -25500000.0) tmp = Float64(Float64(y * z) * -6.0); elseif (z <= 0.66) tmp = fma(-3.0, x, Float64(4.0 * y)); elseif (z <= 2.9e+50) tmp = Float64(y * Float64(-6.0 * z)); else tmp = Float64(Float64(z * x) * 6.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1e+78], N[((-x) * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -25500000.0], N[(N[(y * z), $MachinePrecision] * -6.0), $MachinePrecision], If[LessEqual[z, 0.66], N[(-3.0 * x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e+50], N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * 6.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+78}:\\
\;\;\;\;\left(-x\right) \cdot \left(-6 \cdot z\right)\\
\mathbf{elif}\;z \leq -25500000:\\
\;\;\;\;\left(y \cdot z\right) \cdot -6\\
\mathbf{elif}\;z \leq 0.66:\\
\;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+50}:\\
\;\;\;\;y \cdot \left(-6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot 6\\
\end{array}
\end{array}
if z < -1.00000000000000001e78Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6454.4
Applied rewrites54.4%
if -1.00000000000000001e78 < z < -2.55e7Initial program 99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6496.5
Applied rewrites96.5%
Taylor expanded in x around 0
Applied rewrites48.0%
if -2.55e7 < z < 0.660000000000000031Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6496.8
Applied rewrites96.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6496.9
Applied rewrites96.9%
if 0.660000000000000031 < z < 2.9e50Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6486.6
Applied rewrites86.6%
Taylor expanded in x around 0
Applied rewrites41.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6441.6
Applied rewrites41.6%
if 2.9e50 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.8
Applied rewrites52.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (/ 2.0 3.0) z)))
(if (<= t_0 -1e+58)
(* (* z x) 6.0)
(if (<= t_0 -0.2)
(* y (* -6.0 z))
(if (<= t_0 50000000.0)
(fma 4.0 (- y x) x)
(if (<= t_0 1e+78) (* (* y z) -6.0) (* (- x) (* -6.0 z))))))))
double code(double x, double y, double z) {
double t_0 = (2.0 / 3.0) - z;
double tmp;
if (t_0 <= -1e+58) {
tmp = (z * x) * 6.0;
} else if (t_0 <= -0.2) {
tmp = y * (-6.0 * z);
} else if (t_0 <= 50000000.0) {
tmp = fma(4.0, (y - x), x);
} else if (t_0 <= 1e+78) {
tmp = (y * z) * -6.0;
} else {
tmp = -x * (-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 <= -1e+58) tmp = Float64(Float64(z * x) * 6.0); elseif (t_0 <= -0.2) tmp = Float64(y * Float64(-6.0 * z)); elseif (t_0 <= 50000000.0) tmp = fma(4.0, Float64(y - x), x); elseif (t_0 <= 1e+78) tmp = Float64(Float64(y * z) * -6.0); else tmp = Float64(Float64(-x) * Float64(-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, -1e+58], N[(N[(z * x), $MachinePrecision] * 6.0), $MachinePrecision], If[LessEqual[t$95$0, -0.2], N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 50000000.0], N[(4.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$0, 1e+78], N[(N[(y * z), $MachinePrecision] * -6.0), $MachinePrecision], N[((-x) * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{3} - z\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+58}:\\
\;\;\;\;\left(z \cdot x\right) \cdot 6\\
\mathbf{elif}\;t\_0 \leq -0.2:\\
\;\;\;\;y \cdot \left(-6 \cdot z\right)\\
\mathbf{elif}\;t\_0 \leq 50000000:\\
\;\;\;\;\mathsf{fma}\left(4, y - x, x\right)\\
\mathbf{elif}\;t\_0 \leq 10^{+78}:\\
\;\;\;\;\left(y \cdot z\right) \cdot -6\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \left(-6 \cdot z\right)\\
\end{array}
\end{array}
if (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < -9.99999999999999944e57Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.8
Applied rewrites52.8%
if -9.99999999999999944e57 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < -0.20000000000000001Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6488.4
Applied rewrites88.4%
Taylor expanded in x around 0
Applied rewrites42.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6442.9
Applied rewrites42.9%
if -0.20000000000000001 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 5e7Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6496.8
Applied rewrites96.8%
if 5e7 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 1.00000000000000001e78Initial program 99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6496.6
Applied rewrites96.6%
Taylor expanded in x around 0
Applied rewrites48.2%
if 1.00000000000000001e78 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6454.4
Applied rewrites54.4%
(FPCore (x y z)
:precision binary64
(if (<= z -1e+78)
(* (- x) (* -6.0 z))
(if (<= z -0.6)
(* (* y z) -6.0)
(if (<= z 0.66)
(* 4.0 y)
(if (<= z 2.9e+50) (* y (* -6.0 z)) (* (* z x) 6.0))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1e+78) {
tmp = -x * (-6.0 * z);
} else if (z <= -0.6) {
tmp = (y * z) * -6.0;
} else if (z <= 0.66) {
tmp = 4.0 * y;
} else if (z <= 2.9e+50) {
tmp = y * (-6.0 * z);
} else {
tmp = (z * x) * 6.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 (z <= (-1d+78)) then
tmp = -x * ((-6.0d0) * z)
else if (z <= (-0.6d0)) then
tmp = (y * z) * (-6.0d0)
else if (z <= 0.66d0) then
tmp = 4.0d0 * y
else if (z <= 2.9d+50) then
tmp = y * ((-6.0d0) * z)
else
tmp = (z * x) * 6.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1e+78) {
tmp = -x * (-6.0 * z);
} else if (z <= -0.6) {
tmp = (y * z) * -6.0;
} else if (z <= 0.66) {
tmp = 4.0 * y;
} else if (z <= 2.9e+50) {
tmp = y * (-6.0 * z);
} else {
tmp = (z * x) * 6.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1e+78: tmp = -x * (-6.0 * z) elif z <= -0.6: tmp = (y * z) * -6.0 elif z <= 0.66: tmp = 4.0 * y elif z <= 2.9e+50: tmp = y * (-6.0 * z) else: tmp = (z * x) * 6.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1e+78) tmp = Float64(Float64(-x) * Float64(-6.0 * z)); elseif (z <= -0.6) tmp = Float64(Float64(y * z) * -6.0); elseif (z <= 0.66) tmp = Float64(4.0 * y); elseif (z <= 2.9e+50) tmp = Float64(y * Float64(-6.0 * z)); else tmp = Float64(Float64(z * x) * 6.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1e+78) tmp = -x * (-6.0 * z); elseif (z <= -0.6) tmp = (y * z) * -6.0; elseif (z <= 0.66) tmp = 4.0 * y; elseif (z <= 2.9e+50) tmp = y * (-6.0 * z); else tmp = (z * x) * 6.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1e+78], N[((-x) * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -0.6], N[(N[(y * z), $MachinePrecision] * -6.0), $MachinePrecision], If[LessEqual[z, 0.66], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 2.9e+50], N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * 6.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+78}:\\
\;\;\;\;\left(-x\right) \cdot \left(-6 \cdot z\right)\\
\mathbf{elif}\;z \leq -0.6:\\
\;\;\;\;\left(y \cdot z\right) \cdot -6\\
\mathbf{elif}\;z \leq 0.66:\\
\;\;\;\;4 \cdot y\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+50}:\\
\;\;\;\;y \cdot \left(-6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot 6\\
\end{array}
\end{array}
if z < -1.00000000000000001e78Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6454.4
Applied rewrites54.4%
if -1.00000000000000001e78 < z < -0.599999999999999978Initial program 99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6491.0
Applied rewrites91.0%
Taylor expanded in x around 0
Applied rewrites45.4%
if -0.599999999999999978 < z < 0.660000000000000031Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6497.8
Applied rewrites97.8%
Taylor expanded in x around 0
lower-*.f6450.4
Applied rewrites50.4%
if 0.660000000000000031 < z < 2.9e50Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6486.6
Applied rewrites86.6%
Taylor expanded in x around 0
Applied rewrites41.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6441.6
Applied rewrites41.6%
if 2.9e50 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.8
Applied rewrites52.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z x) 6.0)))
(if (<= z -1e+78)
t_0
(if (<= z -0.6)
(* (* y z) -6.0)
(if (<= z 0.66) (* 4.0 y) (if (<= z 2.9e+50) (* y (* -6.0 z)) t_0))))))
double code(double x, double y, double z) {
double t_0 = (z * x) * 6.0;
double tmp;
if (z <= -1e+78) {
tmp = t_0;
} else if (z <= -0.6) {
tmp = (y * z) * -6.0;
} else if (z <= 0.66) {
tmp = 4.0 * y;
} else if (z <= 2.9e+50) {
tmp = y * (-6.0 * z);
} 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 <= (-1d+78)) then
tmp = t_0
else if (z <= (-0.6d0)) then
tmp = (y * z) * (-6.0d0)
else if (z <= 0.66d0) then
tmp = 4.0d0 * y
else if (z <= 2.9d+50) then
tmp = y * ((-6.0d0) * z)
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 <= -1e+78) {
tmp = t_0;
} else if (z <= -0.6) {
tmp = (y * z) * -6.0;
} else if (z <= 0.66) {
tmp = 4.0 * y;
} else if (z <= 2.9e+50) {
tmp = y * (-6.0 * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * x) * 6.0 tmp = 0 if z <= -1e+78: tmp = t_0 elif z <= -0.6: tmp = (y * z) * -6.0 elif z <= 0.66: tmp = 4.0 * y elif z <= 2.9e+50: tmp = y * (-6.0 * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * x) * 6.0) tmp = 0.0 if (z <= -1e+78) tmp = t_0; elseif (z <= -0.6) tmp = Float64(Float64(y * z) * -6.0); elseif (z <= 0.66) tmp = Float64(4.0 * y); elseif (z <= 2.9e+50) tmp = Float64(y * Float64(-6.0 * z)); 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 <= -1e+78) tmp = t_0; elseif (z <= -0.6) tmp = (y * z) * -6.0; elseif (z <= 0.66) tmp = 4.0 * y; elseif (z <= 2.9e+50) tmp = y * (-6.0 * z); 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, -1e+78], t$95$0, If[LessEqual[z, -0.6], N[(N[(y * z), $MachinePrecision] * -6.0), $MachinePrecision], If[LessEqual[z, 0.66], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 2.9e+50], N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot x\right) \cdot 6\\
\mathbf{if}\;z \leq -1 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -0.6:\\
\;\;\;\;\left(y \cdot z\right) \cdot -6\\
\mathbf{elif}\;z \leq 0.66:\\
\;\;\;\;4 \cdot y\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+50}:\\
\;\;\;\;y \cdot \left(-6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.00000000000000001e78 or 2.9e50 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.5
Applied rewrites53.5%
if -1.00000000000000001e78 < z < -0.599999999999999978Initial program 99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6491.0
Applied rewrites91.0%
Taylor expanded in x around 0
Applied rewrites45.4%
if -0.599999999999999978 < z < 0.660000000000000031Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6497.8
Applied rewrites97.8%
Taylor expanded in x around 0
lower-*.f6450.4
Applied rewrites50.4%
if 0.660000000000000031 < z < 2.9e50Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6486.6
Applied rewrites86.6%
Taylor expanded in x around 0
Applied rewrites41.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6441.6
Applied rewrites41.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z x) 6.0)) (t_1 (* y (* -6.0 z))))
(if (<= z -1e+78)
t_0
(if (<= z -0.6)
t_1
(if (<= z 0.66) (* 4.0 y) (if (<= z 2.9e+50) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = (z * x) * 6.0;
double t_1 = y * (-6.0 * z);
double tmp;
if (z <= -1e+78) {
tmp = t_0;
} else if (z <= -0.6) {
tmp = t_1;
} else if (z <= 0.66) {
tmp = 4.0 * y;
} else if (z <= 2.9e+50) {
tmp = t_1;
} 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 = (z * x) * 6.0d0
t_1 = y * ((-6.0d0) * z)
if (z <= (-1d+78)) then
tmp = t_0
else if (z <= (-0.6d0)) then
tmp = t_1
else if (z <= 0.66d0) then
tmp = 4.0d0 * y
else if (z <= 2.9d+50) then
tmp = t_1
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 t_1 = y * (-6.0 * z);
double tmp;
if (z <= -1e+78) {
tmp = t_0;
} else if (z <= -0.6) {
tmp = t_1;
} else if (z <= 0.66) {
tmp = 4.0 * y;
} else if (z <= 2.9e+50) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * x) * 6.0 t_1 = y * (-6.0 * z) tmp = 0 if z <= -1e+78: tmp = t_0 elif z <= -0.6: tmp = t_1 elif z <= 0.66: tmp = 4.0 * y elif z <= 2.9e+50: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * x) * 6.0) t_1 = Float64(y * Float64(-6.0 * z)) tmp = 0.0 if (z <= -1e+78) tmp = t_0; elseif (z <= -0.6) tmp = t_1; elseif (z <= 0.66) tmp = Float64(4.0 * y); elseif (z <= 2.9e+50) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * x) * 6.0; t_1 = y * (-6.0 * z); tmp = 0.0; if (z <= -1e+78) tmp = t_0; elseif (z <= -0.6) tmp = t_1; elseif (z <= 0.66) tmp = 4.0 * y; elseif (z <= 2.9e+50) tmp = t_1; 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]}, Block[{t$95$1 = N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e+78], t$95$0, If[LessEqual[z, -0.6], t$95$1, If[LessEqual[z, 0.66], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 2.9e+50], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot x\right) \cdot 6\\
t_1 := y \cdot \left(-6 \cdot z\right)\\
\mathbf{if}\;z \leq -1 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -0.6:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.66:\\
\;\;\;\;4 \cdot y\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.00000000000000001e78 or 2.9e50 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.5
Applied rewrites53.5%
if -1.00000000000000001e78 < z < -0.599999999999999978 or 0.660000000000000031 < z < 2.9e50Initial program 99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6489.3
Applied rewrites89.3%
Taylor expanded in x around 0
Applied rewrites43.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6443.8
Applied rewrites43.8%
if -0.599999999999999978 < z < 0.660000000000000031Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6497.8
Applied rewrites97.8%
Taylor expanded in x around 0
lower-*.f6450.4
Applied rewrites50.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* z x) 6.0))) (if (<= z -0.145) t_0 (if (<= z 0.5) (* 4.0 y) t_0))))
double code(double x, double y, double z) {
double t_0 = (z * x) * 6.0;
double tmp;
if (z <= -0.145) {
tmp = t_0;
} else if (z <= 0.5) {
tmp = 4.0 * y;
} 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 <= (-0.145d0)) then
tmp = t_0
else if (z <= 0.5d0) then
tmp = 4.0d0 * y
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 <= -0.145) {
tmp = t_0;
} else if (z <= 0.5) {
tmp = 4.0 * y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * x) * 6.0 tmp = 0 if z <= -0.145: tmp = t_0 elif z <= 0.5: tmp = 4.0 * y else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * x) * 6.0) tmp = 0.0 if (z <= -0.145) tmp = t_0; elseif (z <= 0.5) tmp = Float64(4.0 * y); 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 <= -0.145) tmp = t_0; elseif (z <= 0.5) tmp = 4.0 * y; 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, -0.145], t$95$0, If[LessEqual[z, 0.5], N[(4.0 * y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot x\right) \cdot 6\\
\mathbf{if}\;z \leq -0.145:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;4 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.14499999999999999 or 0.5 < 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
*-commutativeN/A
lower-*.f6452.2
Applied rewrites52.2%
if -0.14499999999999999 < z < 0.5Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6497.8
Applied rewrites97.8%
Taylor expanded in x around 0
lower-*.f6450.4
Applied rewrites50.4%
(FPCore (x y z) :precision binary64 (if (<= x -1.1e-23) (* -3.0 x) (if (<= x 3.6e-31) (fma 4.0 y x) (* -3.0 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.1e-23) {
tmp = -3.0 * x;
} else if (x <= 3.6e-31) {
tmp = fma(4.0, y, x);
} else {
tmp = -3.0 * x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -1.1e-23) tmp = Float64(-3.0 * x); elseif (x <= 3.6e-31) tmp = fma(4.0, y, x); else tmp = Float64(-3.0 * x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -1.1e-23], N[(-3.0 * x), $MachinePrecision], If[LessEqual[x, 3.6e-31], N[(4.0 * y + x), $MachinePrecision], N[(-3.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-23}:\\
\;\;\;\;-3 \cdot x\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(4, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;-3 \cdot x\\
\end{array}
\end{array}
if x < -1.1e-23 or 3.60000000000000004e-31 < x Initial program 99.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6449.8
Applied rewrites49.8%
Taylor expanded in x around inf
lower-*.f6435.9
Applied rewrites35.9%
if -1.1e-23 < x < 3.60000000000000004e-31Initial program 99.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6450.5
Applied rewrites50.5%
Taylor expanded in x around 0
Applied rewrites39.2%
(FPCore (x y z) :precision binary64 (if (<= x -1.62e-59) (* -3.0 x) (if (<= x 3.6e-31) (* 4.0 y) (* -3.0 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.62e-59) {
tmp = -3.0 * x;
} else if (x <= 3.6e-31) {
tmp = 4.0 * y;
} else {
tmp = -3.0 * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.62d-59)) then
tmp = (-3.0d0) * x
else if (x <= 3.6d-31) then
tmp = 4.0d0 * y
else
tmp = (-3.0d0) * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.62e-59) {
tmp = -3.0 * x;
} else if (x <= 3.6e-31) {
tmp = 4.0 * y;
} else {
tmp = -3.0 * x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.62e-59: tmp = -3.0 * x elif x <= 3.6e-31: tmp = 4.0 * y else: tmp = -3.0 * x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.62e-59) tmp = Float64(-3.0 * x); elseif (x <= 3.6e-31) tmp = Float64(4.0 * y); else tmp = Float64(-3.0 * x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.62e-59) tmp = -3.0 * x; elseif (x <= 3.6e-31) tmp = 4.0 * y; else tmp = -3.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.62e-59], N[(-3.0 * x), $MachinePrecision], If[LessEqual[x, 3.6e-31], N[(4.0 * y), $MachinePrecision], N[(-3.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.62 \cdot 10^{-59}:\\
\;\;\;\;-3 \cdot x\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-31}:\\
\;\;\;\;4 \cdot y\\
\mathbf{else}:\\
\;\;\;\;-3 \cdot x\\
\end{array}
\end{array}
if x < -1.61999999999999989e-59 or 3.60000000000000004e-31 < x Initial program 99.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6449.7
Applied rewrites49.7%
Taylor expanded in x around inf
lower-*.f6435.3
Applied rewrites35.3%
if -1.61999999999999989e-59 < x < 3.60000000000000004e-31Initial program 99.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f6450.6
Applied rewrites50.6%
Taylor expanded in x around 0
lower-*.f6440.2
Applied rewrites40.2%
(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
+-commutativeN/A
lower-fma.f64N/A
lift--.f6450.1
Applied rewrites50.1%
Taylor expanded in x around inf
lower-*.f6425.5
Applied rewrites25.5%
herbie shell --seed 2025114
(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))))