
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_2 (/ (- t a) (- b y)))
(t_3 (fma x (/ y (fma (- b y) z y)) t_2)))
(if (<= t_1 -5e+269)
t_3
(if (<= t_1 -4e-255)
t_1
(if (<= t_1 0.0)
t_3
(if (<= t_1 2e+286) t_1 (fma x (/ -1.0 (- z 1.0)) t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_2 = (t - a) / (b - y);
double t_3 = fma(x, (y / fma((b - y), z, y)), t_2);
double tmp;
if (t_1 <= -5e+269) {
tmp = t_3;
} else if (t_1 <= -4e-255) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = t_3;
} else if (t_1 <= 2e+286) {
tmp = t_1;
} else {
tmp = fma(x, (-1.0 / (z - 1.0)), t_2);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_2 = Float64(Float64(t - a) / Float64(b - y)) t_3 = fma(x, Float64(y / fma(Float64(b - y), z, y)), t_2) tmp = 0.0 if (t_1 <= -5e+269) tmp = t_3; elseif (t_1 <= -4e-255) tmp = t_1; elseif (t_1 <= 0.0) tmp = t_3; elseif (t_1 <= 2e+286) tmp = t_1; else tmp = fma(x, Float64(-1.0 / Float64(z - 1.0)), t_2); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+269], t$95$3, If[LessEqual[t$95$1, -4e-255], t$95$1, If[LessEqual[t$95$1, 0.0], t$95$3, If[LessEqual[t$95$1, 2e+286], t$95$1, N[(x * N[(-1.0 / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_2 := \frac{t - a}{b - y}\\
t_3 := \mathsf{fma}\left(x, \frac{y}{\mathsf{fma}\left(b - y, z, y\right)}, t\_2\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+269}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-255}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+286}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{-1}{z - 1}, t\_2\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -5.0000000000000002e269 or -4e-255 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6476.5
Applied rewrites76.5%
if -5.0000000000000002e269 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -4e-255 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000007e286Initial program 66.8%
if 2.00000000000000007e286 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6476.5
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6466.2
Applied rewrites66.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_2 (/ (- t a) (- b y)))
(t_3 (fma x (/ -1.0 (- z 1.0)) t_2)))
(if (<= t_1 -2e+259)
t_3
(if (<= t_1 -2e-281)
t_1
(if (<= t_1 0.0) t_2 (if (<= t_1 2e+286) t_1 t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_2 = (t - a) / (b - y);
double t_3 = fma(x, (-1.0 / (z - 1.0)), t_2);
double tmp;
if (t_1 <= -2e+259) {
tmp = t_3;
} else if (t_1 <= -2e-281) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+286) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_2 = Float64(Float64(t - a) / Float64(b - y)) t_3 = fma(x, Float64(-1.0 / Float64(z - 1.0)), t_2) tmp = 0.0 if (t_1 <= -2e+259) tmp = t_3; elseif (t_1 <= -2e-281) tmp = t_1; elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+286) tmp = t_1; else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(-1.0 / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+259], t$95$3, If[LessEqual[t$95$1, -2e-281], t$95$1, If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+286], t$95$1, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_2 := \frac{t - a}{b - y}\\
t_3 := \mathsf{fma}\left(x, \frac{-1}{z - 1}, t\_2\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+259}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-281}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+286}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -2e259 or 2.00000000000000007e286 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6476.5
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6466.2
Applied rewrites66.2%
if -2e259 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -2e-281 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000007e286Initial program 66.8%
if -2e-281 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0Initial program 66.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6450.7
Applied rewrites50.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))) (t_2 (fma (- b y) z y)) (t_3 (/ y t_2)))
(if (<= z -3.1e+22)
(fma x t_3 t_1)
(if (<= z 6.5e+89)
(fma x t_3 (/ (* (- t a) z) t_2))
(fma x (/ -1.0 z) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = fma((b - y), z, y);
double t_3 = y / t_2;
double tmp;
if (z <= -3.1e+22) {
tmp = fma(x, t_3, t_1);
} else if (z <= 6.5e+89) {
tmp = fma(x, t_3, (((t - a) * z) / t_2));
} else {
tmp = fma(x, (-1.0 / z), t_1);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) t_2 = fma(Float64(b - y), z, y) t_3 = Float64(y / t_2) tmp = 0.0 if (z <= -3.1e+22) tmp = fma(x, t_3, t_1); elseif (z <= 6.5e+89) tmp = fma(x, t_3, Float64(Float64(Float64(t - a) * z) / t_2)); else tmp = fma(x, Float64(-1.0 / z), t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$3 = N[(y / t$95$2), $MachinePrecision]}, If[LessEqual[z, -3.1e+22], N[(x * t$95$3 + t$95$1), $MachinePrecision], If[LessEqual[z, 6.5e+89], N[(x * t$95$3 + N[(N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], N[(x * N[(-1.0 / z), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \mathsf{fma}\left(b - y, z, y\right)\\
t_3 := \frac{y}{t\_2}\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(x, t\_3, t\_1\right)\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+89}:\\
\;\;\;\;\mathsf{fma}\left(x, t\_3, \frac{\left(t - a\right) \cdot z}{t\_2}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{-1}{z}, t\_1\right)\\
\end{array}
\end{array}
if z < -3.1000000000000002e22Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6476.5
Applied rewrites76.5%
if -3.1000000000000002e22 < z < 6.4999999999999996e89Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
if 6.4999999999999996e89 < z Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6476.5
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6466.2
Applied rewrites66.2%
Taylor expanded in z around inf
lower-/.f6447.7
Applied rewrites47.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -1.3e-35)
(fma x (/ -1.0 (- z 1.0)) t_1)
(if (<= z 19000.0)
(/ (fma t z (* y x)) (fma (- b y) z y))
(fma x (/ -1.0 z) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -1.3e-35) {
tmp = fma(x, (-1.0 / (z - 1.0)), t_1);
} else if (z <= 19000.0) {
tmp = fma(t, z, (y * x)) / fma((b - y), z, y);
} else {
tmp = fma(x, (-1.0 / z), t_1);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -1.3e-35) tmp = fma(x, Float64(-1.0 / Float64(z - 1.0)), t_1); elseif (z <= 19000.0) tmp = Float64(fma(t, z, Float64(y * x)) / fma(Float64(b - y), z, y)); else tmp = fma(x, Float64(-1.0 / z), t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e-35], N[(x * N[(-1.0 / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[z, 19000.0], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], N[(x * N[(-1.0 / z), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{-1}{z - 1}, t\_1\right)\\
\mathbf{elif}\;z \leq 19000:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{-1}{z}, t\_1\right)\\
\end{array}
\end{array}
if z < -1.30000000000000002e-35Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6476.5
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6466.2
Applied rewrites66.2%
if -1.30000000000000002e-35 < z < 19000Initial program 66.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6448.6
Applied rewrites48.6%
if 19000 < z Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6476.5
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6466.2
Applied rewrites66.2%
Taylor expanded in z around inf
lower-/.f6447.7
Applied rewrites47.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma x (/ -1.0 z) (/ (- t a) (- b y)))))
(if (<= z -1.3e-35)
t_1
(if (<= z 19000.0) (/ (fma t z (* y x)) (fma (- b y) z y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(x, (-1.0 / z), ((t - a) / (b - y)));
double tmp;
if (z <= -1.3e-35) {
tmp = t_1;
} else if (z <= 19000.0) {
tmp = fma(t, z, (y * x)) / fma((b - y), z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(x, Float64(-1.0 / z), Float64(Float64(t - a) / Float64(b - y))) tmp = 0.0 if (z <= -1.3e-35) tmp = t_1; elseif (z <= 19000.0) tmp = Float64(fma(t, z, Float64(y * x)) / fma(Float64(b - y), z, y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[(-1.0 / z), $MachinePrecision] + N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e-35], t$95$1, If[LessEqual[z, 19000.0], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \frac{-1}{z}, \frac{t - a}{b - y}\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 19000:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.30000000000000002e-35 or 19000 < z Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6476.5
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6466.2
Applied rewrites66.2%
Taylor expanded in z around inf
lower-/.f6447.7
Applied rewrites47.7%
if -1.30000000000000002e-35 < z < 19000Initial program 66.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6448.6
Applied rewrites48.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma x (/ -1.0 z) (/ (- t a) (- b y)))))
(if (<= z -1.3e-35)
t_1
(if (<= z 4800.0) (/ (fma t z (* y x)) (fma b z y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(x, (-1.0 / z), ((t - a) / (b - y)));
double tmp;
if (z <= -1.3e-35) {
tmp = t_1;
} else if (z <= 4800.0) {
tmp = fma(t, z, (y * x)) / fma(b, z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(x, Float64(-1.0 / z), Float64(Float64(t - a) / Float64(b - y))) tmp = 0.0 if (z <= -1.3e-35) tmp = t_1; elseif (z <= 4800.0) tmp = Float64(fma(t, z, Float64(y * x)) / fma(b, z, y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[(-1.0 / z), $MachinePrecision] + N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e-35], t$95$1, If[LessEqual[z, 4800.0], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(b * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \frac{-1}{z}, \frac{t - a}{b - y}\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4800:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{\mathsf{fma}\left(b, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.30000000000000002e-35 or 4800 < z Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites73.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6476.5
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6466.2
Applied rewrites66.2%
Taylor expanded in z around inf
lower-/.f6447.7
Applied rewrites47.7%
if -1.30000000000000002e-35 < z < 4800Initial program 66.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6448.6
Applied rewrites48.6%
Taylor expanded in y around 0
Applied rewrites42.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -1.3e-40)
t_1
(if (<= z 4600.0) (/ (fma t z (* y x)) (fma b z y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -1.3e-40) {
tmp = t_1;
} else if (z <= 4600.0) {
tmp = fma(t, z, (y * x)) / fma(b, z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -1.3e-40) tmp = t_1; elseif (z <= 4600.0) tmp = Float64(fma(t, z, Float64(y * x)) / fma(b, z, y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e-40], t$95$1, If[LessEqual[z, 4600.0], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(b * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4600:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{\mathsf{fma}\left(b, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.3000000000000001e-40 or 4600 < z Initial program 66.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6450.7
Applied rewrites50.7%
if -1.3000000000000001e-40 < z < 4600Initial program 66.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6448.6
Applied rewrites48.6%
Taylor expanded in y around 0
Applied rewrites42.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -4.45e-63)
t_1
(if (<= z 4.5e-36) (* x (/ y (fma (- b y) z y))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -4.45e-63) {
tmp = t_1;
} else if (z <= 4.5e-36) {
tmp = x * (y / fma((b - y), z, y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -4.45e-63) tmp = t_1; elseif (z <= 4.5e-36) tmp = Float64(x * Float64(y / fma(Float64(b - y), z, y))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.45e-63], t$95$1, If[LessEqual[z, 4.5e-36], N[(x * N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -4.45 \cdot 10^{-63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-36}:\\
\;\;\;\;x \cdot \frac{y}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.44999999999999994e-63 or 4.50000000000000024e-36 < z Initial program 66.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6450.7
Applied rewrites50.7%
if -4.44999999999999994e-63 < z < 4.50000000000000024e-36Initial program 66.8%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6436.9
Applied rewrites36.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -4.3e-64) t_1 (if (<= z 3.2e-38) (/ (- x) (- z 1.0)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -4.3e-64) {
tmp = t_1;
} else if (z <= 3.2e-38) {
tmp = -x / (z - 1.0);
} 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (t - a) / (b - y)
if (z <= (-4.3d-64)) then
tmp = t_1
else if (z <= 3.2d-38) then
tmp = -x / (z - 1.0d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -4.3e-64) {
tmp = t_1;
} else if (z <= 3.2e-38) {
tmp = -x / (z - 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -4.3e-64: tmp = t_1 elif z <= 3.2e-38: tmp = -x / (z - 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -4.3e-64) tmp = t_1; elseif (z <= 3.2e-38) tmp = Float64(Float64(-x) / Float64(z - 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -4.3e-64) tmp = t_1; elseif (z <= 3.2e-38) tmp = -x / (z - 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.3e-64], t$95$1, If[LessEqual[z, 3.2e-38], N[((-x) / N[(z - 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-38}:\\
\;\;\;\;\frac{-x}{z - 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.29999999999999973e-64 or 3.19999999999999977e-38 < z Initial program 66.8%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6450.7
Applied rewrites50.7%
if -4.29999999999999973e-64 < z < 3.19999999999999977e-38Initial program 66.8%
Taylor expanded in y around -inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f6433.9
Applied rewrites33.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- x) (- z 1.0)))) (if (<= y -12000.0) t_1 (if (<= y 0.00355) (/ (- t a) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -x / (z - 1.0);
double tmp;
if (y <= -12000.0) {
tmp = t_1;
} else if (y <= 0.00355) {
tmp = (t - a) / b;
} 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = -x / (z - 1.0d0)
if (y <= (-12000.0d0)) then
tmp = t_1
else if (y <= 0.00355d0) then
tmp = (t - a) / b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -x / (z - 1.0);
double tmp;
if (y <= -12000.0) {
tmp = t_1;
} else if (y <= 0.00355) {
tmp = (t - a) / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -x / (z - 1.0) tmp = 0 if y <= -12000.0: tmp = t_1 elif y <= 0.00355: tmp = (t - a) / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-x) / Float64(z - 1.0)) tmp = 0.0 if (y <= -12000.0) tmp = t_1; elseif (y <= 0.00355) tmp = Float64(Float64(t - a) / b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -x / (z - 1.0); tmp = 0.0; if (y <= -12000.0) tmp = t_1; elseif (y <= 0.00355) tmp = (t - a) / b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-x) / N[(z - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -12000.0], t$95$1, If[LessEqual[y, 0.00355], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-x}{z - 1}\\
\mathbf{if}\;y \leq -12000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 0.00355:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -12000 or 0.0035500000000000002 < y Initial program 66.8%
Taylor expanded in y around -inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f6433.9
Applied rewrites33.9%
if -12000 < y < 0.0035500000000000002Initial program 66.8%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6434.9
Applied rewrites34.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ t (- b y)))) (if (<= t -2.5e+68) t_1 (if (<= t 2.1e+43) (/ (- t a) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / (b - y);
double tmp;
if (t <= -2.5e+68) {
tmp = t_1;
} else if (t <= 2.1e+43) {
tmp = (t - a) / b;
} 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = t / (b - y)
if (t <= (-2.5d+68)) then
tmp = t_1
else if (t <= 2.1d+43) then
tmp = (t - a) / b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / (b - y);
double tmp;
if (t <= -2.5e+68) {
tmp = t_1;
} else if (t <= 2.1e+43) {
tmp = (t - a) / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t / (b - y) tmp = 0 if t <= -2.5e+68: tmp = t_1 elif t <= 2.1e+43: tmp = (t - a) / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(t / Float64(b - y)) tmp = 0.0 if (t <= -2.5e+68) tmp = t_1; elseif (t <= 2.1e+43) tmp = Float64(Float64(t - a) / b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = t / (b - y); tmp = 0.0; if (t <= -2.5e+68) tmp = t_1; elseif (t <= 2.1e+43) tmp = (t - a) / b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.5e+68], t$95$1, If[LessEqual[t, 2.1e+43], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{b - y}\\
\mathbf{if}\;t \leq -2.5 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{+43}:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.5000000000000002e68 or 2.10000000000000002e43 < t Initial program 66.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6448.6
Applied rewrites48.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f6428.2
Applied rewrites28.2%
if -2.5000000000000002e68 < t < 2.10000000000000002e43Initial program 66.8%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6434.9
Applied rewrites34.9%
(FPCore (x y z t a b) :precision binary64 (/ t (- b y)))
double code(double x, double y, double z, double t, double a, double b) {
return t / (b - 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = t / (b - y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t / (b - y);
}
def code(x, y, z, t, a, b): return t / (b - y)
function code(x, y, z, t, a, b) return Float64(t / Float64(b - y)) end
function tmp = code(x, y, z, t, a, b) tmp = t / (b - y); end
code[x_, y_, z_, t_, a_, b_] := N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{b - y}
\end{array}
Initial program 66.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6448.6
Applied rewrites48.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f6428.2
Applied rewrites28.2%
(FPCore (x y z t a b) :precision binary64 (/ t b))
double code(double x, double y, double z, double t, double a, double b) {
return t / b;
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = t / b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t / b;
}
def code(x, y, z, t, a, b): return t / b
function code(x, y, z, t, a, b) return Float64(t / b) end
function tmp = code(x, y, z, t, a, b) tmp = t / b; end
code[x_, y_, z_, t_, a_, b_] := N[(t / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{b}
\end{array}
Initial program 66.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6448.6
Applied rewrites48.6%
Taylor expanded in y around 0
lower-/.f6420.3
Applied rewrites20.3%
herbie shell --seed 2025140
(FPCore (x y z t a b)
:name "Development.Shake.Progress:decay from shake-0.15.5"
:precision binary64
(/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))