
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.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) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.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) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (fma (* (- y x) z) 6.0 x))
double code(double x, double y, double z) {
return fma(((y - x) * z), 6.0, x);
}
function code(x, y, z) return fma(Float64(Float64(y - x) * z), 6.0, x) end
code[x_, y_, z_] := N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)
\end{array}
Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (fma (* (- y x) 6.0) z x))
double code(double x, double y, double z) {
return fma(((y - x) * 6.0), z, x);
}
function code(x, y, z) return fma(Float64(Float64(y - x) * 6.0), z, x) end
code[x_, y_, z_] := N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(y - x\right) \cdot 6, z, x\right)
\end{array}
Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
(FPCore (x y z) :precision binary64 (if (<= z -0.16) (* (* (- y x) z) 6.0) (if (<= z 0.17) (fma (* y 6.0) z x) (* (* (- y x) 6.0) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.16) {
tmp = ((y - x) * z) * 6.0;
} else if (z <= 0.17) {
tmp = fma((y * 6.0), z, x);
} else {
tmp = ((y - x) * 6.0) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -0.16) tmp = Float64(Float64(Float64(y - x) * z) * 6.0); elseif (z <= 0.17) tmp = fma(Float64(y * 6.0), z, x); else tmp = Float64(Float64(Float64(y - x) * 6.0) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -0.16], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision], If[LessEqual[z, 0.17], N[(N[(y * 6.0), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.16:\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot 6\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 6, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\
\end{array}
\end{array}
if z < -0.160000000000000003Initial program 99.7%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.7
Applied rewrites99.7%
Taylor expanded in z around inf
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f6498.8
Applied rewrites98.8%
if -0.160000000000000003 < z < 0.170000000000000012Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites98.7%
if 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f6498.6
Applied rewrites98.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* (- y x) 6.0) z))) (if (<= z -0.17) t_0 (if (<= z 0.17) (fma (* y 6.0) z x) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y - x) * 6.0) * z;
double tmp;
if (z <= -0.17) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = fma((y * 6.0), z, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(y - x) * 6.0) * z) tmp = 0.0 if (z <= -0.17) tmp = t_0; elseif (z <= 0.17) tmp = fma(Float64(y * 6.0), z, x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -0.17], t$95$0, If[LessEqual[z, 0.17], N[(N[(y * 6.0), $MachinePrecision] * z + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y - x\right) \cdot 6\right) \cdot z\\
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 6, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f6498.7
Applied rewrites98.7%
if -0.170000000000000012 < z < 0.170000000000000012Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites98.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (* y z) 6.0 x))) (if (<= y -2.05e-104) t_0 (if (<= y 1.35e-18) (fma (* -6.0 x) z x) t_0))))
double code(double x, double y, double z) {
double t_0 = fma((y * z), 6.0, x);
double tmp;
if (y <= -2.05e-104) {
tmp = t_0;
} else if (y <= 1.35e-18) {
tmp = fma((-6.0 * x), z, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(Float64(y * z), 6.0, x) tmp = 0.0 if (y <= -2.05e-104) tmp = t_0; elseif (y <= 1.35e-18) tmp = fma(Float64(-6.0 * x), z, x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y * z), $MachinePrecision] * 6.0 + x), $MachinePrecision]}, If[LessEqual[y, -2.05e-104], t$95$0, If[LessEqual[y, 1.35e-18], N[(N[(-6.0 * x), $MachinePrecision] * z + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y \cdot z, 6, x\right)\\
\mathbf{if}\;y \leq -2.05 \cdot 10^{-104}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(-6 \cdot x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.04999999999999992e-104 or 1.34999999999999994e-18 < y Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites85.9%
if -2.04999999999999992e-104 < y < 1.34999999999999994e-18Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-*.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
lower-*.f6486.8
Applied rewrites86.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (* y 6.0) z x))) (if (<= y -2.05e-104) t_0 (if (<= y 1.35e-18) (fma (* -6.0 x) z x) t_0))))
double code(double x, double y, double z) {
double t_0 = fma((y * 6.0), z, x);
double tmp;
if (y <= -2.05e-104) {
tmp = t_0;
} else if (y <= 1.35e-18) {
tmp = fma((-6.0 * x), z, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(Float64(y * 6.0), z, x) tmp = 0.0 if (y <= -2.05e-104) tmp = t_0; elseif (y <= 1.35e-18) tmp = fma(Float64(-6.0 * x), z, x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y * 6.0), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[y, -2.05e-104], t$95$0, If[LessEqual[y, 1.35e-18], N[(N[(-6.0 * x), $MachinePrecision] * z + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y \cdot 6, z, x\right)\\
\mathbf{if}\;y \leq -2.05 \cdot 10^{-104}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(-6 \cdot x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.04999999999999992e-104 or 1.34999999999999994e-18 < y Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites85.8%
if -2.04999999999999992e-104 < y < 1.34999999999999994e-18Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-*.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
lower-*.f6486.8
Applied rewrites86.8%
(FPCore (x y z) :precision binary64 (if (<= y -4.7e+88) (* (* z y) 6.0) (if (<= y 4.1e+45) (fma (* -6.0 x) z x) (* (* 6.0 z) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.7e+88) {
tmp = (z * y) * 6.0;
} else if (y <= 4.1e+45) {
tmp = fma((-6.0 * x), z, x);
} else {
tmp = (6.0 * z) * y;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -4.7e+88) tmp = Float64(Float64(z * y) * 6.0); elseif (y <= 4.1e+45) tmp = fma(Float64(-6.0 * x), z, x); else tmp = Float64(Float64(6.0 * z) * y); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -4.7e+88], N[(N[(z * y), $MachinePrecision] * 6.0), $MachinePrecision], If[LessEqual[y, 4.1e+45], N[(N[(-6.0 * x), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(6.0 * z), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{+88}:\\
\;\;\;\;\left(z \cdot y\right) \cdot 6\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+45}:\\
\;\;\;\;\mathsf{fma}\left(-6 \cdot x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(6 \cdot z\right) \cdot y\\
\end{array}
\end{array}
if y < -4.70000000000000007e88Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.5
Applied rewrites71.5%
if -4.70000000000000007e88 < y < 4.10000000000000012e45Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lift-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around inf
lower-*.f6478.4
Applied rewrites78.4%
if 4.10000000000000012e45 < y Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.4
Applied rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6467.5
Applied rewrites67.5%
(FPCore (x y z) :precision binary64 (if (<= y -4.7e+88) (* (* z y) 6.0) (if (<= y 4.1e+45) (* (fma -6.0 z 1.0) x) (* (* 6.0 z) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.7e+88) {
tmp = (z * y) * 6.0;
} else if (y <= 4.1e+45) {
tmp = fma(-6.0, z, 1.0) * x;
} else {
tmp = (6.0 * z) * y;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -4.7e+88) tmp = Float64(Float64(z * y) * 6.0); elseif (y <= 4.1e+45) tmp = Float64(fma(-6.0, z, 1.0) * x); else tmp = Float64(Float64(6.0 * z) * y); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -4.7e+88], N[(N[(z * y), $MachinePrecision] * 6.0), $MachinePrecision], If[LessEqual[y, 4.1e+45], N[(N[(-6.0 * z + 1.0), $MachinePrecision] * x), $MachinePrecision], N[(N[(6.0 * z), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{+88}:\\
\;\;\;\;\left(z \cdot y\right) \cdot 6\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+45}:\\
\;\;\;\;\mathsf{fma}\left(-6, z, 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(6 \cdot z\right) \cdot y\\
\end{array}
\end{array}
if y < -4.70000000000000007e88Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.5
Applied rewrites71.5%
if -4.70000000000000007e88 < y < 4.10000000000000012e45Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6478.4
Applied rewrites78.4%
if 4.10000000000000012e45 < y Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.4
Applied rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6467.5
Applied rewrites67.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* -6.0 x) z)))
(if (<= z -1.35e+78)
t_0
(if (<= z -2.85e-24)
(* (* z y) 6.0)
(if (<= z 1.65e-51) x (if (<= z 3.9e+54) (* (* 6.0 z) y) t_0))))))
double code(double x, double y, double z) {
double t_0 = (-6.0 * x) * z;
double tmp;
if (z <= -1.35e+78) {
tmp = t_0;
} else if (z <= -2.85e-24) {
tmp = (z * y) * 6.0;
} else if (z <= 1.65e-51) {
tmp = x;
} else if (z <= 3.9e+54) {
tmp = (6.0 * z) * 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 = ((-6.0d0) * x) * z
if (z <= (-1.35d+78)) then
tmp = t_0
else if (z <= (-2.85d-24)) then
tmp = (z * y) * 6.0d0
else if (z <= 1.65d-51) then
tmp = x
else if (z <= 3.9d+54) then
tmp = (6.0d0 * z) * y
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 <= -1.35e+78) {
tmp = t_0;
} else if (z <= -2.85e-24) {
tmp = (z * y) * 6.0;
} else if (z <= 1.65e-51) {
tmp = x;
} else if (z <= 3.9e+54) {
tmp = (6.0 * z) * y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (-6.0 * x) * z tmp = 0 if z <= -1.35e+78: tmp = t_0 elif z <= -2.85e-24: tmp = (z * y) * 6.0 elif z <= 1.65e-51: tmp = x elif z <= 3.9e+54: tmp = (6.0 * z) * y else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-6.0 * x) * z) tmp = 0.0 if (z <= -1.35e+78) tmp = t_0; elseif (z <= -2.85e-24) tmp = Float64(Float64(z * y) * 6.0); elseif (z <= 1.65e-51) tmp = x; elseif (z <= 3.9e+54) tmp = Float64(Float64(6.0 * z) * y); 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 <= -1.35e+78) tmp = t_0; elseif (z <= -2.85e-24) tmp = (z * y) * 6.0; elseif (z <= 1.65e-51) tmp = x; elseif (z <= 3.9e+54) tmp = (6.0 * z) * y; 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, -1.35e+78], t$95$0, If[LessEqual[z, -2.85e-24], N[(N[(z * y), $MachinePrecision] * 6.0), $MachinePrecision], If[LessEqual[z, 1.65e-51], x, If[LessEqual[z, 3.9e+54], N[(N[(6.0 * z), $MachinePrecision] * y), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-6 \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.85 \cdot 10^{-24}:\\
\;\;\;\;\left(z \cdot y\right) \cdot 6\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-51}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+54}:\\
\;\;\;\;\left(6 \cdot z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.35000000000000002e78 or 3.9000000000000003e54 < z Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6453.6
Applied rewrites53.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.5
Applied rewrites53.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f6453.5
Applied rewrites53.5%
if -1.35000000000000002e78 < z < -2.85000000000000001e-24Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.0
Applied rewrites49.0%
if -2.85000000000000001e-24 < z < 1.64999999999999986e-51Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites73.8%
if 1.64999999999999986e-51 < z < 3.9000000000000003e54Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.9
Applied rewrites49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6449.9
Applied rewrites49.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* -6.0 x) z)) (t_1 (* (* 6.0 z) y)))
(if (<= z -1.35e+78)
t_0
(if (<= z -2.85e-24)
t_1
(if (<= z 1.65e-51) x (if (<= z 3.9e+54) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = (-6.0 * x) * z;
double t_1 = (6.0 * z) * y;
double tmp;
if (z <= -1.35e+78) {
tmp = t_0;
} else if (z <= -2.85e-24) {
tmp = t_1;
} else if (z <= 1.65e-51) {
tmp = x;
} else if (z <= 3.9e+54) {
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 = ((-6.0d0) * x) * z
t_1 = (6.0d0 * z) * y
if (z <= (-1.35d+78)) then
tmp = t_0
else if (z <= (-2.85d-24)) then
tmp = t_1
else if (z <= 1.65d-51) then
tmp = x
else if (z <= 3.9d+54) 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 = (-6.0 * x) * z;
double t_1 = (6.0 * z) * y;
double tmp;
if (z <= -1.35e+78) {
tmp = t_0;
} else if (z <= -2.85e-24) {
tmp = t_1;
} else if (z <= 1.65e-51) {
tmp = x;
} else if (z <= 3.9e+54) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (-6.0 * x) * z t_1 = (6.0 * z) * y tmp = 0 if z <= -1.35e+78: tmp = t_0 elif z <= -2.85e-24: tmp = t_1 elif z <= 1.65e-51: tmp = x elif z <= 3.9e+54: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-6.0 * x) * z) t_1 = Float64(Float64(6.0 * z) * y) tmp = 0.0 if (z <= -1.35e+78) tmp = t_0; elseif (z <= -2.85e-24) tmp = t_1; elseif (z <= 1.65e-51) tmp = x; elseif (z <= 3.9e+54) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-6.0 * x) * z; t_1 = (6.0 * z) * y; tmp = 0.0; if (z <= -1.35e+78) tmp = t_0; elseif (z <= -2.85e-24) tmp = t_1; elseif (z <= 1.65e-51) tmp = x; elseif (z <= 3.9e+54) tmp = t_1; 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]}, Block[{t$95$1 = N[(N[(6.0 * z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -1.35e+78], t$95$0, If[LessEqual[z, -2.85e-24], t$95$1, If[LessEqual[z, 1.65e-51], x, If[LessEqual[z, 3.9e+54], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-6 \cdot x\right) \cdot z\\
t_1 := \left(6 \cdot z\right) \cdot y\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.85 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-51}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.35000000000000002e78 or 3.9000000000000003e54 < z Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6453.6
Applied rewrites53.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.5
Applied rewrites53.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f6453.5
Applied rewrites53.5%
if -1.35000000000000002e78 < z < -2.85000000000000001e-24 or 1.64999999999999986e-51 < z < 3.9000000000000003e54Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.5
Applied rewrites49.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6449.5
Applied rewrites49.5%
if -2.85000000000000001e-24 < z < 1.64999999999999986e-51Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites73.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* -6.0 x) z)) (t_1 (* (* 6.0 y) z)))
(if (<= z -1.35e+78)
t_0
(if (<= z -2.85e-24)
t_1
(if (<= z 1.65e-51) x (if (<= z 3.9e+54) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = (-6.0 * x) * z;
double t_1 = (6.0 * y) * z;
double tmp;
if (z <= -1.35e+78) {
tmp = t_0;
} else if (z <= -2.85e-24) {
tmp = t_1;
} else if (z <= 1.65e-51) {
tmp = x;
} else if (z <= 3.9e+54) {
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 = ((-6.0d0) * x) * z
t_1 = (6.0d0 * y) * z
if (z <= (-1.35d+78)) then
tmp = t_0
else if (z <= (-2.85d-24)) then
tmp = t_1
else if (z <= 1.65d-51) then
tmp = x
else if (z <= 3.9d+54) 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 = (-6.0 * x) * z;
double t_1 = (6.0 * y) * z;
double tmp;
if (z <= -1.35e+78) {
tmp = t_0;
} else if (z <= -2.85e-24) {
tmp = t_1;
} else if (z <= 1.65e-51) {
tmp = x;
} else if (z <= 3.9e+54) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (-6.0 * x) * z t_1 = (6.0 * y) * z tmp = 0 if z <= -1.35e+78: tmp = t_0 elif z <= -2.85e-24: tmp = t_1 elif z <= 1.65e-51: tmp = x elif z <= 3.9e+54: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-6.0 * x) * z) t_1 = Float64(Float64(6.0 * y) * z) tmp = 0.0 if (z <= -1.35e+78) tmp = t_0; elseif (z <= -2.85e-24) tmp = t_1; elseif (z <= 1.65e-51) tmp = x; elseif (z <= 3.9e+54) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-6.0 * x) * z; t_1 = (6.0 * y) * z; tmp = 0.0; if (z <= -1.35e+78) tmp = t_0; elseif (z <= -2.85e-24) tmp = t_1; elseif (z <= 1.65e-51) tmp = x; elseif (z <= 3.9e+54) tmp = t_1; 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]}, Block[{t$95$1 = N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.35e+78], t$95$0, If[LessEqual[z, -2.85e-24], t$95$1, If[LessEqual[z, 1.65e-51], x, If[LessEqual[z, 3.9e+54], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-6 \cdot x\right) \cdot z\\
t_1 := \left(6 \cdot y\right) \cdot z\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.85 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-51}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.35000000000000002e78 or 3.9000000000000003e54 < z Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6453.6
Applied rewrites53.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.5
Applied rewrites53.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f6453.5
Applied rewrites53.5%
if -1.35000000000000002e78 < z < -2.85000000000000001e-24 or 1.64999999999999986e-51 < z < 3.9000000000000003e54Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.5
Applied rewrites49.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6449.3
Applied rewrites49.3%
if -2.85000000000000001e-24 < z < 1.64999999999999986e-51Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites73.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* -6.0 x) z))) (if (<= z -5.4e-6) t_0 (if (<= z 0.17) x t_0))))
double code(double x, double y, double z) {
double t_0 = (-6.0 * x) * z;
double tmp;
if (z <= -5.4e-6) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = 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 <= (-5.4d-6)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = 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 <= -5.4e-6) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (-6.0 * x) * z tmp = 0 if z <= -5.4e-6: tmp = t_0 elif z <= 0.17: tmp = 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 <= -5.4e-6) tmp = t_0; elseif (z <= 0.17) tmp = 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 <= -5.4e-6) tmp = t_0; elseif (z <= 0.17) tmp = 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, -5.4e-6], t$95$0, If[LessEqual[z, 0.17], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-6 \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -5.39999999999999997e-6 or 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6453.3
Applied rewrites53.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.0
Applied rewrites52.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f6452.0
Applied rewrites52.0%
if -5.39999999999999997e-6 < z < 0.170000000000000012Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites70.2%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites36.0%
herbie shell --seed 2025114
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
(+ x (* (* (- y x) 6.0) z)))