
(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(y - x), Float64(z * 6.0), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, z \cdot 6, x\right)
\end{array}
Initial program 99.7%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
(FPCore (x y z)
:precision binary64
(if (<= z -3.5e-8)
(* (* 6.0 y) z)
(if (<= z 1.62e-81)
x
(if (<= z 6.2e+38) (* (* z y) 6.0) (* (* z x) -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.5e-8) {
tmp = (6.0 * y) * z;
} else if (z <= 1.62e-81) {
tmp = x;
} else if (z <= 6.2e+38) {
tmp = (z * y) * 6.0;
} 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 <= (-3.5d-8)) then
tmp = (6.0d0 * y) * z
else if (z <= 1.62d-81) then
tmp = x
else if (z <= 6.2d+38) then
tmp = (z * y) * 6.0d0
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 <= -3.5e-8) {
tmp = (6.0 * y) * z;
} else if (z <= 1.62e-81) {
tmp = x;
} else if (z <= 6.2e+38) {
tmp = (z * y) * 6.0;
} else {
tmp = (z * x) * -6.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.5e-8: tmp = (6.0 * y) * z elif z <= 1.62e-81: tmp = x elif z <= 6.2e+38: tmp = (z * y) * 6.0 else: tmp = (z * x) * -6.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.5e-8) tmp = Float64(Float64(6.0 * y) * z); elseif (z <= 1.62e-81) tmp = x; elseif (z <= 6.2e+38) tmp = Float64(Float64(z * y) * 6.0); else tmp = Float64(Float64(z * x) * -6.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.5e-8) tmp = (6.0 * y) * z; elseif (z <= 1.62e-81) tmp = x; elseif (z <= 6.2e+38) tmp = (z * y) * 6.0; else tmp = (z * x) * -6.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.5e-8], N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 1.62e-81], x, If[LessEqual[z, 6.2e+38], N[(N[(z * y), $MachinePrecision] * 6.0), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * -6.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-8}:\\
\;\;\;\;\left(6 \cdot y\right) \cdot z\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{-81}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+38}:\\
\;\;\;\;\left(z \cdot y\right) \cdot 6\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot -6\\
\end{array}
\end{array}
if z < -3.50000000000000024e-8Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6451.1
Applied rewrites51.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f6451.1
Applied rewrites51.1%
if -3.50000000000000024e-8 < z < 1.62000000000000008e-81Initial program 99.6%
Taylor expanded in z around 0
Applied rewrites72.8%
if 1.62000000000000008e-81 < z < 6.20000000000000035e38Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6446.5
Applied rewrites46.5%
if 6.20000000000000035e38 < z Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6454.4
Applied rewrites54.4%
Taylor expanded in z around inf
*-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6454.5
Applied rewrites54.5%
(FPCore (x y z)
:precision binary64
(if (<= z -3.5e-8)
(* (* 6.0 y) z)
(if (<= z 1.62e-81)
x
(if (<= z 6.2e+38) (* (* z 6.0) y) (* (* z x) -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.5e-8) {
tmp = (6.0 * y) * z;
} else if (z <= 1.62e-81) {
tmp = x;
} else if (z <= 6.2e+38) {
tmp = (z * 6.0) * y;
} 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 <= (-3.5d-8)) then
tmp = (6.0d0 * y) * z
else if (z <= 1.62d-81) then
tmp = x
else if (z <= 6.2d+38) then
tmp = (z * 6.0d0) * y
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 <= -3.5e-8) {
tmp = (6.0 * y) * z;
} else if (z <= 1.62e-81) {
tmp = x;
} else if (z <= 6.2e+38) {
tmp = (z * 6.0) * y;
} else {
tmp = (z * x) * -6.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.5e-8: tmp = (6.0 * y) * z elif z <= 1.62e-81: tmp = x elif z <= 6.2e+38: tmp = (z * 6.0) * y else: tmp = (z * x) * -6.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.5e-8) tmp = Float64(Float64(6.0 * y) * z); elseif (z <= 1.62e-81) tmp = x; elseif (z <= 6.2e+38) tmp = Float64(Float64(z * 6.0) * y); else tmp = Float64(Float64(z * x) * -6.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.5e-8) tmp = (6.0 * y) * z; elseif (z <= 1.62e-81) tmp = x; elseif (z <= 6.2e+38) tmp = (z * 6.0) * y; else tmp = (z * x) * -6.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.5e-8], N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 1.62e-81], x, If[LessEqual[z, 6.2e+38], N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * -6.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-8}:\\
\;\;\;\;\left(6 \cdot y\right) \cdot z\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{-81}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+38}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot -6\\
\end{array}
\end{array}
if z < -3.50000000000000024e-8Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6451.1
Applied rewrites51.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f6451.1
Applied rewrites51.1%
if -3.50000000000000024e-8 < z < 1.62000000000000008e-81Initial program 99.6%
Taylor expanded in z around 0
Applied rewrites72.8%
if 1.62000000000000008e-81 < z < 6.20000000000000035e38Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6446.5
Applied rewrites46.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6446.5
Applied rewrites46.5%
if 6.20000000000000035e38 < z Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6454.4
Applied rewrites54.4%
Taylor expanded in z around inf
*-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6454.5
Applied rewrites54.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* 6.0 y) z)))
(if (<= z -3.5e-8)
t_0
(if (<= z 1.62e-81) x (if (<= z 6.2e+38) t_0 (* (* z x) -6.0))))))
double code(double x, double y, double z) {
double t_0 = (6.0 * y) * z;
double tmp;
if (z <= -3.5e-8) {
tmp = t_0;
} else if (z <= 1.62e-81) {
tmp = x;
} else if (z <= 6.2e+38) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (6.0d0 * y) * z
if (z <= (-3.5d-8)) then
tmp = t_0
else if (z <= 1.62d-81) then
tmp = x
else if (z <= 6.2d+38) then
tmp = t_0
else
tmp = (z * x) * (-6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (6.0 * y) * z;
double tmp;
if (z <= -3.5e-8) {
tmp = t_0;
} else if (z <= 1.62e-81) {
tmp = x;
} else if (z <= 6.2e+38) {
tmp = t_0;
} else {
tmp = (z * x) * -6.0;
}
return tmp;
}
def code(x, y, z): t_0 = (6.0 * y) * z tmp = 0 if z <= -3.5e-8: tmp = t_0 elif z <= 1.62e-81: tmp = x elif z <= 6.2e+38: tmp = t_0 else: tmp = (z * x) * -6.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(6.0 * y) * z) tmp = 0.0 if (z <= -3.5e-8) tmp = t_0; elseif (z <= 1.62e-81) tmp = x; elseif (z <= 6.2e+38) tmp = t_0; else tmp = Float64(Float64(z * x) * -6.0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (6.0 * y) * z; tmp = 0.0; if (z <= -3.5e-8) tmp = t_0; elseif (z <= 1.62e-81) tmp = x; elseif (z <= 6.2e+38) tmp = t_0; else tmp = (z * x) * -6.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -3.5e-8], t$95$0, If[LessEqual[z, 1.62e-81], x, If[LessEqual[z, 6.2e+38], t$95$0, N[(N[(z * x), $MachinePrecision] * -6.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(6 \cdot y\right) \cdot z\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{-81}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot -6\\
\end{array}
\end{array}
if z < -3.50000000000000024e-8 or 1.62000000000000008e-81 < z < 6.20000000000000035e38Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.7
Applied rewrites49.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f6449.7
Applied rewrites49.7%
if -3.50000000000000024e-8 < z < 1.62000000000000008e-81Initial program 99.6%
Taylor expanded in z around 0
Applied rewrites72.8%
if 6.20000000000000035e38 < z Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6454.4
Applied rewrites54.4%
Taylor expanded in z around inf
*-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6454.5
Applied rewrites54.5%
(FPCore (x y z) :precision binary64 (if (<= z -0.17) (* (* (- y x) 6.0) z) (if (<= z 0.102) (fma y (* z 6.0) x) (* (* z (- x y)) -6.0))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = ((y - x) * 6.0) * z;
} else if (z <= 0.102) {
tmp = fma(y, (z * 6.0), x);
} else {
tmp = (z * (x - y)) * -6.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -0.17) tmp = Float64(Float64(Float64(y - x) * 6.0) * z); elseif (z <= 0.102) tmp = fma(y, Float64(z * 6.0), x); else tmp = Float64(Float64(z * Float64(x - y)) * -6.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -0.17], N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 0.102], N[(y * N[(z * 6.0), $MachinePrecision] + x), $MachinePrecision], N[(N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision] * -6.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\
\mathbf{elif}\;z \leq 0.102:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot \left(x - y\right)\right) \cdot -6\\
\end{array}
\end{array}
if z < -0.170000000000000012Initial 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.5
Applied rewrites98.5%
if -0.170000000000000012 < z < 0.101999999999999993Initial program 99.6%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites98.8%
if 0.101999999999999993 < z 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.7
Applied rewrites99.7%
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
flip--N/A
flip--N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-rgt-outN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6497.7
Applied rewrites97.7%
Taylor expanded in z around -inf
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-inN/A
mul-1-negN/A
fp-cancel-sub-sign-invN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6498.8
Applied rewrites98.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* (- y x) 6.0) z))) (if (<= z -0.17) t_0 (if (<= z 0.102) (fma y (* z 6.0) 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.102) {
tmp = fma(y, (z * 6.0), 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.102) tmp = fma(y, Float64(z * 6.0), 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.102], N[(y * N[(z * 6.0), $MachinePrecision] + 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.102:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.101999999999999993 < 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.6
Applied rewrites98.6%
if -0.170000000000000012 < z < 0.101999999999999993Initial program 99.6%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites98.8%
(FPCore (x y z) :precision binary64 (if (<= x -262000000.0) (* (fma -6.0 z 1.0) x) (if (<= x 8e+61) (fma y (* z 6.0) x) (fma (* -6.0 x) z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -262000000.0) {
tmp = fma(-6.0, z, 1.0) * x;
} else if (x <= 8e+61) {
tmp = fma(y, (z * 6.0), x);
} else {
tmp = fma((-6.0 * x), z, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -262000000.0) tmp = Float64(fma(-6.0, z, 1.0) * x); elseif (x <= 8e+61) tmp = fma(y, Float64(z * 6.0), x); else tmp = fma(Float64(-6.0 * x), z, x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -262000000.0], N[(N[(-6.0 * z + 1.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 8e+61], N[(y * N[(z * 6.0), $MachinePrecision] + x), $MachinePrecision], N[(N[(-6.0 * x), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -262000000:\\
\;\;\;\;\mathsf{fma}\left(-6, z, 1\right) \cdot x\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-6 \cdot x, z, x\right)\\
\end{array}
\end{array}
if x < -2.62e8Initial program 99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6486.7
Applied rewrites86.7%
if -2.62e8 < x < 7.9999999999999996e61Initial program 99.7%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites85.3%
if 7.9999999999999996e61 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6489.6
Applied rewrites89.6%
lift-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6489.4
Applied rewrites89.4%
(FPCore (x y z) :precision binary64 (if (<= x -7.8e-131) (* (fma -6.0 z 1.0) x) (if (<= x 2.6e-51) (* (* z 6.0) y) (fma (* z x) -6.0 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.8e-131) {
tmp = fma(-6.0, z, 1.0) * x;
} else if (x <= 2.6e-51) {
tmp = (z * 6.0) * y;
} else {
tmp = fma((z * x), -6.0, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -7.8e-131) tmp = Float64(fma(-6.0, z, 1.0) * x); elseif (x <= 2.6e-51) tmp = Float64(Float64(z * 6.0) * y); else tmp = fma(Float64(z * x), -6.0, x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -7.8e-131], N[(N[(-6.0 * z + 1.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 2.6e-51], N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * -6.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-131}:\\
\;\;\;\;\mathsf{fma}\left(-6, z, 1\right) \cdot x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-51}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot x, -6, x\right)\\
\end{array}
\end{array}
if x < -7.80000000000000039e-131Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6476.6
Applied rewrites76.6%
if -7.80000000000000039e-131 < x < 2.6e-51Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.7
Applied rewrites68.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.7
Applied rewrites68.7%
if 2.6e-51 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6481.2
Applied rewrites81.2%
lift-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6481.3
Applied rewrites81.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (fma -6.0 z 1.0) x))) (if (<= x -7.8e-131) t_0 (if (<= x 2.6e-51) (* (* z 6.0) y) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(-6.0, z, 1.0) * x;
double tmp;
if (x <= -7.8e-131) {
tmp = t_0;
} else if (x <= 2.6e-51) {
tmp = (z * 6.0) * y;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(fma(-6.0, z, 1.0) * x) tmp = 0.0 if (x <= -7.8e-131) tmp = t_0; elseif (x <= 2.6e-51) tmp = Float64(Float64(z * 6.0) * y); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-6.0 * z + 1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -7.8e-131], t$95$0, If[LessEqual[x, 2.6e-51], N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-6, z, 1\right) \cdot x\\
\mathbf{if}\;x \leq -7.8 \cdot 10^{-131}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-51}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -7.80000000000000039e-131 or 2.6e-51 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6478.7
Applied rewrites78.7%
if -7.80000000000000039e-131 < x < 2.6e-51Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.7
Applied rewrites68.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.7
Applied rewrites68.7%
(FPCore (x y z) :precision binary64 (if (<= z -0.17) (* (* -6.0 x) z) (if (<= z 0.102) x (* (* z x) -6.0))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = (-6.0 * x) * z;
} else if (z <= 0.102) {
tmp = x;
} 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 <= (-0.17d0)) then
tmp = ((-6.0d0) * x) * z
else if (z <= 0.102d0) then
tmp = x
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 <= -0.17) {
tmp = (-6.0 * x) * z;
} else if (z <= 0.102) {
tmp = x;
} else {
tmp = (z * x) * -6.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.17: tmp = (-6.0 * x) * z elif z <= 0.102: tmp = x else: tmp = (z * x) * -6.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.17) tmp = Float64(Float64(-6.0 * x) * z); elseif (z <= 0.102) tmp = x; else tmp = Float64(Float64(z * x) * -6.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.17) tmp = (-6.0 * x) * z; elseif (z <= 0.102) tmp = x; else tmp = (z * x) * -6.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.17], N[(N[(-6.0 * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 0.102], x, N[(N[(z * x), $MachinePrecision] * -6.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;\left(-6 \cdot x\right) \cdot z\\
\mathbf{elif}\;z \leq 0.102:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot -6\\
\end{array}
\end{array}
if z < -0.170000000000000012Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6455.2
Applied rewrites55.2%
Taylor expanded in z around inf
*-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6454.0
Applied rewrites54.0%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6454.0
Applied rewrites54.0%
if -0.170000000000000012 < z < 0.101999999999999993Initial program 99.6%
Taylor expanded in z around 0
Applied rewrites69.7%
if 0.101999999999999993 < z Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6453.7
Applied rewrites53.7%
Taylor expanded in z around inf
*-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6452.8
Applied rewrites52.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* -6.0 x) z))) (if (<= z -0.17) t_0 (if (<= z 0.102) x t_0))))
double code(double x, double y, double z) {
double t_0 = (-6.0 * x) * z;
double tmp;
if (z <= -0.17) {
tmp = t_0;
} else if (z <= 0.102) {
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 <= (-0.17d0)) then
tmp = t_0
else if (z <= 0.102d0) 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 <= -0.17) {
tmp = t_0;
} else if (z <= 0.102) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (-6.0 * x) * z tmp = 0 if z <= -0.17: tmp = t_0 elif z <= 0.102: 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 <= -0.17) tmp = t_0; elseif (z <= 0.102) 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 <= -0.17) tmp = t_0; elseif (z <= 0.102) 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, -0.17], t$95$0, If[LessEqual[z, 0.102], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-6 \cdot x\right) \cdot z\\
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.102:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.101999999999999993 < z Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6454.4
Applied rewrites54.4%
Taylor expanded in z around inf
*-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6453.4
Applied rewrites53.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6453.4
Applied rewrites53.4%
if -0.170000000000000012 < z < 0.101999999999999993Initial program 99.6%
Taylor expanded in z around 0
Applied rewrites69.7%
(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 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.4%
(FPCore (x y z) :precision binary64 (- x (* (* 6.0 z) (- x y))))
double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
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 - ((6.0d0 * z) * (x - y))
end function
public static double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
def code(x, y, z): return x - ((6.0 * z) * (x - y))
function code(x, y, z) return Float64(x - Float64(Float64(6.0 * z) * Float64(x - y))) end
function tmp = code(x, y, z) tmp = x - ((6.0 * z) * (x - y)); end
code[x_, y_, z_] := N[(x - N[(N[(6.0 * z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}
herbie shell --seed 2025095
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(! :herbie-platform default (- x (* (* 6 z) (- x y))))
(+ x (* (* (- y x) 6.0) z)))