
(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]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
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]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
(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]
\mathsf{fma}\left(y - x, z \cdot 6, x\right)
Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (fma (* (- x y) z) -6.0 x))
double code(double x, double y, double z) {
return fma(((x - y) * z), -6.0, x);
}
function code(x, y, z) return fma(Float64(Float64(x - y) * z), -6.0, x) end
code[x_, y_, z_] := N[(N[(N[(x - y), $MachinePrecision] * z), $MachinePrecision] * -6.0 + x), $MachinePrecision]
\mathsf{fma}\left(\left(x - y\right) \cdot z, -6, x\right)
Initial program 99.7%
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-flipN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-+l+N/A
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (* 6.0 (- y x))))) (if (<= z -27000.0) t_0 (if (<= z 420.0) (+ x (* 6.0 (* y z))) t_0))))
double code(double x, double y, double z) {
double t_0 = z * (6.0 * (y - x));
double tmp;
if (z <= -27000.0) {
tmp = t_0;
} else if (z <= 420.0) {
tmp = x + (6.0 * (y * z));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (6.0d0 * (y - x))
if (z <= (-27000.0d0)) then
tmp = t_0
else if (z <= 420.0d0) then
tmp = x + (6.0d0 * (y * z))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (6.0 * (y - x));
double tmp;
if (z <= -27000.0) {
tmp = t_0;
} else if (z <= 420.0) {
tmp = x + (6.0 * (y * z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (6.0 * (y - x)) tmp = 0 if z <= -27000.0: tmp = t_0 elif z <= 420.0: tmp = x + (6.0 * (y * z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(6.0 * Float64(y - x))) tmp = 0.0 if (z <= -27000.0) tmp = t_0; elseif (z <= 420.0) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (6.0 * (y - x)); tmp = 0.0; if (z <= -27000.0) tmp = t_0; elseif (z <= 420.0) tmp = x + (6.0 * (y * z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -27000.0], t$95$0, If[LessEqual[z, 420.0], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := z \cdot \left(6 \cdot \left(y - x\right)\right)\\
\mathbf{if}\;z \leq -27000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 420:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -27000 or 420 < z Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6487.4%
Applied rewrites87.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f6464.3%
Applied rewrites64.3%
if -27000 < z < 420Initial program 99.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6476.5%
Applied rewrites76.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (* 6.0 (- y x))))) (if (<= z -27000.0) t_0 (if (<= z 420.0) (fma y (* z 6.0) x) t_0))))
double code(double x, double y, double z) {
double t_0 = z * (6.0 * (y - x));
double tmp;
if (z <= -27000.0) {
tmp = t_0;
} else if (z <= 420.0) {
tmp = fma(y, (z * 6.0), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * Float64(6.0 * Float64(y - x))) tmp = 0.0 if (z <= -27000.0) tmp = t_0; elseif (z <= 420.0) 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[(z * N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -27000.0], t$95$0, If[LessEqual[z, 420.0], N[(y * N[(z * 6.0), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := z \cdot \left(6 \cdot \left(y - x\right)\right)\\
\mathbf{if}\;z \leq -27000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 420:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -27000 or 420 < z Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6487.4%
Applied rewrites87.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f6464.3%
Applied rewrites64.3%
if -27000 < z < 420Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites76.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma y (* z 6.0) x))) (if (<= y -2.1e-37) t_0 (if (<= y 1.45e-46) (fma (* -6.0 z) x x) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(y, (z * 6.0), x);
double tmp;
if (y <= -2.1e-37) {
tmp = t_0;
} else if (y <= 1.45e-46) {
tmp = fma((-6.0 * z), x, 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 <= -2.1e-37) tmp = t_0; elseif (y <= 1.45e-46) tmp = fma(Float64(-6.0 * z), x, 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, -2.1e-37], t$95$0, If[LessEqual[y, 1.45e-46], N[(N[(-6.0 * z), $MachinePrecision] * x + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(y, z \cdot 6, x\right)\\
\mathbf{if}\;y \leq -2.1 \cdot 10^{-37}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(-6 \cdot z, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -2.1000000000000001e-37 or 1.45e-46 < y Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites76.5%
if -2.1000000000000001e-37 < y < 1.45e-46Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f6462.0%
Applied rewrites62.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (* x z) -6.0 x))) (if (<= x -1.3e-95) t_0 (if (<= x 2.1e-78) (* 6.0 (* y z)) t_0))))
double code(double x, double y, double z) {
double t_0 = fma((x * z), -6.0, x);
double tmp;
if (x <= -1.3e-95) {
tmp = t_0;
} else if (x <= 2.1e-78) {
tmp = 6.0 * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(Float64(x * z), -6.0, x) tmp = 0.0 if (x <= -1.3e-95) tmp = t_0; elseif (x <= 2.1e-78) tmp = Float64(6.0 * Float64(y * z)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * z), $MachinePrecision] * -6.0 + x), $MachinePrecision]}, If[LessEqual[x, -1.3e-95], t$95$0, If[LessEqual[x, 2.1e-78], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(x \cdot z, -6, x\right)\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{-95}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-78}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -1.3e-95 or 2.1000000000000001e-78 < x Initial program 99.7%
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-flipN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-+l+N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-*.f6462.0%
Applied rewrites62.0%
if -1.3e-95 < x < 2.1000000000000001e-78Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6441.8%
Applied rewrites41.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (* -6.0 z) x x))) (if (<= x -1.3e-95) t_0 (if (<= x 2.1e-78) (* 6.0 (* y z)) t_0))))
double code(double x, double y, double z) {
double t_0 = fma((-6.0 * z), x, x);
double tmp;
if (x <= -1.3e-95) {
tmp = t_0;
} else if (x <= 2.1e-78) {
tmp = 6.0 * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(Float64(-6.0 * z), x, x) tmp = 0.0 if (x <= -1.3e-95) tmp = t_0; elseif (x <= 2.1e-78) tmp = Float64(6.0 * Float64(y * z)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-6.0 * z), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[x, -1.3e-95], t$95$0, If[LessEqual[x, 2.1e-78], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(-6 \cdot z, x, x\right)\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{-95}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-78}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -1.3e-95 or 2.1000000000000001e-78 < x Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f6462.0%
Applied rewrites62.0%
if -1.3e-95 < x < 2.1000000000000001e-78Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6441.8%
Applied rewrites41.8%
(FPCore (x y z)
:precision binary64
(if (<= z -1.62e-49)
(* z (* 6.0 y))
(if (<= z 5.2e-19)
(* x 1.0)
(if (<= z 1.7e+165) (* (* z 6.0) y) (* z (* -6.0 x))))))double code(double x, double y, double z) {
double tmp;
if (z <= -1.62e-49) {
tmp = z * (6.0 * y);
} else if (z <= 5.2e-19) {
tmp = x * 1.0;
} else if (z <= 1.7e+165) {
tmp = (z * 6.0) * y;
} else {
tmp = z * (-6.0 * x);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.62d-49)) then
tmp = z * (6.0d0 * y)
else if (z <= 5.2d-19) then
tmp = x * 1.0d0
else if (z <= 1.7d+165) then
tmp = (z * 6.0d0) * y
else
tmp = z * ((-6.0d0) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.62e-49) {
tmp = z * (6.0 * y);
} else if (z <= 5.2e-19) {
tmp = x * 1.0;
} else if (z <= 1.7e+165) {
tmp = (z * 6.0) * y;
} else {
tmp = z * (-6.0 * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.62e-49: tmp = z * (6.0 * y) elif z <= 5.2e-19: tmp = x * 1.0 elif z <= 1.7e+165: tmp = (z * 6.0) * y else: tmp = z * (-6.0 * x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.62e-49) tmp = Float64(z * Float64(6.0 * y)); elseif (z <= 5.2e-19) tmp = Float64(x * 1.0); elseif (z <= 1.7e+165) tmp = Float64(Float64(z * 6.0) * y); else tmp = Float64(z * Float64(-6.0 * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.62e-49) tmp = z * (6.0 * y); elseif (z <= 5.2e-19) tmp = x * 1.0; elseif (z <= 1.7e+165) tmp = (z * 6.0) * y; else tmp = z * (-6.0 * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.62e-49], N[(z * N[(6.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e-19], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 1.7e+165], N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision], N[(z * N[(-6.0 * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.62 \cdot 10^{-49}:\\
\;\;\;\;z \cdot \left(6 \cdot y\right)\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-19}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+165}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-6 \cdot x\right)\\
\end{array}
if z < -1.62e-49Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6487.4%
Applied rewrites87.4%
Taylor expanded in x around 0
lower-*.f6441.7%
Applied rewrites41.7%
if -1.62e-49 < z < 5.2000000000000003e-19Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites37.1%
if 5.2000000000000003e-19 < z < 1.7000000000000001e165Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6441.8%
Applied rewrites41.8%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6441.8%
Applied rewrites41.8%
if 1.7000000000000001e165 < z Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6487.4%
Applied rewrites87.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f6464.3%
Applied rewrites64.3%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-/.f6449.6%
Applied rewrites49.6%
Taylor expanded in z around inf
lower-*.f6427.1%
Applied rewrites27.1%
(FPCore (x y z)
:precision binary64
(if (<= z -1.62e-49)
(* z (* 6.0 y))
(if (<= z 5.2e-19)
(* x 1.0)
(if (<= z 1.7e+165) (* 6.0 (* y z)) (* z (* -6.0 x))))))double code(double x, double y, double z) {
double tmp;
if (z <= -1.62e-49) {
tmp = z * (6.0 * y);
} else if (z <= 5.2e-19) {
tmp = x * 1.0;
} else if (z <= 1.7e+165) {
tmp = 6.0 * (y * z);
} else {
tmp = z * (-6.0 * x);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.62d-49)) then
tmp = z * (6.0d0 * y)
else if (z <= 5.2d-19) then
tmp = x * 1.0d0
else if (z <= 1.7d+165) then
tmp = 6.0d0 * (y * z)
else
tmp = z * ((-6.0d0) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.62e-49) {
tmp = z * (6.0 * y);
} else if (z <= 5.2e-19) {
tmp = x * 1.0;
} else if (z <= 1.7e+165) {
tmp = 6.0 * (y * z);
} else {
tmp = z * (-6.0 * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.62e-49: tmp = z * (6.0 * y) elif z <= 5.2e-19: tmp = x * 1.0 elif z <= 1.7e+165: tmp = 6.0 * (y * z) else: tmp = z * (-6.0 * x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.62e-49) tmp = Float64(z * Float64(6.0 * y)); elseif (z <= 5.2e-19) tmp = Float64(x * 1.0); elseif (z <= 1.7e+165) tmp = Float64(6.0 * Float64(y * z)); else tmp = Float64(z * Float64(-6.0 * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.62e-49) tmp = z * (6.0 * y); elseif (z <= 5.2e-19) tmp = x * 1.0; elseif (z <= 1.7e+165) tmp = 6.0 * (y * z); else tmp = z * (-6.0 * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.62e-49], N[(z * N[(6.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e-19], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 1.7e+165], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(z * N[(-6.0 * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.62 \cdot 10^{-49}:\\
\;\;\;\;z \cdot \left(6 \cdot y\right)\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-19}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+165}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-6 \cdot x\right)\\
\end{array}
if z < -1.62e-49Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6487.4%
Applied rewrites87.4%
Taylor expanded in x around 0
lower-*.f6441.7%
Applied rewrites41.7%
if -1.62e-49 < z < 5.2000000000000003e-19Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites37.1%
if 5.2000000000000003e-19 < z < 1.7000000000000001e165Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f6441.8%
Applied rewrites41.8%
if 1.7000000000000001e165 < z Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6487.4%
Applied rewrites87.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f6464.3%
Applied rewrites64.3%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-/.f6449.6%
Applied rewrites49.6%
Taylor expanded in z around inf
lower-*.f6427.1%
Applied rewrites27.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* 6.0 y))))
(if (<= z -1.62e-49)
t_0
(if (<= z 5.2e-19) (* x 1.0) (if (<= z 1.7e+165) t_0 (* z (* -6.0 x)))))))double code(double x, double y, double z) {
double t_0 = z * (6.0 * y);
double tmp;
if (z <= -1.62e-49) {
tmp = t_0;
} else if (z <= 5.2e-19) {
tmp = x * 1.0;
} else if (z <= 1.7e+165) {
tmp = t_0;
} else {
tmp = z * (-6.0 * x);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * (6.0d0 * y)
if (z <= (-1.62d-49)) then
tmp = t_0
else if (z <= 5.2d-19) then
tmp = x * 1.0d0
else if (z <= 1.7d+165) then
tmp = t_0
else
tmp = z * ((-6.0d0) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (6.0 * y);
double tmp;
if (z <= -1.62e-49) {
tmp = t_0;
} else if (z <= 5.2e-19) {
tmp = x * 1.0;
} else if (z <= 1.7e+165) {
tmp = t_0;
} else {
tmp = z * (-6.0 * x);
}
return tmp;
}
def code(x, y, z): t_0 = z * (6.0 * y) tmp = 0 if z <= -1.62e-49: tmp = t_0 elif z <= 5.2e-19: tmp = x * 1.0 elif z <= 1.7e+165: tmp = t_0 else: tmp = z * (-6.0 * x) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(6.0 * y)) tmp = 0.0 if (z <= -1.62e-49) tmp = t_0; elseif (z <= 5.2e-19) tmp = Float64(x * 1.0); elseif (z <= 1.7e+165) tmp = t_0; else tmp = Float64(z * Float64(-6.0 * x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (6.0 * y); tmp = 0.0; if (z <= -1.62e-49) tmp = t_0; elseif (z <= 5.2e-19) tmp = x * 1.0; elseif (z <= 1.7e+165) tmp = t_0; else tmp = z * (-6.0 * x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(6.0 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.62e-49], t$95$0, If[LessEqual[z, 5.2e-19], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 1.7e+165], t$95$0, N[(z * N[(-6.0 * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := z \cdot \left(6 \cdot y\right)\\
\mathbf{if}\;z \leq -1.62 \cdot 10^{-49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-19}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+165}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-6 \cdot x\right)\\
\end{array}
if z < -1.62e-49 or 5.2000000000000003e-19 < z < 1.7000000000000001e165Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6487.4%
Applied rewrites87.4%
Taylor expanded in x around 0
lower-*.f6441.7%
Applied rewrites41.7%
if -1.62e-49 < z < 5.2000000000000003e-19Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites37.1%
if 1.7000000000000001e165 < z Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6487.4%
Applied rewrites87.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f6464.3%
Applied rewrites64.3%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-/.f6449.6%
Applied rewrites49.6%
Taylor expanded in z around inf
lower-*.f6427.1%
Applied rewrites27.1%
(FPCore (x y z) :precision binary64 (if (<= z -27000.0) (* z (* -6.0 x)) (if (<= z 6.4e+15) (* x 1.0) (* x (* -6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -27000.0) {
tmp = z * (-6.0 * x);
} else if (z <= 6.4e+15) {
tmp = x * 1.0;
} else {
tmp = x * (-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 <= (-27000.0d0)) then
tmp = z * ((-6.0d0) * x)
else if (z <= 6.4d+15) then
tmp = x * 1.0d0
else
tmp = x * ((-6.0d0) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -27000.0) {
tmp = z * (-6.0 * x);
} else if (z <= 6.4e+15) {
tmp = x * 1.0;
} else {
tmp = x * (-6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -27000.0: tmp = z * (-6.0 * x) elif z <= 6.4e+15: tmp = x * 1.0 else: tmp = x * (-6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -27000.0) tmp = Float64(z * Float64(-6.0 * x)); elseif (z <= 6.4e+15) tmp = Float64(x * 1.0); else tmp = Float64(x * Float64(-6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -27000.0) tmp = z * (-6.0 * x); elseif (z <= 6.4e+15) tmp = x * 1.0; else tmp = x * (-6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -27000.0], N[(z * N[(-6.0 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.4e+15], N[(x * 1.0), $MachinePrecision], N[(x * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -27000:\\
\;\;\;\;z \cdot \left(-6 \cdot x\right)\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+15}:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-6 \cdot z\right)\\
\end{array}
if z < -27000Initial program 99.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6487.4%
Applied rewrites87.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f6464.3%
Applied rewrites64.3%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-/.f6449.6%
Applied rewrites49.6%
Taylor expanded in z around inf
lower-*.f6427.1%
Applied rewrites27.1%
if -27000 < z < 6.4e15Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites37.1%
if 6.4e15 < z Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites37.1%
Taylor expanded in z around inf
lower-*.f6427.1%
Applied rewrites27.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (* -6.0 z)))) (if (<= z -27000.0) t_0 (if (<= z 6.4e+15) (* x 1.0) t_0))))
double code(double x, double y, double z) {
double t_0 = x * (-6.0 * z);
double tmp;
if (z <= -27000.0) {
tmp = t_0;
} else if (z <= 6.4e+15) {
tmp = x * 1.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 = x * ((-6.0d0) * z)
if (z <= (-27000.0d0)) then
tmp = t_0
else if (z <= 6.4d+15) then
tmp = x * 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (-6.0 * z);
double tmp;
if (z <= -27000.0) {
tmp = t_0;
} else if (z <= 6.4e+15) {
tmp = x * 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (-6.0 * z) tmp = 0 if z <= -27000.0: tmp = t_0 elif z <= 6.4e+15: tmp = x * 1.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-6.0 * z)) tmp = 0.0 if (z <= -27000.0) tmp = t_0; elseif (z <= 6.4e+15) tmp = Float64(x * 1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-6.0 * z); tmp = 0.0; if (z <= -27000.0) tmp = t_0; elseif (z <= 6.4e+15) tmp = x * 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -27000.0], t$95$0, If[LessEqual[z, 6.4e+15], N[(x * 1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := x \cdot \left(-6 \cdot z\right)\\
\mathbf{if}\;z \leq -27000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+15}:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -27000 or 6.4e15 < z Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites37.1%
Taylor expanded in z around inf
lower-*.f6427.1%
Applied rewrites27.1%
if -27000 < z < 6.4e15Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites37.1%
(FPCore (x y z) :precision binary64 (* x 1.0))
double code(double x, double y, double z) {
return x * 1.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 * 1.0d0
end function
public static double code(double x, double y, double z) {
return x * 1.0;
}
def code(x, y, z): return x * 1.0
function code(x, y, z) return Float64(x * 1.0) end
function tmp = code(x, y, z) tmp = x * 1.0; end
code[x_, y_, z_] := N[(x * 1.0), $MachinePrecision]
x \cdot 1
Initial program 99.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6461.9%
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites37.1%
herbie shell --seed 2025204
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
(+ x (* (* (- y x) 6.0) z)))