
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (fma y 5.0 (* (+ (fma 2.0 y z) (+ z t)) x)))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, ((fma(2.0, y, z) + (z + t)) * x));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(Float64(fma(2.0, y, z) + Float64(z + t)) * x)) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(N[(N[(2.0 * y + z), $MachinePrecision] + N[(z + t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, \left(\mathsf{fma}\left(2, y, z\right) + \left(z + t\right)\right) \cdot x\right)
\end{array}
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
count-2-revN/A
associate-+r+N/A
associate-+l+N/A
lower-+.f64N/A
+-commutativeN/A
associate-+r+N/A
count-2-revN/A
lower-fma.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
(FPCore (x y z t) :precision binary64 (fma y 5.0 (* (fma 2.0 (+ z y) t) x)))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (fma(2.0, (z + y), t) * x));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(fma(2.0, Float64(z + y), t) * x)) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z + y, t\right) \cdot x\right)
\end{array}
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.4e-16)
(fma 5.0 y (* x (+ t (* 2.0 y))))
(if (<= y 7.4e+83)
(fma y 5.0 (* (fma 2.0 z t) x))
(fma y 5.0 (* (* 2.0 (+ y z)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.4e-16) {
tmp = fma(5.0, y, (x * (t + (2.0 * y))));
} else if (y <= 7.4e+83) {
tmp = fma(y, 5.0, (fma(2.0, z, t) * x));
} else {
tmp = fma(y, 5.0, ((2.0 * (y + z)) * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.4e-16) tmp = fma(5.0, y, Float64(x * Float64(t + Float64(2.0 * y)))); elseif (y <= 7.4e+83) tmp = fma(y, 5.0, Float64(fma(2.0, z, t) * x)); else tmp = fma(y, 5.0, Float64(Float64(2.0 * Float64(y + z)) * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.4e-16], N[(5.0 * y + N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.4e+83], N[(y * 5.0 + N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(y * 5.0 + N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(5, y, x \cdot \left(t + 2 \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z, t\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \left(2 \cdot \left(y + z\right)\right) \cdot x\right)\\
\end{array}
\end{array}
if y < -2.40000000000000005e-16Initial program 99.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6474.2
Applied rewrites74.2%
if -2.40000000000000005e-16 < y < 7.4000000000000005e83Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites84.7%
if 7.4000000000000005e83 < y Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
lower-*.f64N/A
lower-+.f6474.4
Applied rewrites74.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma 5.0 y (* x (+ t (* 2.0 y))))))
(if (<= y -2.4e-16)
t_1
(if (<= y 1.8e+87) (fma y 5.0 (* (fma 2.0 z t) x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(5.0, y, (x * (t + (2.0 * y))));
double tmp;
if (y <= -2.4e-16) {
tmp = t_1;
} else if (y <= 1.8e+87) {
tmp = fma(y, 5.0, (fma(2.0, z, t) * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(5.0, y, Float64(x * Float64(t + Float64(2.0 * y)))) tmp = 0.0 if (y <= -2.4e-16) tmp = t_1; elseif (y <= 1.8e+87) tmp = fma(y, 5.0, Float64(fma(2.0, z, t) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(5.0 * y + N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4e-16], t$95$1, If[LessEqual[y, 1.8e+87], N[(y * 5.0 + N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(5, y, x \cdot \left(t + 2 \cdot y\right)\right)\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z, t\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.40000000000000005e-16 or 1.79999999999999997e87 < y Initial program 99.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6474.2
Applied rewrites74.2%
if -2.40000000000000005e-16 < y < 1.79999999999999997e87Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites84.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (fma 2.0 y t) x (* 5.0 y))))
(if (<= y -2.4e-16)
t_1
(if (<= y 1.8e+87) (fma y 5.0 (* (fma 2.0 z t) x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(fma(2.0, y, t), x, (5.0 * y));
double tmp;
if (y <= -2.4e-16) {
tmp = t_1;
} else if (y <= 1.8e+87) {
tmp = fma(y, 5.0, (fma(2.0, z, t) * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(fma(2.0, y, t), x, Float64(5.0 * y)) tmp = 0.0 if (y <= -2.4e-16) tmp = t_1; elseif (y <= 1.8e+87) tmp = fma(y, 5.0, Float64(fma(2.0, z, t) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * y + t), $MachinePrecision] * x + N[(5.0 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4e-16], t$95$1, If[LessEqual[y, 1.8e+87], N[(y * 5.0 + N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(2, y, t\right), x, 5 \cdot y\right)\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z, t\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.40000000000000005e-16 or 1.79999999999999997e87 < y Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6474.2
Applied rewrites74.2%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-fma.f64N/A
Applied rewrites74.1%
if -2.40000000000000005e-16 < y < 1.79999999999999997e87Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites84.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (- x -5.0) y (* x y))))
(if (<= y -9.4e+145)
t_1
(if (<= y 1.9e+88) (fma y 5.0 (* (fma 2.0 z t) x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((x - -5.0), y, (x * y));
double tmp;
if (y <= -9.4e+145) {
tmp = t_1;
} else if (y <= 1.9e+88) {
tmp = fma(y, 5.0, (fma(2.0, z, t) * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(x - -5.0), y, Float64(x * y)) tmp = 0.0 if (y <= -9.4e+145) tmp = t_1; elseif (y <= 1.9e+88) tmp = fma(y, 5.0, Float64(fma(2.0, z, t) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - -5.0), $MachinePrecision] * y + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.4e+145], t$95$1, If[LessEqual[y, 1.9e+88], N[(y * 5.0 + N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - -5, y, x \cdot y\right)\\
\mathbf{if}\;y \leq -9.4 \cdot 10^{+145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z, t\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.4000000000000004e145 or 1.8999999999999998e88 < y Initial program 99.8%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.7
Applied rewrites47.7%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
count-2-revN/A
associate-+r+N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6447.7
Applied rewrites47.7%
if -9.4000000000000004e145 < y < 1.8999999999999998e88Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites84.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (- x -5.0) y (* x y)))) (if (<= y -4.9e-34) t_1 (if (<= y 1.46e+27) (* x (+ t (* 2.0 z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((x - -5.0), y, (x * y));
double tmp;
if (y <= -4.9e-34) {
tmp = t_1;
} else if (y <= 1.46e+27) {
tmp = x * (t + (2.0 * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(x - -5.0), y, Float64(x * y)) tmp = 0.0 if (y <= -4.9e-34) tmp = t_1; elseif (y <= 1.46e+27) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - -5.0), $MachinePrecision] * y + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.9e-34], t$95$1, If[LessEqual[y, 1.46e+27], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - -5, y, x \cdot y\right)\\
\mathbf{if}\;y \leq -4.9 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{+27}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.89999999999999962e-34 or 1.46000000000000002e27 < y Initial program 99.8%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.7
Applied rewrites47.7%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
count-2-revN/A
associate-+r+N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6447.7
Applied rewrites47.7%
if -4.89999999999999962e-34 < y < 1.46000000000000002e27Initial program 99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6457.1
Applied rewrites57.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma x 2.0 5.0) y))) (if (<= y -4.9e-34) t_1 (if (<= y 1.46e+27) (* x (+ t (* 2.0 z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, 2.0, 5.0) * y;
double tmp;
if (y <= -4.9e-34) {
tmp = t_1;
} else if (y <= 1.46e+27) {
tmp = x * (t + (2.0 * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(x, 2.0, 5.0) * y) tmp = 0.0 if (y <= -4.9e-34) tmp = t_1; elseif (y <= 1.46e+27) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 2.0 + 5.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4.9e-34], t$95$1, If[LessEqual[y, 1.46e+27], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, 2, 5\right) \cdot y\\
\mathbf{if}\;y \leq -4.9 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{+27}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.89999999999999962e-34 or 1.46000000000000002e27 < y Initial program 99.8%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.7
Applied rewrites47.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6447.7
Applied rewrites47.7%
if -4.89999999999999962e-34 < y < 1.46000000000000002e27Initial program 99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6457.1
Applied rewrites57.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma x 2.0 5.0) y))) (if (<= y -4.5e+144) t_1 (if (<= y 7.4e+83) (fma y 5.0 (* t x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, 2.0, 5.0) * y;
double tmp;
if (y <= -4.5e+144) {
tmp = t_1;
} else if (y <= 7.4e+83) {
tmp = fma(y, 5.0, (t * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(x, 2.0, 5.0) * y) tmp = 0.0 if (y <= -4.5e+144) tmp = t_1; elseif (y <= 7.4e+83) tmp = fma(y, 5.0, Float64(t * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 2.0 + 5.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4.5e+144], t$95$1, If[LessEqual[y, 7.4e+83], N[(y * 5.0 + N[(t * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, 2, 5\right) \cdot y\\
\mathbf{if}\;y \leq -4.5 \cdot 10^{+144}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.49999999999999967e144 or 7.4000000000000005e83 < y Initial program 99.8%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.7
Applied rewrites47.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6447.7
Applied rewrites47.7%
if -4.49999999999999967e144 < y < 7.4000000000000005e83Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6474.2
Applied rewrites74.2%
Taylor expanded in y around 0
Applied rewrites57.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma x 2.0 5.0) y)))
(if (<= y -3.85e-34)
t_1
(if (<= y -8e-124) (* (+ z z) x) (if (<= y 2.8e-47) (* t x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, 2.0, 5.0) * y;
double tmp;
if (y <= -3.85e-34) {
tmp = t_1;
} else if (y <= -8e-124) {
tmp = (z + z) * x;
} else if (y <= 2.8e-47) {
tmp = t * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(x, 2.0, 5.0) * y) tmp = 0.0 if (y <= -3.85e-34) tmp = t_1; elseif (y <= -8e-124) tmp = Float64(Float64(z + z) * x); elseif (y <= 2.8e-47) tmp = Float64(t * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 2.0 + 5.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -3.85e-34], t$95$1, If[LessEqual[y, -8e-124], N[(N[(z + z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 2.8e-47], N[(t * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, 2, 5\right) \cdot y\\
\mathbf{if}\;y \leq -3.85 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-124}:\\
\;\;\;\;\left(z + z\right) \cdot x\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-47}:\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.85e-34 or 2.79999999999999993e-47 < y Initial program 99.8%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.7
Applied rewrites47.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6447.7
Applied rewrites47.7%
if -3.85e-34 < y < -7.99999999999999947e-124Initial program 99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6430.9
Applied rewrites30.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6430.9
lift-*.f64N/A
count-2-revN/A
lower-+.f6430.9
Applied rewrites30.9%
if -7.99999999999999947e-124 < y < 2.79999999999999993e-47Initial program 99.8%
Taylor expanded in t around inf
lower-*.f6430.5
Applied rewrites30.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x y))))
(if (<= x -7.5e+224)
(* t x)
(if (<= x -4.4e+127)
t_1
(if (<= x -0.0018)
(* t x)
(if (<= x 235.0)
(* 5.0 y)
(if (<= x 1.1e+133) t_1 (* (+ z z) x))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * y);
double tmp;
if (x <= -7.5e+224) {
tmp = t * x;
} else if (x <= -4.4e+127) {
tmp = t_1;
} else if (x <= -0.0018) {
tmp = t * x;
} else if (x <= 235.0) {
tmp = 5.0 * y;
} else if (x <= 1.1e+133) {
tmp = t_1;
} else {
tmp = (z + z) * 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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * y)
if (x <= (-7.5d+224)) then
tmp = t * x
else if (x <= (-4.4d+127)) then
tmp = t_1
else if (x <= (-0.0018d0)) then
tmp = t * x
else if (x <= 235.0d0) then
tmp = 5.0d0 * y
else if (x <= 1.1d+133) then
tmp = t_1
else
tmp = (z + z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * y);
double tmp;
if (x <= -7.5e+224) {
tmp = t * x;
} else if (x <= -4.4e+127) {
tmp = t_1;
} else if (x <= -0.0018) {
tmp = t * x;
} else if (x <= 235.0) {
tmp = 5.0 * y;
} else if (x <= 1.1e+133) {
tmp = t_1;
} else {
tmp = (z + z) * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * y) tmp = 0 if x <= -7.5e+224: tmp = t * x elif x <= -4.4e+127: tmp = t_1 elif x <= -0.0018: tmp = t * x elif x <= 235.0: tmp = 5.0 * y elif x <= 1.1e+133: tmp = t_1 else: tmp = (z + z) * x return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * y)) tmp = 0.0 if (x <= -7.5e+224) tmp = Float64(t * x); elseif (x <= -4.4e+127) tmp = t_1; elseif (x <= -0.0018) tmp = Float64(t * x); elseif (x <= 235.0) tmp = Float64(5.0 * y); elseif (x <= 1.1e+133) tmp = t_1; else tmp = Float64(Float64(z + z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * y); tmp = 0.0; if (x <= -7.5e+224) tmp = t * x; elseif (x <= -4.4e+127) tmp = t_1; elseif (x <= -0.0018) tmp = t * x; elseif (x <= 235.0) tmp = 5.0 * y; elseif (x <= 1.1e+133) tmp = t_1; else tmp = (z + z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e+224], N[(t * x), $MachinePrecision], If[LessEqual[x, -4.4e+127], t$95$1, If[LessEqual[x, -0.0018], N[(t * x), $MachinePrecision], If[LessEqual[x, 235.0], N[(5.0 * y), $MachinePrecision], If[LessEqual[x, 1.1e+133], t$95$1, N[(N[(z + z), $MachinePrecision] * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot y\right)\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{+224}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -0.0018:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 235:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(z + z\right) \cdot x\\
\end{array}
\end{array}
if x < -7.500000000000001e224 or -4.4000000000000003e127 < x < -0.0018Initial program 99.8%
Taylor expanded in t around inf
lower-*.f6430.5
Applied rewrites30.5%
if -7.500000000000001e224 < x < -4.4000000000000003e127 or 235 < x < 1.1e133Initial program 99.8%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.7
Applied rewrites47.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6420.6
Applied rewrites20.6%
if -0.0018 < x < 235Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6429.6
Applied rewrites29.6%
if 1.1e133 < x Initial program 99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6430.9
Applied rewrites30.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6430.9
lift-*.f64N/A
count-2-revN/A
lower-+.f6430.9
Applied rewrites30.9%
(FPCore (x y z t) :precision binary64 (if (<= x -0.0018) (* t x) (if (<= x 5.5e-16) (* 5.0 y) (if (<= x 2.6e+40) (* t x) (* (+ z z) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0018) {
tmp = t * x;
} else if (x <= 5.5e-16) {
tmp = 5.0 * y;
} else if (x <= 2.6e+40) {
tmp = t * x;
} else {
tmp = (z + z) * 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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-0.0018d0)) then
tmp = t * x
else if (x <= 5.5d-16) then
tmp = 5.0d0 * y
else if (x <= 2.6d+40) then
tmp = t * x
else
tmp = (z + z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0018) {
tmp = t * x;
} else if (x <= 5.5e-16) {
tmp = 5.0 * y;
} else if (x <= 2.6e+40) {
tmp = t * x;
} else {
tmp = (z + z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.0018: tmp = t * x elif x <= 5.5e-16: tmp = 5.0 * y elif x <= 2.6e+40: tmp = t * x else: tmp = (z + z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.0018) tmp = Float64(t * x); elseif (x <= 5.5e-16) tmp = Float64(5.0 * y); elseif (x <= 2.6e+40) tmp = Float64(t * x); else tmp = Float64(Float64(z + z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -0.0018) tmp = t * x; elseif (x <= 5.5e-16) tmp = 5.0 * y; elseif (x <= 2.6e+40) tmp = t * x; else tmp = (z + z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.0018], N[(t * x), $MachinePrecision], If[LessEqual[x, 5.5e-16], N[(5.0 * y), $MachinePrecision], If[LessEqual[x, 2.6e+40], N[(t * x), $MachinePrecision], N[(N[(z + z), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0018:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-16}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+40}:\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(z + z\right) \cdot x\\
\end{array}
\end{array}
if x < -0.0018 or 5.49999999999999964e-16 < x < 2.6000000000000001e40Initial program 99.8%
Taylor expanded in t around inf
lower-*.f6430.5
Applied rewrites30.5%
if -0.0018 < x < 5.49999999999999964e-16Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6429.6
Applied rewrites29.6%
if 2.6000000000000001e40 < x Initial program 99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6430.9
Applied rewrites30.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lower-*.f6430.9
lift-*.f64N/A
count-2-revN/A
lower-+.f6430.9
Applied rewrites30.9%
(FPCore (x y z t) :precision binary64 (if (<= x -0.0018) (* t x) (if (<= x 5.5e-16) (* 5.0 y) (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0018) {
tmp = t * x;
} else if (x <= 5.5e-16) {
tmp = 5.0 * y;
} else {
tmp = t * 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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-0.0018d0)) then
tmp = t * x
else if (x <= 5.5d-16) then
tmp = 5.0d0 * y
else
tmp = t * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0018) {
tmp = t * x;
} else if (x <= 5.5e-16) {
tmp = 5.0 * y;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.0018: tmp = t * x elif x <= 5.5e-16: tmp = 5.0 * y else: tmp = t * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.0018) tmp = Float64(t * x); elseif (x <= 5.5e-16) tmp = Float64(5.0 * y); else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -0.0018) tmp = t * x; elseif (x <= 5.5e-16) tmp = 5.0 * y; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.0018], N[(t * x), $MachinePrecision], If[LessEqual[x, 5.5e-16], N[(5.0 * y), $MachinePrecision], N[(t * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0018:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-16}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if x < -0.0018 or 5.49999999999999964e-16 < x Initial program 99.8%
Taylor expanded in t around inf
lower-*.f6430.5
Applied rewrites30.5%
if -0.0018 < x < 5.49999999999999964e-16Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6429.6
Applied rewrites29.6%
(FPCore (x y z t) :precision binary64 (* 5.0 y))
double code(double x, double y, double z, double t) {
return 5.0 * y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 5.0d0 * y
end function
public static double code(double x, double y, double z, double t) {
return 5.0 * y;
}
def code(x, y, z, t): return 5.0 * y
function code(x, y, z, t) return Float64(5.0 * y) end
function tmp = code(x, y, z, t) tmp = 5.0 * y; end
code[x_, y_, z_, t_] := N[(5.0 * y), $MachinePrecision]
\begin{array}{l}
\\
5 \cdot y
\end{array}
Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6429.6
Applied rewrites29.6%
herbie shell --seed 2025154
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
:precision binary64
(+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))