
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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)
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
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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)
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
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- z y) (- (- t z) -1.0)) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / ((t - z) - -1.0)), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(Float64(t - z) - -1.0)), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{\left(t - z\right) - -1}, a, x\right)
\end{array}
Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites74.7%
Taylor expanded in z around 0
lower--.f6499.7
Applied rewrites99.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (- t z) -1.0))) (if (<= z -7e+197) (fma (/ z t_1) a x) (fma (/ a t_1) (- z y) x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) - -1.0;
double tmp;
if (z <= -7e+197) {
tmp = fma((z / t_1), a, x);
} else {
tmp = fma((a / t_1), (z - y), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) - -1.0) tmp = 0.0 if (z <= -7e+197) tmp = fma(Float64(z / t_1), a, x); else tmp = fma(Float64(a / t_1), Float64(z - y), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[z, -7e+197], N[(N[(z / t$95$1), $MachinePrecision] * a + x), $MachinePrecision], N[(N[(a / t$95$1), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - z\right) - -1\\
\mathbf{if}\;z \leq -7 \cdot 10^{+197}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_1}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{t\_1}, z - y, x\right)\\
\end{array}
\end{array}
if z < -6.99999999999999999e197Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites74.7%
if -6.99999999999999999e197 < z Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-/.f64N/A
div-flip-revN/A
lower-/.f64N/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -4.2e+38)
t_1
(if (<= t 2.65e+57) (fma (/ (- z y) (- 1.0 z)) a x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (t <= -4.2e+38) {
tmp = t_1;
} else if (t <= 2.65e+57) {
tmp = fma(((z - y) / (1.0 - z)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (t <= -4.2e+38) tmp = t_1; elseif (t <= 2.65e+57) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[t, -4.2e+38], t$95$1, If[LessEqual[t, 2.65e+57], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;t \leq -4.2 \cdot 10^{+38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.2e38 or 2.64999999999999993e57 < t Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6453.1
Applied rewrites53.1%
if -4.2e38 < t < 2.64999999999999993e57Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in t around 0
lower--.f6480.7
Applied rewrites80.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- (- t z) -1.0)) a x)))
(if (<= z -1.8e-5)
t_1
(if (<= z 68000000000.0) (- x (* (/ a (- t -1.0)) y)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / ((t - z) - -1.0)), a, x);
double tmp;
if (z <= -1.8e-5) {
tmp = t_1;
} else if (z <= 68000000000.0) {
tmp = x - ((a / (t - -1.0)) * y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(Float64(t - z) - -1.0)), a, x) tmp = 0.0 if (z <= -1.8e-5) tmp = t_1; elseif (z <= 68000000000.0) tmp = Float64(x - Float64(Float64(a / Float64(t - -1.0)) * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -1.8e-5], t$95$1, If[LessEqual[z, 68000000000.0], N[(x - N[(N[(a / N[(t - -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{\left(t - z\right) - -1}, a, x\right)\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 68000000000:\\
\;\;\;\;x - \frac{a}{t - -1} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.80000000000000005e-5 or 6.8e10 < z Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites74.7%
if -1.80000000000000005e-5 < z < 6.8e10Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.8
Applied rewrites69.8%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6471.8
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6471.8
Applied rewrites71.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.5e+78)
(- x a)
(if (<= z 68000000000.0)
(- x (* (/ a (- t -1.0)) y))
(fma z (/ a (- (- t -1.0) z)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+78) {
tmp = x - a;
} else if (z <= 68000000000.0) {
tmp = x - ((a / (t - -1.0)) * y);
} else {
tmp = fma(z, (a / ((t - -1.0) - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.5e+78) tmp = Float64(x - a); elseif (z <= 68000000000.0) tmp = Float64(x - Float64(Float64(a / Float64(t - -1.0)) * y)); else tmp = fma(z, Float64(a / Float64(Float64(t - -1.0) - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.5e+78], N[(x - a), $MachinePrecision], If[LessEqual[z, 68000000000.0], N[(x - N[(N[(a / N[(t - -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(z * N[(a / N[(N[(t - -1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+78}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 68000000000:\\
\;\;\;\;x - \frac{a}{t - -1} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{a}{\left(t - -1\right) - z}, x\right)\\
\end{array}
\end{array}
if z < -3.5000000000000001e78Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites60.5%
if -3.5000000000000001e78 < z < 6.8e10Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.8
Applied rewrites69.8%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6471.8
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6471.8
Applied rewrites71.8%
if 6.8e10 < z Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites74.7%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
lower-fma.f64N/A
Applied rewrites73.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.5e+78) (- x a) (if (<= z 1.12e+90) (- x (* (/ a (- t -1.0)) y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+78) {
tmp = x - a;
} else if (z <= 1.12e+90) {
tmp = x - ((a / (t - -1.0)) * y);
} else {
tmp = x - a;
}
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)
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) :: tmp
if (z <= (-3.5d+78)) then
tmp = x - a
else if (z <= 1.12d+90) then
tmp = x - ((a / (t - (-1.0d0))) * y)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+78) {
tmp = x - a;
} else if (z <= 1.12e+90) {
tmp = x - ((a / (t - -1.0)) * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.5e+78: tmp = x - a elif z <= 1.12e+90: tmp = x - ((a / (t - -1.0)) * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.5e+78) tmp = Float64(x - a); elseif (z <= 1.12e+90) tmp = Float64(x - Float64(Float64(a / Float64(t - -1.0)) * y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.5e+78) tmp = x - a; elseif (z <= 1.12e+90) tmp = x - ((a / (t - -1.0)) * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.5e+78], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.12e+90], N[(x - N[(N[(a / N[(t - -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+78}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+90}:\\
\;\;\;\;x - \frac{a}{t - -1} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.5000000000000001e78 or 1.1199999999999999e90 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites60.5%
if -3.5000000000000001e78 < z < 1.1199999999999999e90Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.8
Applied rewrites69.8%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6471.8
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6471.8
Applied rewrites71.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -9.8e+30)
t_1
(if (<= t -1.8e-70)
(fma z (/ a (- 1.0 z)) x)
(if (<= t 2.25e+57) (- x (* (/ y (- 1.0 z)) a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (t <= -9.8e+30) {
tmp = t_1;
} else if (t <= -1.8e-70) {
tmp = fma(z, (a / (1.0 - z)), x);
} else if (t <= 2.25e+57) {
tmp = x - ((y / (1.0 - z)) * a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (t <= -9.8e+30) tmp = t_1; elseif (t <= -1.8e-70) tmp = fma(z, Float64(a / Float64(1.0 - z)), x); elseif (t <= 2.25e+57) tmp = Float64(x - Float64(Float64(y / Float64(1.0 - z)) * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[t, -9.8e+30], t$95$1, If[LessEqual[t, -1.8e-70], N[(z * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 2.25e+57], N[(x - N[(N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;t \leq -9.8 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-70}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{a}{1 - z}, x\right)\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{+57}:\\
\;\;\;\;x - \frac{y}{1 - z} \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.79999999999999969e30 or 2.24999999999999998e57 < t Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6453.1
Applied rewrites53.1%
if -9.79999999999999969e30 < t < -1.8000000000000001e-70Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites74.7%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
lower-fma.f64N/A
Applied rewrites73.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6466.0
Applied rewrites66.0%
if -1.8000000000000001e-70 < t < 2.24999999999999998e57Initial program 96.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6471.2
Applied rewrites71.2%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1
Applied rewrites64.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6465.7
Applied rewrites65.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -9.8e+30)
t_1
(if (<= t 1.32e-197)
(fma z (/ a (- 1.0 z)) x)
(if (<= t 3e+21) (- x (* a y)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (t <= -9.8e+30) {
tmp = t_1;
} else if (t <= 1.32e-197) {
tmp = fma(z, (a / (1.0 - z)), x);
} else if (t <= 3e+21) {
tmp = x - (a * y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (t <= -9.8e+30) tmp = t_1; elseif (t <= 1.32e-197) tmp = fma(z, Float64(a / Float64(1.0 - z)), x); elseif (t <= 3e+21) tmp = Float64(x - Float64(a * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[t, -9.8e+30], t$95$1, If[LessEqual[t, 1.32e-197], N[(z * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 3e+21], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;t \leq -9.8 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.32 \cdot 10^{-197}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{a}{1 - z}, x\right)\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+21}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.79999999999999969e30 or 3e21 < t Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6453.1
Applied rewrites53.1%
if -9.79999999999999969e30 < t < 1.32e-197Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites74.7%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
lower-fma.f64N/A
Applied rewrites73.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6466.0
Applied rewrites66.0%
if 1.32e-197 < t < 3e21Initial program 96.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6471.2
Applied rewrites71.2%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1
Applied rewrites64.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6465.7
Applied rewrites65.7%
Taylor expanded in z around 0
lower-*.f6458.2
Applied rewrites58.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.2e-20)
(- x a)
(if (<= z -1.45e-257)
(- x (* (/ y t) a))
(if (<= z 1.52e-5) (- x (* a y)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.2e-20) {
tmp = x - a;
} else if (z <= -1.45e-257) {
tmp = x - ((y / t) * a);
} else if (z <= 1.52e-5) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
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)
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) :: tmp
if (z <= (-2.2d-20)) then
tmp = x - a
else if (z <= (-1.45d-257)) then
tmp = x - ((y / t) * a)
else if (z <= 1.52d-5) then
tmp = x - (a * y)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.2e-20) {
tmp = x - a;
} else if (z <= -1.45e-257) {
tmp = x - ((y / t) * a);
} else if (z <= 1.52e-5) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.2e-20: tmp = x - a elif z <= -1.45e-257: tmp = x - ((y / t) * a) elif z <= 1.52e-5: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.2e-20) tmp = Float64(x - a); elseif (z <= -1.45e-257) tmp = Float64(x - Float64(Float64(y / t) * a)); elseif (z <= 1.52e-5) tmp = Float64(x - Float64(a * y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.2e-20) tmp = x - a; elseif (z <= -1.45e-257) tmp = x - ((y / t) * a); elseif (z <= 1.52e-5) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.2e-20], N[(x - a), $MachinePrecision], If[LessEqual[z, -1.45e-257], N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.52e-5], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-20}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{-257}:\\
\;\;\;\;x - \frac{y}{t} \cdot a\\
\mathbf{elif}\;z \leq 1.52 \cdot 10^{-5}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.19999999999999991e-20 or 1.52e-5 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites60.5%
if -2.19999999999999991e-20 < z < -1.4500000000000001e-257Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.8
Applied rewrites69.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.3
Applied rewrites54.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.9
Applied rewrites55.9%
if -1.4500000000000001e-257 < z < 1.52e-5Initial program 96.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6471.2
Applied rewrites71.2%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1
Applied rewrites64.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6465.7
Applied rewrites65.7%
Taylor expanded in z around 0
lower-*.f6458.2
Applied rewrites58.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1e+60)
(- x a)
(if (<= z -1.45e-257)
(- x (* y (/ a t)))
(if (<= z 1.52e-5) (- x (* a y)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+60) {
tmp = x - a;
} else if (z <= -1.45e-257) {
tmp = x - (y * (a / t));
} else if (z <= 1.52e-5) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
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)
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) :: tmp
if (z <= (-1d+60)) then
tmp = x - a
else if (z <= (-1.45d-257)) then
tmp = x - (y * (a / t))
else if (z <= 1.52d-5) then
tmp = x - (a * y)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+60) {
tmp = x - a;
} else if (z <= -1.45e-257) {
tmp = x - (y * (a / t));
} else if (z <= 1.52e-5) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1e+60: tmp = x - a elif z <= -1.45e-257: tmp = x - (y * (a / t)) elif z <= 1.52e-5: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e+60) tmp = Float64(x - a); elseif (z <= -1.45e-257) tmp = Float64(x - Float64(y * Float64(a / t))); elseif (z <= 1.52e-5) tmp = Float64(x - Float64(a * y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1e+60) tmp = x - a; elseif (z <= -1.45e-257) tmp = x - (y * (a / t)); elseif (z <= 1.52e-5) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e+60], N[(x - a), $MachinePrecision], If[LessEqual[z, -1.45e-257], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.52e-5], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+60}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{-257}:\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\mathbf{elif}\;z \leq 1.52 \cdot 10^{-5}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.9999999999999995e59 or 1.52e-5 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites60.5%
if -9.9999999999999995e59 < z < -1.4500000000000001e-257Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.8
Applied rewrites69.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.3
Applied rewrites54.3%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6455.5
Applied rewrites55.5%
if -1.4500000000000001e-257 < z < 1.52e-5Initial program 96.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6471.2
Applied rewrites71.2%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1
Applied rewrites64.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6465.7
Applied rewrites65.7%
Taylor expanded in z around 0
lower-*.f6458.2
Applied rewrites58.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- x (* (/ y t) a)))) (if (<= t -9.5e+30) t_1 (if (<= t 3.5e-77) (fma z (/ a (- 1.0 z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y / t) * a);
double tmp;
if (t <= -9.5e+30) {
tmp = t_1;
} else if (t <= 3.5e-77) {
tmp = fma(z, (a / (1.0 - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y / t) * a)) tmp = 0.0 if (t <= -9.5e+30) tmp = t_1; elseif (t <= 3.5e-77) tmp = fma(z, Float64(a / Float64(1.0 - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9.5e+30], t$95$1, If[LessEqual[t, 3.5e-77], N[(z * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{t} \cdot a\\
\mathbf{if}\;t \leq -9.5 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{a}{1 - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.5000000000000003e30 or 3.50000000000000013e-77 < t Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.8
Applied rewrites69.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.3
Applied rewrites54.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.9
Applied rewrites55.9%
if -9.5000000000000003e30 < t < 3.50000000000000013e-77Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites74.7%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
div-flip-revN/A
lift--.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
lower-fma.f64N/A
Applied rewrites73.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6466.0
Applied rewrites66.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.8e+77) (- x a) (if (<= z 1.52e-5) (- x (* a y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.8e+77) {
tmp = x - a;
} else if (z <= 1.52e-5) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
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)
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) :: tmp
if (z <= (-3.8d+77)) then
tmp = x - a
else if (z <= 1.52d-5) then
tmp = x - (a * y)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.8e+77) {
tmp = x - a;
} else if (z <= 1.52e-5) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.8e+77: tmp = x - a elif z <= 1.52e-5: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.8e+77) tmp = Float64(x - a); elseif (z <= 1.52e-5) tmp = Float64(x - Float64(a * y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.8e+77) tmp = x - a; elseif (z <= 1.52e-5) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.8e+77], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.52e-5], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+77}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.52 \cdot 10^{-5}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.8000000000000001e77 or 1.52e-5 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites60.5%
if -3.8000000000000001e77 < z < 1.52e-5Initial program 96.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6471.2
Applied rewrites71.2%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1
Applied rewrites64.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6465.7
Applied rewrites65.7%
Taylor expanded in z around 0
lower-*.f6458.2
Applied rewrites58.2%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - a;
}
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)
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
code = x - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
\begin{array}{l}
\\
x - a
\end{array}
Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites60.5%
herbie shell --seed 2025149
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))