
(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 13 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 (+ 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.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(if (<= t -3.45)
(fma y 5.0 (* (fma 2.0 z t) x))
(if (<= t 3.4e+28)
(fma y 5.0 (* (* 2.0 (+ y z)) x))
(fma 5.0 y (* x (+ t (* 2.0 y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.45) {
tmp = fma(y, 5.0, (fma(2.0, z, t) * x));
} else if (t <= 3.4e+28) {
tmp = fma(y, 5.0, ((2.0 * (y + z)) * x));
} else {
tmp = fma(5.0, y, (x * (t + (2.0 * y))));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= -3.45) tmp = fma(y, 5.0, Float64(fma(2.0, z, t) * x)); elseif (t <= 3.4e+28) tmp = fma(y, 5.0, Float64(Float64(2.0 * Float64(y + z)) * x)); else tmp = fma(5.0, y, Float64(x * Float64(t + Float64(2.0 * y)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.45], N[(y * 5.0 + N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e+28], N[(y * 5.0 + N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(5.0 * y + N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.45:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z, t\right) \cdot x\right)\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \left(2 \cdot \left(y + z\right)\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(5, y, x \cdot \left(t + 2 \cdot y\right)\right)\\
\end{array}
\end{array}
if t < -3.4500000000000002Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites84.4%
if -3.4500000000000002 < t < 3.4e28Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
lower-*.f64N/A
lower-+.f6474.6
Applied rewrites74.6%
if 3.4e28 < t Initial program 99.9%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6475.1
Applied rewrites75.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma 5.0 y (* x (+ t (* 2.0 y))))))
(if (<= y -4.2e-6)
t_1
(if (<= y 7.6e+63) (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 <= -4.2e-6) {
tmp = t_1;
} else if (y <= 7.6e+63) {
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 <= -4.2e-6) tmp = t_1; elseif (y <= 7.6e+63) 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, -4.2e-6], t$95$1, If[LessEqual[y, 7.6e+63], 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 -4.2 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+63}:\\
\;\;\;\;\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 < -4.1999999999999996e-6 or 7.6000000000000002e63 < y Initial program 99.9%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6475.1
Applied rewrites75.1%
if -4.1999999999999996e-6 < y < 7.6000000000000002e63Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites84.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (fma 2.0 y t) x (* 5.0 y))))
(if (<= y -4.2e-6)
t_1
(if (<= y 7.6e+63) (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 <= -4.2e-6) {
tmp = t_1;
} else if (y <= 7.6e+63) {
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 <= -4.2e-6) tmp = t_1; elseif (y <= 7.6e+63) 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, -4.2e-6], t$95$1, If[LessEqual[y, 7.6e+63], 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 -4.2 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+63}:\\
\;\;\;\;\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 < -4.1999999999999996e-6 or 7.6000000000000002e63 < y Initial program 99.9%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6475.1
Applied rewrites75.1%
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6475.0
Applied rewrites75.0%
if -4.1999999999999996e-6 < y < 7.6000000000000002e63Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites84.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma y 5.0 (* (+ z z) x))))
(if (<= z -1.6e+121)
t_1
(if (<= z 5.15e+126) (fma (fma 2.0 y t) x (* 5.0 y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, 5.0, ((z + z) * x));
double tmp;
if (z <= -1.6e+121) {
tmp = t_1;
} else if (z <= 5.15e+126) {
tmp = fma(fma(2.0, y, t), x, (5.0 * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, 5.0, Float64(Float64(z + z) * x)) tmp = 0.0 if (z <= -1.6e+121) tmp = t_1; elseif (z <= 5.15e+126) tmp = fma(fma(2.0, y, t), x, Float64(5.0 * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * 5.0 + N[(N[(z + z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+121], t$95$1, If[LessEqual[z, 5.15e+126], N[(N[(2.0 * y + t), $MachinePrecision] * x + N[(5.0 * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 5, \left(z + z\right) \cdot x\right)\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.15 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(2, y, t\right), x, 5 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.6e121 or 5.15000000000000003e126 < z Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
lower-*.f6458.3
Applied rewrites58.3%
lift-*.f64N/A
count-2-revN/A
lift-+.f6458.3
Applied rewrites58.3%
if -1.6e121 < z < 5.15000000000000003e126Initial program 99.9%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6475.1
Applied rewrites75.1%
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6475.0
Applied rewrites75.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma y x (* y (- x -5.0))))) (if (<= y -3.3e-7) t_1 (if (<= y 1.26e+63) (* (fma z 2.0 t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, x, (y * (x - -5.0)));
double tmp;
if (y <= -3.3e-7) {
tmp = t_1;
} else if (y <= 1.26e+63) {
tmp = fma(z, 2.0, t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, x, Float64(y * Float64(x - -5.0))) tmp = 0.0 if (y <= -3.3e-7) tmp = t_1; elseif (y <= 1.26e+63) tmp = Float64(fma(z, 2.0, t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * x + N[(y * N[(x - -5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.3e-7], t$95$1, If[LessEqual[y, 1.26e+63], N[(N[(z * 2.0 + t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, y \cdot \left(x - -5\right)\right)\\
\mathbf{if}\;y \leq -3.3 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+63}:\\
\;\;\;\;\mathsf{fma}\left(z, 2, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.3000000000000002e-7 or 1.26e63 < y Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6448.8
Applied rewrites48.8%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
count-2-revN/A
associate-+l+N/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval48.8
Applied rewrites48.8%
if -3.3000000000000002e-7 < y < 1.26e63Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6456.1
Applied rewrites56.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6456.1
Applied rewrites56.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma x 2.0 5.0) y))) (if (<= y -3.3e-7) t_1 (if (<= y 1.26e+63) (* (fma z 2.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 <= -3.3e-7) {
tmp = t_1;
} else if (y <= 1.26e+63) {
tmp = fma(z, 2.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 <= -3.3e-7) tmp = t_1; elseif (y <= 1.26e+63) tmp = Float64(fma(z, 2.0, 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.3e-7], t$95$1, If[LessEqual[y, 1.26e+63], N[(N[(z * 2.0 + t), $MachinePrecision] * 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.3 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+63}:\\
\;\;\;\;\mathsf{fma}\left(z, 2, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.3000000000000002e-7 or 1.26e63 < y Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6448.8
Applied rewrites48.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6448.8
Applied rewrites48.8%
if -3.3000000000000002e-7 < y < 1.26e63Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6456.1
Applied rewrites56.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6456.1
Applied rewrites56.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma 5.0 y (* x t)))) (if (<= t -3.45) t_1 (if (<= t 340000.0) (* (fma x 2.0 5.0) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(5.0, y, (x * t));
double tmp;
if (t <= -3.45) {
tmp = t_1;
} else if (t <= 340000.0) {
tmp = fma(x, 2.0, 5.0) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(5.0, y, Float64(x * t)) tmp = 0.0 if (t <= -3.45) tmp = t_1; elseif (t <= 340000.0) tmp = Float64(fma(x, 2.0, 5.0) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(5.0 * y + N[(x * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.45], t$95$1, If[LessEqual[t, 340000.0], N[(N[(x * 2.0 + 5.0), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(5, y, x \cdot t\right)\\
\mathbf{if}\;t \leq -3.45:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 340000:\\
\;\;\;\;\mathsf{fma}\left(x, 2, 5\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.4500000000000002 or 3.4e5 < t Initial program 99.9%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6475.1
Applied rewrites75.1%
Taylor expanded in y around 0
Applied rewrites58.2%
if -3.4500000000000002 < t < 3.4e5Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6448.8
Applied rewrites48.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6448.8
Applied rewrites48.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma x 2.0 5.0) y))) (if (<= y -3.7e-10) t_1 (if (<= y 1e-111) (* (+ z z) 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.7e-10) {
tmp = t_1;
} else if (y <= 1e-111) {
tmp = (z + z) * 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.7e-10) tmp = t_1; elseif (y <= 1e-111) tmp = Float64(Float64(z + z) * 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.7e-10], t$95$1, If[LessEqual[y, 1e-111], N[(N[(z + z), $MachinePrecision] * 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.7 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 10^{-111}:\\
\;\;\;\;\left(z + z\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.70000000000000015e-10 or 1.00000000000000009e-111 < y Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6448.8
Applied rewrites48.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6448.8
Applied rewrites48.8%
if -3.70000000000000015e-10 < y < 1.00000000000000009e-111Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6430.4
Applied rewrites30.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6430.4
Applied rewrites30.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x y))) (t_2 (* (+ z z) x)))
(if (<= x -3e+147)
t_1
(if (<= x -0.055)
t_2
(if (<= x 4e-73) (* 5.0 y) (if (<= x 4.8e+57) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * y);
double t_2 = (z + z) * x;
double tmp;
if (x <= -3e+147) {
tmp = t_1;
} else if (x <= -0.055) {
tmp = t_2;
} else if (x <= 4e-73) {
tmp = 5.0 * y;
} else if (x <= 4.8e+57) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * (x * y)
t_2 = (z + z) * x
if (x <= (-3d+147)) then
tmp = t_1
else if (x <= (-0.055d0)) then
tmp = t_2
else if (x <= 4d-73) then
tmp = 5.0d0 * y
else if (x <= 4.8d+57) then
tmp = t_2
else
tmp = t_1
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 t_2 = (z + z) * x;
double tmp;
if (x <= -3e+147) {
tmp = t_1;
} else if (x <= -0.055) {
tmp = t_2;
} else if (x <= 4e-73) {
tmp = 5.0 * y;
} else if (x <= 4.8e+57) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * y) t_2 = (z + z) * x tmp = 0 if x <= -3e+147: tmp = t_1 elif x <= -0.055: tmp = t_2 elif x <= 4e-73: tmp = 5.0 * y elif x <= 4.8e+57: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * y)) t_2 = Float64(Float64(z + z) * x) tmp = 0.0 if (x <= -3e+147) tmp = t_1; elseif (x <= -0.055) tmp = t_2; elseif (x <= 4e-73) tmp = Float64(5.0 * y); elseif (x <= 4.8e+57) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * y); t_2 = (z + z) * x; tmp = 0.0; if (x <= -3e+147) tmp = t_1; elseif (x <= -0.055) tmp = t_2; elseif (x <= 4e-73) tmp = 5.0 * y; elseif (x <= 4.8e+57) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z + z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -3e+147], t$95$1, If[LessEqual[x, -0.055], t$95$2, If[LessEqual[x, 4e-73], N[(5.0 * y), $MachinePrecision], If[LessEqual[x, 4.8e+57], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot y\right)\\
t_2 := \left(z + z\right) \cdot x\\
\mathbf{if}\;x \leq -3 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -0.055:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-73}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+57}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.99999999999999993e147 or 4.80000000000000009e57 < x Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6448.8
Applied rewrites48.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6420.8
Applied rewrites20.8%
if -2.99999999999999993e147 < x < -0.0550000000000000003 or 3.99999999999999999e-73 < x < 4.80000000000000009e57Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6430.4
Applied rewrites30.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6430.4
Applied rewrites30.4%
if -0.0550000000000000003 < x < 3.99999999999999999e-73Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6430.4
Applied rewrites30.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (+ z z) x)))
(if (<= x -3.1e+257)
(* t x)
(if (<= x -0.055)
t_1
(if (<= x 4e-73) (* 5.0 y) (if (<= x 8.6e+135) t_1 (* t x)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z + z) * x;
double tmp;
if (x <= -3.1e+257) {
tmp = t * x;
} else if (x <= -0.055) {
tmp = t_1;
} else if (x <= 4e-73) {
tmp = 5.0 * y;
} else if (x <= 8.6e+135) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (z + z) * x
if (x <= (-3.1d+257)) then
tmp = t * x
else if (x <= (-0.055d0)) then
tmp = t_1
else if (x <= 4d-73) then
tmp = 5.0d0 * y
else if (x <= 8.6d+135) then
tmp = t_1
else
tmp = t * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z + z) * x;
double tmp;
if (x <= -3.1e+257) {
tmp = t * x;
} else if (x <= -0.055) {
tmp = t_1;
} else if (x <= 4e-73) {
tmp = 5.0 * y;
} else if (x <= 8.6e+135) {
tmp = t_1;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z + z) * x tmp = 0 if x <= -3.1e+257: tmp = t * x elif x <= -0.055: tmp = t_1 elif x <= 4e-73: tmp = 5.0 * y elif x <= 8.6e+135: tmp = t_1 else: tmp = t * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z + z) * x) tmp = 0.0 if (x <= -3.1e+257) tmp = Float64(t * x); elseif (x <= -0.055) tmp = t_1; elseif (x <= 4e-73) tmp = Float64(5.0 * y); elseif (x <= 8.6e+135) tmp = t_1; else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z + z) * x; tmp = 0.0; if (x <= -3.1e+257) tmp = t * x; elseif (x <= -0.055) tmp = t_1; elseif (x <= 4e-73) tmp = 5.0 * y; elseif (x <= 8.6e+135) tmp = t_1; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z + z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -3.1e+257], N[(t * x), $MachinePrecision], If[LessEqual[x, -0.055], t$95$1, If[LessEqual[x, 4e-73], N[(5.0 * y), $MachinePrecision], If[LessEqual[x, 8.6e+135], t$95$1, N[(t * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z + z\right) \cdot x\\
\mathbf{if}\;x \leq -3.1 \cdot 10^{+257}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq -0.055:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-73}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if x < -3.1e257 or 8.59999999999999945e135 < x Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6430.2
Applied rewrites30.2%
if -3.1e257 < x < -0.0550000000000000003 or 3.99999999999999999e-73 < x < 8.59999999999999945e135Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6430.4
Applied rewrites30.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6430.4
Applied rewrites30.4%
if -0.0550000000000000003 < x < 3.99999999999999999e-73Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6430.4
Applied rewrites30.4%
(FPCore (x y z t) :precision binary64 (if (<= x -8e-24) (* t x) (if (<= x 1.65e-75) (* 5.0 y) (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8e-24) {
tmp = t * x;
} else if (x <= 1.65e-75) {
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 <= (-8d-24)) then
tmp = t * x
else if (x <= 1.65d-75) 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 <= -8e-24) {
tmp = t * x;
} else if (x <= 1.65e-75) {
tmp = 5.0 * y;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8e-24: tmp = t * x elif x <= 1.65e-75: tmp = 5.0 * y else: tmp = t * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8e-24) tmp = Float64(t * x); elseif (x <= 1.65e-75) 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 <= -8e-24) tmp = t * x; elseif (x <= 1.65e-75) tmp = 5.0 * y; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8e-24], N[(t * x), $MachinePrecision], If[LessEqual[x, 1.65e-75], N[(5.0 * y), $MachinePrecision], N[(t * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-24}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-75}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if x < -7.99999999999999939e-24 or 1.65e-75 < x Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6430.2
Applied rewrites30.2%
if -7.99999999999999939e-24 < x < 1.65e-75Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6430.4
Applied rewrites30.4%
(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.9%
Taylor expanded in x around 0
lower-*.f6430.4
Applied rewrites30.4%
herbie shell --seed 2025155
(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)))