
(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 12 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 (+ 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}
Initial program 99.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(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%
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* (- y x) 6.0) z))) (if (<= z -0.17) t_0 (if (<= z 0.165) (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.165) {
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.165) 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.165], 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.165:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.165000000000000008 < z Initial program 99.8%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift--.f64N/A
lift-*.f6498.7
Applied rewrites98.7%
if -0.170000000000000012 < z < 0.165000000000000008Initial program 99.7%
Applied rewrites99.9%
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 -6e-10) t_0 (if (<= y 4.6e-85) (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 <= -6e-10) {
tmp = t_0;
} else if (y <= 4.6e-85) {
tmp = fma((-6.0 * x), z, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(y, Float64(z * 6.0), x) tmp = 0.0 if (y <= -6e-10) tmp = t_0; elseif (y <= 4.6e-85) 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[(y * N[(z * 6.0), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -6e-10], t$95$0, If[LessEqual[y, 4.6e-85], N[(N[(-6.0 * x), $MachinePrecision] * z + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y, z \cdot 6, x\right)\\
\mathbf{if}\;y \leq -6 \cdot 10^{-10}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-85}:\\
\;\;\;\;\mathsf{fma}\left(-6 \cdot x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -6e-10 or 4.6000000000000001e-85 < y Initial program 99.6%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites87.4%
if -6e-10 < y < 4.6000000000000001e-85Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
Applied rewrites86.6%
Applied rewrites86.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* z y) 6.0))) (if (<= y -3.1e+63) t_0 (if (<= y 6.1e+84) (fma (* -6.0 x) z x) t_0))))
double code(double x, double y, double z) {
double t_0 = (z * y) * 6.0;
double tmp;
if (y <= -3.1e+63) {
tmp = t_0;
} else if (y <= 6.1e+84) {
tmp = fma((-6.0 * x), z, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(z * y) * 6.0) tmp = 0.0 if (y <= -3.1e+63) tmp = t_0; elseif (y <= 6.1e+84) 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[(z * y), $MachinePrecision] * 6.0), $MachinePrecision]}, If[LessEqual[y, -3.1e+63], t$95$0, If[LessEqual[y, 6.1e+84], N[(N[(-6.0 * x), $MachinePrecision] * z + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot y\right) \cdot 6\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{+63}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6.1 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(-6 \cdot x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.1000000000000001e63 or 6.09999999999999999e84 < y Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6470.8
Applied rewrites70.8%
if -3.1000000000000001e63 < y < 6.09999999999999999e84Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
Applied rewrites78.5%
Applied rewrites78.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* z y) 6.0))) (if (<= y -3.1e+63) t_0 (if (<= y 6.1e+84) (* (fma -6.0 z 1.0) x) t_0))))
double code(double x, double y, double z) {
double t_0 = (z * y) * 6.0;
double tmp;
if (y <= -3.1e+63) {
tmp = t_0;
} else if (y <= 6.1e+84) {
tmp = fma(-6.0, z, 1.0) * x;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(z * y) * 6.0) tmp = 0.0 if (y <= -3.1e+63) tmp = t_0; elseif (y <= 6.1e+84) tmp = Float64(fma(-6.0, z, 1.0) * x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * y), $MachinePrecision] * 6.0), $MachinePrecision]}, If[LessEqual[y, -3.1e+63], t$95$0, If[LessEqual[y, 6.1e+84], N[(N[(-6.0 * z + 1.0), $MachinePrecision] * x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot y\right) \cdot 6\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{+63}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6.1 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(-6, z, 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.1000000000000001e63 or 6.09999999999999999e84 < y Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6470.8
Applied rewrites70.8%
if -3.1000000000000001e63 < y < 6.09999999999999999e84Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
Applied rewrites78.5%
(FPCore (x y z)
:precision binary64
(if (<= z -8.2e+253)
(* (* 6.0 z) y)
(if (<= z -5e+89)
(* (* z -6.0) x)
(if (<= z -5.7e-108)
(* (* z y) 6.0)
(if (<= z 2.55e-12) x (* (* y 6.0) z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.2e+253) {
tmp = (6.0 * z) * y;
} else if (z <= -5e+89) {
tmp = (z * -6.0) * x;
} else if (z <= -5.7e-108) {
tmp = (z * y) * 6.0;
} else if (z <= 2.55e-12) {
tmp = x;
} else {
tmp = (y * 6.0) * z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-8.2d+253)) then
tmp = (6.0d0 * z) * y
else if (z <= (-5d+89)) then
tmp = (z * (-6.0d0)) * x
else if (z <= (-5.7d-108)) then
tmp = (z * y) * 6.0d0
else if (z <= 2.55d-12) then
tmp = x
else
tmp = (y * 6.0d0) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8.2e+253) {
tmp = (6.0 * z) * y;
} else if (z <= -5e+89) {
tmp = (z * -6.0) * x;
} else if (z <= -5.7e-108) {
tmp = (z * y) * 6.0;
} else if (z <= 2.55e-12) {
tmp = x;
} else {
tmp = (y * 6.0) * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.2e+253: tmp = (6.0 * z) * y elif z <= -5e+89: tmp = (z * -6.0) * x elif z <= -5.7e-108: tmp = (z * y) * 6.0 elif z <= 2.55e-12: tmp = x else: tmp = (y * 6.0) * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.2e+253) tmp = Float64(Float64(6.0 * z) * y); elseif (z <= -5e+89) tmp = Float64(Float64(z * -6.0) * x); elseif (z <= -5.7e-108) tmp = Float64(Float64(z * y) * 6.0); elseif (z <= 2.55e-12) tmp = x; else tmp = Float64(Float64(y * 6.0) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.2e+253) tmp = (6.0 * z) * y; elseif (z <= -5e+89) tmp = (z * -6.0) * x; elseif (z <= -5.7e-108) tmp = (z * y) * 6.0; elseif (z <= 2.55e-12) tmp = x; else tmp = (y * 6.0) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.2e+253], N[(N[(6.0 * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, -5e+89], N[(N[(z * -6.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -5.7e-108], N[(N[(z * y), $MachinePrecision] * 6.0), $MachinePrecision], If[LessEqual[z, 2.55e-12], x, N[(N[(y * 6.0), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+253}:\\
\;\;\;\;\left(6 \cdot z\right) \cdot y\\
\mathbf{elif}\;z \leq -5 \cdot 10^{+89}:\\
\;\;\;\;\left(z \cdot -6\right) \cdot x\\
\mathbf{elif}\;z \leq -5.7 \cdot 10^{-108}:\\
\;\;\;\;\left(z \cdot y\right) \cdot 6\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot 6\right) \cdot z\\
\end{array}
\end{array}
if z < -8.2e253Initial program 99.9%
Applied rewrites99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6457.9
Applied rewrites57.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6458.5
Applied rewrites58.5%
if -8.2e253 < z < -4.99999999999999983e89Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
Applied rewrites51.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6451.3
Applied rewrites51.3%
if -4.99999999999999983e89 < z < -5.7e-108Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6445.8
Applied rewrites45.8%
if -5.7e-108 < z < 2.54999999999999984e-12Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites73.9%
if 2.54999999999999984e-12 < z Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites96.8%
Taylor expanded in x around 0
Applied rewrites52.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z y) 6.0)))
(if (<= z -8.2e+253)
(* (* 6.0 z) y)
(if (<= z -5e+89)
(* (* z -6.0) x)
(if (<= z -5.7e-108) t_0 (if (<= z 2.55e-12) x t_0))))))
double code(double x, double y, double z) {
double t_0 = (z * y) * 6.0;
double tmp;
if (z <= -8.2e+253) {
tmp = (6.0 * z) * y;
} else if (z <= -5e+89) {
tmp = (z * -6.0) * x;
} else if (z <= -5.7e-108) {
tmp = t_0;
} else if (z <= 2.55e-12) {
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 = (z * y) * 6.0d0
if (z <= (-8.2d+253)) then
tmp = (6.0d0 * z) * y
else if (z <= (-5d+89)) then
tmp = (z * (-6.0d0)) * x
else if (z <= (-5.7d-108)) then
tmp = t_0
else if (z <= 2.55d-12) 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 = (z * y) * 6.0;
double tmp;
if (z <= -8.2e+253) {
tmp = (6.0 * z) * y;
} else if (z <= -5e+89) {
tmp = (z * -6.0) * x;
} else if (z <= -5.7e-108) {
tmp = t_0;
} else if (z <= 2.55e-12) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * y) * 6.0 tmp = 0 if z <= -8.2e+253: tmp = (6.0 * z) * y elif z <= -5e+89: tmp = (z * -6.0) * x elif z <= -5.7e-108: tmp = t_0 elif z <= 2.55e-12: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * y) * 6.0) tmp = 0.0 if (z <= -8.2e+253) tmp = Float64(Float64(6.0 * z) * y); elseif (z <= -5e+89) tmp = Float64(Float64(z * -6.0) * x); elseif (z <= -5.7e-108) tmp = t_0; elseif (z <= 2.55e-12) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * y) * 6.0; tmp = 0.0; if (z <= -8.2e+253) tmp = (6.0 * z) * y; elseif (z <= -5e+89) tmp = (z * -6.0) * x; elseif (z <= -5.7e-108) tmp = t_0; elseif (z <= 2.55e-12) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * y), $MachinePrecision] * 6.0), $MachinePrecision]}, If[LessEqual[z, -8.2e+253], N[(N[(6.0 * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, -5e+89], N[(N[(z * -6.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -5.7e-108], t$95$0, If[LessEqual[z, 2.55e-12], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot y\right) \cdot 6\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{+253}:\\
\;\;\;\;\left(6 \cdot z\right) \cdot y\\
\mathbf{elif}\;z \leq -5 \cdot 10^{+89}:\\
\;\;\;\;\left(z \cdot -6\right) \cdot x\\
\mathbf{elif}\;z \leq -5.7 \cdot 10^{-108}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -8.2e253Initial program 99.9%
Applied rewrites99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6457.9
Applied rewrites57.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6458.5
Applied rewrites58.5%
if -8.2e253 < z < -4.99999999999999983e89Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
Applied rewrites51.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6451.3
Applied rewrites51.3%
if -4.99999999999999983e89 < z < -5.7e-108 or 2.54999999999999984e-12 < z Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.9
Applied rewrites49.9%
if -5.7e-108 < z < 2.54999999999999984e-12Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites73.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z y) 6.0)))
(if (<= z -8.2e+253)
t_0
(if (<= z -5e+89)
(* (* z -6.0) x)
(if (<= z -5.7e-108) t_0 (if (<= z 2.55e-12) x t_0))))))
double code(double x, double y, double z) {
double t_0 = (z * y) * 6.0;
double tmp;
if (z <= -8.2e+253) {
tmp = t_0;
} else if (z <= -5e+89) {
tmp = (z * -6.0) * x;
} else if (z <= -5.7e-108) {
tmp = t_0;
} else if (z <= 2.55e-12) {
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 = (z * y) * 6.0d0
if (z <= (-8.2d+253)) then
tmp = t_0
else if (z <= (-5d+89)) then
tmp = (z * (-6.0d0)) * x
else if (z <= (-5.7d-108)) then
tmp = t_0
else if (z <= 2.55d-12) 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 = (z * y) * 6.0;
double tmp;
if (z <= -8.2e+253) {
tmp = t_0;
} else if (z <= -5e+89) {
tmp = (z * -6.0) * x;
} else if (z <= -5.7e-108) {
tmp = t_0;
} else if (z <= 2.55e-12) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * y) * 6.0 tmp = 0 if z <= -8.2e+253: tmp = t_0 elif z <= -5e+89: tmp = (z * -6.0) * x elif z <= -5.7e-108: tmp = t_0 elif z <= 2.55e-12: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * y) * 6.0) tmp = 0.0 if (z <= -8.2e+253) tmp = t_0; elseif (z <= -5e+89) tmp = Float64(Float64(z * -6.0) * x); elseif (z <= -5.7e-108) tmp = t_0; elseif (z <= 2.55e-12) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * y) * 6.0; tmp = 0.0; if (z <= -8.2e+253) tmp = t_0; elseif (z <= -5e+89) tmp = (z * -6.0) * x; elseif (z <= -5.7e-108) tmp = t_0; elseif (z <= 2.55e-12) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * y), $MachinePrecision] * 6.0), $MachinePrecision]}, If[LessEqual[z, -8.2e+253], t$95$0, If[LessEqual[z, -5e+89], N[(N[(z * -6.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -5.7e-108], t$95$0, If[LessEqual[z, 2.55e-12], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot y\right) \cdot 6\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{+253}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5 \cdot 10^{+89}:\\
\;\;\;\;\left(z \cdot -6\right) \cdot x\\
\mathbf{elif}\;z \leq -5.7 \cdot 10^{-108}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -8.2e253 or -4.99999999999999983e89 < z < -5.7e-108 or 2.54999999999999984e-12 < z Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6450.6
Applied rewrites50.6%
if -8.2e253 < z < -4.99999999999999983e89Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
Applied rewrites51.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6451.3
Applied rewrites51.3%
if -5.7e-108 < z < 2.54999999999999984e-12Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites13.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* z -6.0) x))) (if (<= z -0.165) t_0 (if (<= z 5.2e+16) x t_0))))
double code(double x, double y, double z) {
double t_0 = (z * -6.0) * x;
double tmp;
if (z <= -0.165) {
tmp = t_0;
} else if (z <= 5.2e+16) {
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 = (z * (-6.0d0)) * x
if (z <= (-0.165d0)) then
tmp = t_0
else if (z <= 5.2d+16) 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 = (z * -6.0) * x;
double tmp;
if (z <= -0.165) {
tmp = t_0;
} else if (z <= 5.2e+16) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * -6.0) * x tmp = 0 if z <= -0.165: tmp = t_0 elif z <= 5.2e+16: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * -6.0) * x) tmp = 0.0 if (z <= -0.165) tmp = t_0; elseif (z <= 5.2e+16) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * -6.0) * x; tmp = 0.0; if (z <= -0.165) tmp = t_0; elseif (z <= 5.2e+16) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -6.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -0.165], t$95$0, If[LessEqual[z, 5.2e+16], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot -6\right) \cdot x\\
\mathbf{if}\;z \leq -0.165:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 5.2e16 < z Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
Applied rewrites52.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6451.5
Applied rewrites51.5%
if -0.165000000000000008 < z < 5.2e16Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites68.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* z x) -6.0))) (if (<= z -0.165) t_0 (if (<= z 5.2e+16) x t_0))))
double code(double x, double y, double z) {
double t_0 = (z * x) * -6.0;
double tmp;
if (z <= -0.165) {
tmp = t_0;
} else if (z <= 5.2e+16) {
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 = (z * x) * (-6.0d0)
if (z <= (-0.165d0)) then
tmp = t_0
else if (z <= 5.2d+16) 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 = (z * x) * -6.0;
double tmp;
if (z <= -0.165) {
tmp = t_0;
} else if (z <= 5.2e+16) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * x) * -6.0 tmp = 0 if z <= -0.165: tmp = t_0 elif z <= 5.2e+16: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * x) * -6.0) tmp = 0.0 if (z <= -0.165) tmp = t_0; elseif (z <= 5.2e+16) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * x) * -6.0; tmp = 0.0; if (z <= -0.165) tmp = t_0; elseif (z <= 5.2e+16) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * x), $MachinePrecision] * -6.0), $MachinePrecision]}, If[LessEqual[z, -0.165], t$95$0, If[LessEqual[z, 5.2e+16], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot x\right) \cdot -6\\
\mathbf{if}\;z \leq -0.165:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 5.2e16 < z Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
distribute-lft-out--N/A
Applied rewrites52.0%
Taylor expanded in z around inf
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6451.4
Applied rewrites51.4%
if -0.165000000000000008 < z < 5.2e16Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites68.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 rewrites37.1%
herbie shell --seed 2025130
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
(+ x (* (* (- y x) 6.0) z)))