
(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 10 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 (/ (- t a) (- b y)))
(t_2 (fma (- b y) z y))
(t_3 (* z (- t a)))
(t_4 (+ (* x y) t_3))
(t_5 (/ t_4 (+ y (* z (- b y)))))
(t_6 (fma (/ (- t a) t_2) z (* (/ x t_2) y))))
(if (<= t_5 (- INFINITY))
t_6
(if (<= t_5 -2e-285)
(/ (fma x y t_3) (fma z (- b y) y))
(if (<= t_5 0.0)
t_1
(if (<= t_5 2e+277)
(/ t_4 (- (fma b z y) (* z y)))
(if (<= t_5 INFINITY) t_6 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 = z * (t - a);
double t_4 = (x * y) + t_3;
double t_5 = t_4 / (y + (z * (b - y)));
double t_6 = fma(((t - a) / t_2), z, ((x / t_2) * y));
double tmp;
if (t_5 <= -((double) INFINITY)) {
tmp = t_6;
} else if (t_5 <= -2e-285) {
tmp = fma(x, y, t_3) / fma(z, (b - y), y);
} else if (t_5 <= 0.0) {
tmp = t_1;
} else if (t_5 <= 2e+277) {
tmp = t_4 / (fma(b, z, y) - (z * y));
} else if (t_5 <= ((double) INFINITY)) {
tmp = t_6;
} else {
tmp = 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(z * Float64(t - a)) t_4 = Float64(Float64(x * y) + t_3) t_5 = Float64(t_4 / Float64(y + Float64(z * Float64(b - y)))) t_6 = fma(Float64(Float64(t - a) / t_2), z, Float64(Float64(x / t_2) * y)) tmp = 0.0 if (t_5 <= Float64(-Inf)) tmp = t_6; elseif (t_5 <= -2e-285) tmp = Float64(fma(x, y, t_3) / fma(z, Float64(b - y), y)); elseif (t_5 <= 0.0) tmp = t_1; elseif (t_5 <= 2e+277) tmp = Float64(t_4 / Float64(fma(b, z, y) - Float64(z * y))); elseif (t_5 <= Inf) tmp = t_6; 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]}, Block[{t$95$2 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$3 = N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(x * y), $MachinePrecision] + t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t - a), $MachinePrecision] / t$95$2), $MachinePrecision] * z + N[(N[(x / t$95$2), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], t$95$6, If[LessEqual[t$95$5, -2e-285], N[(N[(x * y + t$95$3), $MachinePrecision] / N[(z * N[(b - y), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.0], t$95$1, If[LessEqual[t$95$5, 2e+277], N[(t$95$4 / N[(N[(b * z + y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, Infinity], t$95$6, t$95$1]]]]]]]]]]]
\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 := z \cdot \left(t - a\right)\\
t_4 := x \cdot y + t\_3\\
t_5 := \frac{t\_4}{y + z \cdot \left(b - y\right)}\\
t_6 := \mathsf{fma}\left(\frac{t - a}{t\_2}, z, \frac{x}{t\_2} \cdot y\right)\\
\mathbf{if}\;t\_5 \leq -\infty:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq -2 \cdot 10^{-285}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, t\_3\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\
\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_5 \leq 2 \cdot 10^{+277}:\\
\;\;\;\;\frac{t\_4}{\mathsf{fma}\left(b, z, y\right) - z \cdot y}\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;t\_6\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 2.00000000000000001e277 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 65.9%
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
lift-*.f64N/A
*-rgt-identityN/A
Applied rewrites69.5%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -2.00000000000000015e-285Initial program 65.9%
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
lift-*.f64N/A
*-rgt-identityN/A
Applied rewrites69.5%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-add-revN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites65.9%
if -2.00000000000000015e-285 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 65.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6452.0
Applied rewrites52.0%
if -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000001e277Initial program 65.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
associate--r+N/A
*-commutativeN/A
lower--.f64N/A
distribute-rgt-neg-outN/A
add-flip-revN/A
+-commutativeN/A
lower-fma.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
lower-*.f6465.7
Applied rewrites65.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -2.55e+29)
t_1
(if (<= z 2.5e+49) (/ (fma x y (* z (- t a))) (fma z (- b y) 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 <= -2.55e+29) {
tmp = t_1;
} else if (z <= 2.5e+49) {
tmp = fma(x, y, (z * (t - a))) / fma(z, (b - y), 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 <= -2.55e+29) tmp = t_1; elseif (z <= 2.5e+49) tmp = Float64(fma(x, y, Float64(z * Float64(t - a))) / fma(z, Float64(b - y), 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, -2.55e+29], t$95$1, If[LessEqual[z, 2.5e+49], N[(N[(x * y + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * N[(b - y), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -2.55 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+49}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.55e29 or 2.5000000000000002e49 < z Initial program 65.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6452.0
Applied rewrites52.0%
if -2.55e29 < z < 2.5000000000000002e49Initial program 65.9%
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
lift-*.f64N/A
*-rgt-identityN/A
Applied rewrites69.5%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-add-revN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lower-/.f64N/A
Applied rewrites65.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -6700000000.0)
t_1
(if (<= z 2.9) (/ (+ (* x y) (* z (- t a))) (+ y (* z b))) 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 <= -6700000000.0) {
tmp = t_1;
} else if (z <= 2.9) {
tmp = ((x * y) + (z * (t - a))) / (y + (z * 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 - a) / (b - y)
if (z <= (-6700000000.0d0)) then
tmp = t_1
else if (z <= 2.9d0) then
tmp = ((x * y) + (z * (t - a))) / (y + (z * 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 - a) / (b - y);
double tmp;
if (z <= -6700000000.0) {
tmp = t_1;
} else if (z <= 2.9) {
tmp = ((x * y) + (z * (t - a))) / (y + (z * b));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -6700000000.0: tmp = t_1 elif z <= 2.9: tmp = ((x * y) + (z * (t - a))) / (y + (z * b)) 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 <= -6700000000.0) tmp = t_1; elseif (z <= 2.9) tmp = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * b))); 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 <= -6700000000.0) tmp = t_1; elseif (z <= 2.9) tmp = ((x * y) + (z * (t - a))) / (y + (z * b)); 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, -6700000000.0], t$95$1, If[LessEqual[z, 2.9], N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -6700000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.9:\\
\;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.7e9 or 2.89999999999999991 < z Initial program 65.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6452.0
Applied rewrites52.0%
if -6.7e9 < z < 2.89999999999999991Initial program 65.9%
Taylor expanded in y around 0
Applied rewrites56.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -2.4e-21)
t_1
(if (<= z 1e-149)
(* (fma (- t a) z (* y x)) (/ 1.0 y))
(if (<= z 3.3e+15) (/ (* z (- t a)) (fma z (- b y) 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 <= -2.4e-21) {
tmp = t_1;
} else if (z <= 1e-149) {
tmp = fma((t - a), z, (y * x)) * (1.0 / y);
} else if (z <= 3.3e+15) {
tmp = (z * (t - a)) / fma(z, (b - y), 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 <= -2.4e-21) tmp = t_1; elseif (z <= 1e-149) tmp = Float64(fma(Float64(t - a), z, Float64(y * x)) * Float64(1.0 / y)); elseif (z <= 3.3e+15) tmp = Float64(Float64(z * Float64(t - a)) / fma(z, Float64(b - y), 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, -2.4e-21], t$95$1, If[LessEqual[z, 1e-149], N[(N[(N[(t - a), $MachinePrecision] * z + N[(y * x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.3e+15], N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / N[(z * N[(b - y), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{-149}:\\
\;\;\;\;\mathsf{fma}\left(t - a, z, y \cdot x\right) \cdot \frac{1}{y}\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+15}:\\
\;\;\;\;\frac{z \cdot \left(t - a\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.3999999999999999e-21 or 3.3e15 < z Initial program 65.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6452.0
Applied rewrites52.0%
if -2.3999999999999999e-21 < z < 9.99999999999999979e-150Initial program 65.9%
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
*-lft-identityN/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
remove-double-negN/A
remove-double-negN/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6465.8
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
Applied rewrites65.8%
Taylor expanded in z around 0
lower-/.f6432.2
Applied rewrites32.2%
if 9.99999999999999979e-150 < z < 3.3e15Initial program 65.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6441.6
Applied rewrites41.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f6441.6
Applied rewrites41.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -7.8e-14)
t_1
(if (<= z 2.7e-153)
(* -1.0 (/ x (- z 1.0)))
(if (<= z 3.3e+15) (/ (* z (- t a)) (fma z (- b y) 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 <= -7.8e-14) {
tmp = t_1;
} else if (z <= 2.7e-153) {
tmp = -1.0 * (x / (z - 1.0));
} else if (z <= 3.3e+15) {
tmp = (z * (t - a)) / fma(z, (b - y), 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 <= -7.8e-14) tmp = t_1; elseif (z <= 2.7e-153) tmp = Float64(-1.0 * Float64(x / Float64(z - 1.0))); elseif (z <= 3.3e+15) tmp = Float64(Float64(z * Float64(t - a)) / fma(z, Float64(b - y), 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, -7.8e-14], t$95$1, If[LessEqual[z, 2.7e-153], N[(-1.0 * N[(x / N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.3e+15], N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / N[(z * N[(b - y), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-153}:\\
\;\;\;\;-1 \cdot \frac{x}{z - 1}\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+15}:\\
\;\;\;\;\frac{z \cdot \left(t - a\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.7999999999999996e-14 or 3.3e15 < z Initial program 65.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6452.0
Applied rewrites52.0%
if -7.7999999999999996e-14 < z < 2.70000000000000009e-153Initial program 65.9%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6433.1
Applied rewrites33.1%
if 2.70000000000000009e-153 < z < 3.3e15Initial program 65.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6441.6
Applied rewrites41.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f6441.6
Applied rewrites41.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -7.8e-14)
t_1
(if (<= z 2.7e-153)
(* -1.0 (/ x (- z 1.0)))
(if (<= z 6.5) (/ (* z (- t a)) (+ y (* z b))) 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 <= -7.8e-14) {
tmp = t_1;
} else if (z <= 2.7e-153) {
tmp = -1.0 * (x / (z - 1.0));
} else if (z <= 6.5) {
tmp = (z * (t - a)) / (y + (z * 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 - a) / (b - y)
if (z <= (-7.8d-14)) then
tmp = t_1
else if (z <= 2.7d-153) then
tmp = (-1.0d0) * (x / (z - 1.0d0))
else if (z <= 6.5d0) then
tmp = (z * (t - a)) / (y + (z * 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 - a) / (b - y);
double tmp;
if (z <= -7.8e-14) {
tmp = t_1;
} else if (z <= 2.7e-153) {
tmp = -1.0 * (x / (z - 1.0));
} else if (z <= 6.5) {
tmp = (z * (t - a)) / (y + (z * b));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -7.8e-14: tmp = t_1 elif z <= 2.7e-153: tmp = -1.0 * (x / (z - 1.0)) elif z <= 6.5: tmp = (z * (t - a)) / (y + (z * b)) 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 <= -7.8e-14) tmp = t_1; elseif (z <= 2.7e-153) tmp = Float64(-1.0 * Float64(x / Float64(z - 1.0))); elseif (z <= 6.5) tmp = Float64(Float64(z * Float64(t - a)) / Float64(y + Float64(z * b))); 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 <= -7.8e-14) tmp = t_1; elseif (z <= 2.7e-153) tmp = -1.0 * (x / (z - 1.0)); elseif (z <= 6.5) tmp = (z * (t - a)) / (y + (z * b)); 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, -7.8e-14], t$95$1, If[LessEqual[z, 2.7e-153], N[(-1.0 * N[(x / N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5], N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-153}:\\
\;\;\;\;-1 \cdot \frac{x}{z - 1}\\
\mathbf{elif}\;z \leq 6.5:\\
\;\;\;\;\frac{z \cdot \left(t - a\right)}{y + z \cdot b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.7999999999999996e-14 or 6.5 < z Initial program 65.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6452.0
Applied rewrites52.0%
if -7.7999999999999996e-14 < z < 2.70000000000000009e-153Initial program 65.9%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6433.1
Applied rewrites33.1%
if 2.70000000000000009e-153 < z < 6.5Initial program 65.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6441.6
Applied rewrites41.6%
Taylor expanded in y around 0
Applied rewrites34.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -7.8e-14) t_1 (if (<= z 3.5e-119) (* -1.0 (/ 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 <= -7.8e-14) {
tmp = t_1;
} else if (z <= 3.5e-119) {
tmp = -1.0 * (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 <= (-7.8d-14)) then
tmp = t_1
else if (z <= 3.5d-119) then
tmp = (-1.0d0) * (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 <= -7.8e-14) {
tmp = t_1;
} else if (z <= 3.5e-119) {
tmp = -1.0 * (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 <= -7.8e-14: tmp = t_1 elif z <= 3.5e-119: tmp = -1.0 * (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 <= -7.8e-14) tmp = t_1; elseif (z <= 3.5e-119) tmp = Float64(-1.0 * 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 <= -7.8e-14) tmp = t_1; elseif (z <= 3.5e-119) tmp = -1.0 * (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, -7.8e-14], t$95$1, If[LessEqual[z, 3.5e-119], N[(-1.0 * N[(x / N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-119}:\\
\;\;\;\;-1 \cdot \frac{x}{z - 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.7999999999999996e-14 or 3.5e-119 < z Initial program 65.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6452.0
Applied rewrites52.0%
if -7.7999999999999996e-14 < z < 3.5e-119Initial program 65.9%
Taylor expanded in y around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6433.1
Applied rewrites33.1%
(FPCore (x y z t a b) :precision binary64 (/ (- t a) (- b y)))
double code(double x, double y, double z, double t, double a, double b) {
return (t - a) / (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 - a) / (b - y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (t - a) / (b - y);
}
def code(x, y, z, t, a, b): return (t - a) / (b - y)
function code(x, y, z, t, a, b) return Float64(Float64(t - a) / Float64(b - y)) end
function tmp = code(x, y, z, t, a, b) tmp = (t - a) / (b - y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t - a}{b - y}
\end{array}
Initial program 65.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6452.0
Applied rewrites52.0%
(FPCore (x y z t a b) :precision binary64 (/ (- t a) b))
double code(double x, double y, double z, double t, double a, double b) {
return (t - a) / 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 - a) / b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (t - a) / b;
}
def code(x, y, z, t, a, b): return (t - a) / b
function code(x, y, z, t, a, b) return Float64(Float64(t - a) / b) end
function tmp = code(x, y, z, t, a, b) tmp = (t - a) / b; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{t - a}{b}
\end{array}
Initial program 65.9%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6434.8
Applied rewrites34.8%
(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 65.9%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6434.8
Applied rewrites34.8%
Taylor expanded in t around inf
lower-/.f6420.1
Applied rewrites20.1%
herbie shell --seed 2025154
(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)))))