
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z): return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z))) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z)); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z): return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z))) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z)); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
(FPCore (x y z) :precision binary64 (fma (fma z 6.0 -4.0) (- x y) x))
double code(double x, double y, double z) {
return fma(fma(z, 6.0, -4.0), (x - y), x);
}
function code(x, y, z) return fma(fma(z, 6.0, -4.0), Float64(x - y), x) end
code[x_, y_, z_] := N[(N[(z * 6.0 + -4.0), $MachinePrecision] * N[(x - y), $MachinePrecision] + x), $MachinePrecision]
\mathsf{fma}\left(\mathsf{fma}\left(z, 6, -4\right), x - y, x\right)
Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- y x) (* -6.0 z))))
(if (<= z -1550000000.0)
t_0
(if (<= z 130000.0) (fma -4.0 (- x y) x) t_0))))double code(double x, double y, double z) {
double t_0 = (y - x) * (-6.0 * z);
double tmp;
if (z <= -1550000000.0) {
tmp = t_0;
} else if (z <= 130000.0) {
tmp = fma(-4.0, (x - y), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(y - x) * Float64(-6.0 * z)) tmp = 0.0 if (z <= -1550000000.0) tmp = t_0; elseif (z <= 130000.0) tmp = fma(-4.0, Float64(x - y), x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - x), $MachinePrecision] * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1550000000.0], t$95$0, If[LessEqual[z, 130000.0], N[(-4.0 * N[(x - y), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(y - x\right) \cdot \left(-6 \cdot z\right)\\
\mathbf{if}\;z \leq -1550000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 130000:\\
\;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -1.55e9 or 1.3e5 < z Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-rgt-neg-outN/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
distribute-lft-neg-outN/A
metadata-evalN/A
lower-*.f6450.2%
Applied rewrites50.2%
if -1.55e9 < z < 1.3e5Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites51.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* (- y x) -6.0) z)))
(if (<= z -1550000000.0)
t_0
(if (<= z 130000.0) (fma -4.0 (- x y) x) t_0))))double code(double x, double y, double z) {
double t_0 = ((y - x) * -6.0) * z;
double tmp;
if (z <= -1550000000.0) {
tmp = t_0;
} else if (z <= 130000.0) {
tmp = fma(-4.0, (x - y), 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 <= -1550000000.0) tmp = t_0; elseif (z <= 130000.0) tmp = fma(-4.0, Float64(x - y), 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, -1550000000.0], t$95$0, If[LessEqual[z, 130000.0], N[(-4.0 * N[(x - y), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(\left(y - x\right) \cdot -6\right) \cdot z\\
\mathbf{if}\;z \leq -1550000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 130000:\\
\;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -1.55e9 or 1.3e5 < z Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6450.3%
Applied rewrites50.3%
if -1.55e9 < z < 1.3e5Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites51.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* z (- y x)))))
(if (<= z -1550000000.0)
t_0
(if (<= z 130000.0) (fma -4.0 (- x y) x) t_0))))double code(double x, double y, double z) {
double t_0 = -6.0 * (z * (y - x));
double tmp;
if (z <= -1550000000.0) {
tmp = t_0;
} else if (z <= 130000.0) {
tmp = fma(-4.0, (x - y), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(-6.0 * Float64(z * Float64(y - x))) tmp = 0.0 if (z <= -1550000000.0) tmp = t_0; elseif (z <= 130000.0) tmp = fma(-4.0, Float64(x - y), x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1550000000.0], t$95$0, If[LessEqual[z, 130000.0], N[(-4.0 * N[(x - y), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{if}\;z \leq -1550000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 130000:\\
\;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -1.55e9 or 1.3e5 < z Initial program 99.5%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
if -1.55e9 < z < 1.3e5Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites51.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.35e+219)
(* x (* 6.0 z))
(if (<= z -50000000000.0)
(* (* -6.0 z) y)
(if (<= z 130000.0) (fma -4.0 (- x y) x) (* x (fma 6.0 z -3.0))))))double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+219) {
tmp = x * (6.0 * z);
} else if (z <= -50000000000.0) {
tmp = (-6.0 * z) * y;
} else if (z <= 130000.0) {
tmp = fma(-4.0, (x - y), x);
} else {
tmp = x * fma(6.0, z, -3.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.35e+219) tmp = Float64(x * Float64(6.0 * z)); elseif (z <= -50000000000.0) tmp = Float64(Float64(-6.0 * z) * y); elseif (z <= 130000.0) tmp = fma(-4.0, Float64(x - y), x); else tmp = Float64(x * fma(6.0, z, -3.0)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.35e+219], N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -50000000000.0], N[(N[(-6.0 * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 130000.0], N[(-4.0 * N[(x - y), $MachinePrecision] + x), $MachinePrecision], N[(x * N[(6.0 * z + -3.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+219}:\\
\;\;\;\;x \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq -50000000000:\\
\;\;\;\;\left(-6 \cdot z\right) \cdot y\\
\mathbf{elif}\;z \leq 130000:\\
\;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(6, z, -3\right)\\
\end{array}
if z < -1.3499999999999999e219Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around 0
Applied rewrites26.1%
Taylor expanded in z around inf
lower-*.f6427.9%
Applied rewrites27.9%
if -1.3499999999999999e219 < z < -5e10Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6426.8%
Applied rewrites26.8%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6426.8%
Applied rewrites26.8%
if -5e10 < z < 1.3e5Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites51.0%
if 1.3e5 < z Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
metadata-evalN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval51.7%
Applied rewrites51.7%
lift-fma.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
distribute-lft-out--N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-neg-outN/A
*-commutativeN/A
add-flipN/A
associate-+r+N/A
metadata-evalN/A
distribute-rgt-outN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
Applied rewrites51.8%
(FPCore (x y z)
:precision binary64
(if (<= z -1.35e+219)
(* x (* 6.0 z))
(if (<= z -50000000000.0)
(* (* -6.0 z) y)
(if (<= z 130000.0) (fma -4.0 (- x y) x) (* 6.0 (* x z))))))double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+219) {
tmp = x * (6.0 * z);
} else if (z <= -50000000000.0) {
tmp = (-6.0 * z) * y;
} else if (z <= 130000.0) {
tmp = fma(-4.0, (x - y), x);
} else {
tmp = 6.0 * (x * z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.35e+219) tmp = Float64(x * Float64(6.0 * z)); elseif (z <= -50000000000.0) tmp = Float64(Float64(-6.0 * z) * y); elseif (z <= 130000.0) tmp = fma(-4.0, Float64(x - y), x); else tmp = Float64(6.0 * Float64(x * z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.35e+219], N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -50000000000.0], N[(N[(-6.0 * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 130000.0], N[(-4.0 * N[(x - y), $MachinePrecision] + x), $MachinePrecision], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+219}:\\
\;\;\;\;x \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq -50000000000:\\
\;\;\;\;\left(-6 \cdot z\right) \cdot y\\
\mathbf{elif}\;z \leq 130000:\\
\;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\end{array}
if z < -1.3499999999999999e219Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around 0
Applied rewrites26.1%
Taylor expanded in z around inf
lower-*.f6427.9%
Applied rewrites27.9%
if -1.3499999999999999e219 < z < -5e10Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6426.8%
Applied rewrites26.8%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6426.8%
Applied rewrites26.8%
if -5e10 < z < 1.3e5Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites51.0%
if 1.3e5 < z Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
(FPCore (x y z)
:precision binary64
(if (<= z -1.35e+219)
(* x (* 6.0 z))
(if (<= z -9.8e-21)
(* (* -6.0 z) y)
(if (<= z -1.15e-265)
(+ x (* 4.0 y))
(if (<= z 7.2e-17) (* x -3.0) (* 6.0 (* x z)))))))double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+219) {
tmp = x * (6.0 * z);
} else if (z <= -9.8e-21) {
tmp = (-6.0 * z) * y;
} else if (z <= -1.15e-265) {
tmp = x + (4.0 * y);
} else if (z <= 7.2e-17) {
tmp = x * -3.0;
} else {
tmp = 6.0 * (x * z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.35d+219)) then
tmp = x * (6.0d0 * z)
else if (z <= (-9.8d-21)) then
tmp = ((-6.0d0) * z) * y
else if (z <= (-1.15d-265)) then
tmp = x + (4.0d0 * y)
else if (z <= 7.2d-17) then
tmp = x * (-3.0d0)
else
tmp = 6.0d0 * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+219) {
tmp = x * (6.0 * z);
} else if (z <= -9.8e-21) {
tmp = (-6.0 * z) * y;
} else if (z <= -1.15e-265) {
tmp = x + (4.0 * y);
} else if (z <= 7.2e-17) {
tmp = x * -3.0;
} else {
tmp = 6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.35e+219: tmp = x * (6.0 * z) elif z <= -9.8e-21: tmp = (-6.0 * z) * y elif z <= -1.15e-265: tmp = x + (4.0 * y) elif z <= 7.2e-17: tmp = x * -3.0 else: tmp = 6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.35e+219) tmp = Float64(x * Float64(6.0 * z)); elseif (z <= -9.8e-21) tmp = Float64(Float64(-6.0 * z) * y); elseif (z <= -1.15e-265) tmp = Float64(x + Float64(4.0 * y)); elseif (z <= 7.2e-17) tmp = Float64(x * -3.0); else tmp = Float64(6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.35e+219) tmp = x * (6.0 * z); elseif (z <= -9.8e-21) tmp = (-6.0 * z) * y; elseif (z <= -1.15e-265) tmp = x + (4.0 * y); elseif (z <= 7.2e-17) tmp = x * -3.0; else tmp = 6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.35e+219], N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.8e-21], N[(N[(-6.0 * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, -1.15e-265], N[(x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-17], N[(x * -3.0), $MachinePrecision], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+219}:\\
\;\;\;\;x \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq -9.8 \cdot 10^{-21}:\\
\;\;\;\;\left(-6 \cdot z\right) \cdot y\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-265}:\\
\;\;\;\;x + 4 \cdot y\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-17}:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\end{array}
if z < -1.3499999999999999e219Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around 0
Applied rewrites26.1%
Taylor expanded in z around inf
lower-*.f6427.9%
Applied rewrites27.9%
if -1.3499999999999999e219 < z < -9.8000000000000003e-21Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6426.8%
Applied rewrites26.8%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6426.8%
Applied rewrites26.8%
if -9.8000000000000003e-21 < z < -1.1499999999999999e-265Initial program 99.5%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6451.0%
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites26.6%
if -1.1499999999999999e-265 < z < 7.1999999999999999e-17Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around 0
Applied rewrites26.1%
if 7.1999999999999999e-17 < z Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
(FPCore (x y z)
:precision binary64
(if (<= z -1.35e+219)
(* x (* 6.0 z))
(if (<= z -9.8e-21)
(* -6.0 (* y z))
(if (<= z -1.15e-265)
(+ x (* 4.0 y))
(if (<= z 7.2e-17) (* x -3.0) (* 6.0 (* x z)))))))double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+219) {
tmp = x * (6.0 * z);
} else if (z <= -9.8e-21) {
tmp = -6.0 * (y * z);
} else if (z <= -1.15e-265) {
tmp = x + (4.0 * y);
} else if (z <= 7.2e-17) {
tmp = x * -3.0;
} else {
tmp = 6.0 * (x * z);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.35d+219)) then
tmp = x * (6.0d0 * z)
else if (z <= (-9.8d-21)) then
tmp = (-6.0d0) * (y * z)
else if (z <= (-1.15d-265)) then
tmp = x + (4.0d0 * y)
else if (z <= 7.2d-17) then
tmp = x * (-3.0d0)
else
tmp = 6.0d0 * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+219) {
tmp = x * (6.0 * z);
} else if (z <= -9.8e-21) {
tmp = -6.0 * (y * z);
} else if (z <= -1.15e-265) {
tmp = x + (4.0 * y);
} else if (z <= 7.2e-17) {
tmp = x * -3.0;
} else {
tmp = 6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.35e+219: tmp = x * (6.0 * z) elif z <= -9.8e-21: tmp = -6.0 * (y * z) elif z <= -1.15e-265: tmp = x + (4.0 * y) elif z <= 7.2e-17: tmp = x * -3.0 else: tmp = 6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.35e+219) tmp = Float64(x * Float64(6.0 * z)); elseif (z <= -9.8e-21) tmp = Float64(-6.0 * Float64(y * z)); elseif (z <= -1.15e-265) tmp = Float64(x + Float64(4.0 * y)); elseif (z <= 7.2e-17) tmp = Float64(x * -3.0); else tmp = Float64(6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.35e+219) tmp = x * (6.0 * z); elseif (z <= -9.8e-21) tmp = -6.0 * (y * z); elseif (z <= -1.15e-265) tmp = x + (4.0 * y); elseif (z <= 7.2e-17) tmp = x * -3.0; else tmp = 6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.35e+219], N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.8e-21], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.15e-265], N[(x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-17], N[(x * -3.0), $MachinePrecision], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+219}:\\
\;\;\;\;x \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq -9.8 \cdot 10^{-21}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-265}:\\
\;\;\;\;x + 4 \cdot y\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-17}:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\end{array}
if z < -1.3499999999999999e219Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around 0
Applied rewrites26.1%
Taylor expanded in z around inf
lower-*.f6427.9%
Applied rewrites27.9%
if -1.3499999999999999e219 < z < -9.8000000000000003e-21Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6426.8%
Applied rewrites26.8%
if -9.8000000000000003e-21 < z < -1.1499999999999999e-265Initial program 99.5%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6451.0%
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites26.6%
if -1.1499999999999999e-265 < z < 7.1999999999999999e-17Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around 0
Applied rewrites26.1%
if 7.1999999999999999e-17 < z Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* x z))))
(if (<= z -9.8e-21)
t_0
(if (<= z -1.15e-265)
(+ x (* 4.0 y))
(if (<= z 7.2e-17) (* x -3.0) t_0)))))double code(double x, double y, double z) {
double t_0 = 6.0 * (x * z);
double tmp;
if (z <= -9.8e-21) {
tmp = t_0;
} else if (z <= -1.15e-265) {
tmp = x + (4.0 * y);
} else if (z <= 7.2e-17) {
tmp = x * -3.0;
} 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 <= (-9.8d-21)) then
tmp = t_0
else if (z <= (-1.15d-265)) then
tmp = x + (4.0d0 * y)
else if (z <= 7.2d-17) then
tmp = x * (-3.0d0)
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 <= -9.8e-21) {
tmp = t_0;
} else if (z <= -1.15e-265) {
tmp = x + (4.0 * y);
} else if (z <= 7.2e-17) {
tmp = x * -3.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (x * z) tmp = 0 if z <= -9.8e-21: tmp = t_0 elif z <= -1.15e-265: tmp = x + (4.0 * y) elif z <= 7.2e-17: tmp = x * -3.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(x * z)) tmp = 0.0 if (z <= -9.8e-21) tmp = t_0; elseif (z <= -1.15e-265) tmp = Float64(x + Float64(4.0 * y)); elseif (z <= 7.2e-17) tmp = Float64(x * -3.0); 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 <= -9.8e-21) tmp = t_0; elseif (z <= -1.15e-265) tmp = x + (4.0 * y); elseif (z <= 7.2e-17) tmp = x * -3.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.8e-21], t$95$0, If[LessEqual[z, -1.15e-265], N[(x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-17], N[(x * -3.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -9.8 \cdot 10^{-21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-265}:\\
\;\;\;\;x + 4 \cdot y\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-17}:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -9.8000000000000003e-21 or 7.1999999999999999e-17 < z Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6427.9%
Applied rewrites27.9%
if -9.8000000000000003e-21 < z < -1.1499999999999999e-265Initial program 99.5%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6451.0%
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites26.6%
if -1.1499999999999999e-265 < z < 7.1999999999999999e-17Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around 0
Applied rewrites26.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.1e-83) (* x -3.0) (if (<= x 8.8e-101) (+ x (* 4.0 y)) (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.1e-83) {
tmp = x * -3.0;
} else if (x <= 8.8e-101) {
tmp = x + (4.0 * y);
} else {
tmp = x * -3.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 (x <= (-1.1d-83)) then
tmp = x * (-3.0d0)
else if (x <= 8.8d-101) then
tmp = x + (4.0d0 * y)
else
tmp = x * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.1e-83) {
tmp = x * -3.0;
} else if (x <= 8.8e-101) {
tmp = x + (4.0 * y);
} else {
tmp = x * -3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.1e-83: tmp = x * -3.0 elif x <= 8.8e-101: tmp = x + (4.0 * y) else: tmp = x * -3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.1e-83) tmp = Float64(x * -3.0); elseif (x <= 8.8e-101) tmp = Float64(x + Float64(4.0 * y)); else tmp = Float64(x * -3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.1e-83) tmp = x * -3.0; elseif (x <= 8.8e-101) tmp = x + (4.0 * y); else tmp = x * -3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.1e-83], N[(x * -3.0), $MachinePrecision], If[LessEqual[x, 8.8e-101], N[(x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-83}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-101}:\\
\;\;\;\;x + 4 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
if x < -1.1e-83 or 8.7999999999999996e-101 < x Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around 0
Applied rewrites26.1%
if -1.1e-83 < x < 8.7999999999999996e-101Initial program 99.5%
Taylor expanded in z around 0
lower-*.f64N/A
lower--.f6451.0%
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites26.6%
(FPCore (x y z) :precision binary64 (* x -3.0))
double code(double x, double y, double z) {
return x * -3.0;
}
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 * (-3.0d0)
end function
public static double code(double x, double y, double z) {
return x * -3.0;
}
def code(x, y, z): return x * -3.0
function code(x, y, z) return Float64(x * -3.0) end
function tmp = code(x, y, z) tmp = x * -3.0; end
code[x_, y_, z_] := N[(x * -3.0), $MachinePrecision]
x \cdot -3
Initial program 99.5%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
metadata-eval51.8%
Applied rewrites51.8%
Taylor expanded in z around 0
Applied rewrites26.1%
herbie shell --seed 2025202
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
:precision binary64
(+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))