
(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 12 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 (/ (- y z) (- -1.0 (- t z))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (-1.0 - (t - z))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(-1.0 - Float64(t - z))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{-1 - \left(t - z\right)}, a, x\right)
\end{array}
Initial program 96.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
(FPCore (x y z t a) :precision binary64 (if (<= z 1.35e+147) (fma (- z y) (/ a (- (- t z) -1.0)) x) (fma (/ (- y z) (- z 1.0)) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 1.35e+147) {
tmp = fma((z - y), (a / ((t - z) - -1.0)), x);
} else {
tmp = fma(((y - z) / (z - 1.0)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= 1.35e+147) tmp = fma(Float64(z - y), Float64(a / Float64(Float64(t - z) - -1.0)), x); else tmp = fma(Float64(Float64(y - z) / Float64(z - 1.0)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 1.35e+147], N[(N[(z - y), $MachinePrecision] * N[(a / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.35 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(z - y, \frac{a}{\left(t - z\right) - -1}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{z - 1}, a, x\right)\\
\end{array}
\end{array}
if z < 1.34999999999999999e147Initial program 96.8%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower-/.f6497.2
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval97.2
Applied rewrites97.2%
if 1.34999999999999999e147 < z Initial program 96.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in t around 0
lower--.f6479.8
Applied rewrites79.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- y z) (- z 1.0)) a x)))
(if (<= z -3.5e+30)
t_1
(if (<= z 8e-6) (fma (/ (- y z) (- -1.0 t)) a x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((y - z) / (z - 1.0)), a, x);
double tmp;
if (z <= -3.5e+30) {
tmp = t_1;
} else if (z <= 8e-6) {
tmp = fma(((y - z) / (-1.0 - t)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(y - z) / Float64(z - 1.0)), a, x) tmp = 0.0 if (z <= -3.5e+30) tmp = t_1; elseif (z <= 8e-6) tmp = fma(Float64(Float64(y - z) / Float64(-1.0 - t)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -3.5e+30], t$95$1, If[LessEqual[z, 8e-6], N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - z}{z - 1}, a, x\right)\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.50000000000000021e30 or 7.99999999999999964e-6 < z Initial program 96.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in t around 0
lower--.f6479.8
Applied rewrites79.8%
if -3.50000000000000021e30 < z < 7.99999999999999964e-6Initial program 96.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in z around 0
Applied rewrites73.9%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.2e+92)
(- x (* (/ (- y z) t) a))
(if (<= t 3.5e+96)
(fma (/ (- y z) (- z 1.0)) a x)
(- x (* (- y z) (/ a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.2e+92) {
tmp = x - (((y - z) / t) * a);
} else if (t <= 3.5e+96) {
tmp = fma(((y - z) / (z - 1.0)), a, x);
} else {
tmp = x - ((y - z) * (a / t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.2e+92) tmp = Float64(x - Float64(Float64(Float64(y - z) / t) * a)); elseif (t <= 3.5e+96) tmp = fma(Float64(Float64(y - z) / Float64(z - 1.0)), a, x); else tmp = Float64(x - Float64(Float64(y - z) * Float64(a / t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.2e+92], N[(x - N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.5e+96], N[(N[(N[(y - z), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+92}:\\
\;\;\;\;x - \frac{y - z}{t} \cdot a\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+96}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{z - 1}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{a}{t}\\
\end{array}
\end{array}
if t < -4.19999999999999972e92Initial program 96.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6450.7
Applied rewrites50.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.8
Applied rewrites53.8%
if -4.19999999999999972e92 < t < 3.4999999999999999e96Initial program 96.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in t around 0
lower--.f6479.8
Applied rewrites79.8%
if 3.4999999999999999e96 < t Initial program 96.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6450.7
Applied rewrites50.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6454.5
Applied rewrites54.5%
(FPCore (x y z t a)
:precision binary64
(if (<= t -7.6e+25)
(- x (/ (- y z) (/ t a)))
(if (<= t 2.8e+88)
(fma (- z y) (/ a (- 1.0 z)) x)
(- x (* (- y z) (/ a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.6e+25) {
tmp = x - ((y - z) / (t / a));
} else if (t <= 2.8e+88) {
tmp = fma((z - y), (a / (1.0 - z)), x);
} else {
tmp = x - ((y - z) * (a / t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7.6e+25) tmp = Float64(x - Float64(Float64(y - z) / Float64(t / a))); elseif (t <= 2.8e+88) tmp = fma(Float64(z - y), Float64(a / Float64(1.0 - z)), x); else tmp = Float64(x - Float64(Float64(y - z) * Float64(a / t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7.6e+25], N[(x - N[(N[(y - z), $MachinePrecision] / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.8e+88], N[(N[(z - y), $MachinePrecision] * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{+25}:\\
\;\;\;\;x - \frac{y - z}{\frac{t}{a}}\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(z - y, \frac{a}{1 - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{a}{t}\\
\end{array}
\end{array}
if t < -7.6000000000000001e25Initial program 96.8%
Taylor expanded in t around inf
lower-/.f6454.5
Applied rewrites54.5%
if -7.6000000000000001e25 < t < 2.79999999999999989e88Initial program 96.8%
Taylor expanded in t around 0
lower--.f6477.8
Applied rewrites77.8%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
div-flip-revN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-fma.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
if 2.79999999999999989e88 < t Initial program 96.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6450.7
Applied rewrites50.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6454.5
Applied rewrites54.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.9e+58) (- x a) (if (<= z 3e+70) (- x (* y (/ a (- t -1.0)))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.9e+58) {
tmp = x - a;
} else if (z <= 3e+70) {
tmp = x - (y * (a / (t - -1.0)));
} 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 <= (-1.9d+58)) then
tmp = x - a
else if (z <= 3d+70) then
tmp = x - (y * (a / (t - (-1.0d0))))
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 <= -1.9e+58) {
tmp = x - a;
} else if (z <= 3e+70) {
tmp = x - (y * (a / (t - -1.0)));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.9e+58: tmp = x - a elif z <= 3e+70: tmp = x - (y * (a / (t - -1.0))) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.9e+58) tmp = Float64(x - a); elseif (z <= 3e+70) tmp = Float64(x - Float64(y * Float64(a / Float64(t - -1.0)))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.9e+58) tmp = x - a; elseif (z <= 3e+70) tmp = x - (y * (a / (t - -1.0))); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.9e+58], N[(x - a), $MachinePrecision], If[LessEqual[z, 3e+70], N[(x - N[(y * N[(a / N[(t - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+58}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+70}:\\
\;\;\;\;x - y \cdot \frac{a}{t - -1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.8999999999999999e58 or 2.99999999999999976e70 < z Initial program 96.8%
Taylor expanded in z around inf
Applied rewrites60.1%
if -1.8999999999999999e58 < z < 2.99999999999999976e70Initial program 96.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.9
Applied rewrites69.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6472.5
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6472.5
Applied rewrites72.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.9e+58) (- x a) (if (<= z 2.6e+145) (- x (/ (* a y) (- 1.0 z))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.9e+58) {
tmp = x - a;
} else if (z <= 2.6e+145) {
tmp = x - ((a * y) / (1.0 - z));
} 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 <= (-1.9d+58)) then
tmp = x - a
else if (z <= 2.6d+145) then
tmp = x - ((a * y) / (1.0d0 - z))
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 <= -1.9e+58) {
tmp = x - a;
} else if (z <= 2.6e+145) {
tmp = x - ((a * y) / (1.0 - z));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.9e+58: tmp = x - a elif z <= 2.6e+145: tmp = x - ((a * y) / (1.0 - z)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.9e+58) tmp = Float64(x - a); elseif (z <= 2.6e+145) tmp = Float64(x - Float64(Float64(a * y) / Float64(1.0 - z))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.9e+58) tmp = x - a; elseif (z <= 2.6e+145) tmp = x - ((a * y) / (1.0 - z)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.9e+58], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.6e+145], N[(x - N[(N[(a * y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+58}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+145}:\\
\;\;\;\;x - \frac{a \cdot y}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.8999999999999999e58 or 2.60000000000000003e145 < z Initial program 96.8%
Taylor expanded in z around inf
Applied rewrites60.1%
if -1.8999999999999999e58 < z < 2.60000000000000003e145Initial program 96.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6463.6
Applied rewrites63.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.6e+58) (- x a) (if (<= z 1.5) (- x (/ (* a y) 1.0)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+58) {
tmp = x - a;
} else if (z <= 1.5) {
tmp = x - ((a * y) / 1.0);
} 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 <= (-1.6d+58)) then
tmp = x - a
else if (z <= 1.5d0) then
tmp = x - ((a * y) / 1.0d0)
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 <= -1.6e+58) {
tmp = x - a;
} else if (z <= 1.5) {
tmp = x - ((a * y) / 1.0);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.6e+58: tmp = x - a elif z <= 1.5: tmp = x - ((a * y) / 1.0) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e+58) tmp = Float64(x - a); elseif (z <= 1.5) tmp = Float64(x - Float64(Float64(a * y) / 1.0)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.6e+58) tmp = x - a; elseif (z <= 1.5) tmp = x - ((a * y) / 1.0); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e+58], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.5], N[(x - N[(N[(a * y), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+58}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.5:\\
\;\;\;\;x - \frac{a \cdot y}{1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.60000000000000008e58 or 1.5 < z Initial program 96.8%
Taylor expanded in z around inf
Applied rewrites60.1%
if -1.60000000000000008e58 < z < 1.5Initial program 96.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Taylor expanded in z around 0
Applied rewrites51.5%
Taylor expanded in y around inf
lower-*.f6457.7
Applied rewrites57.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.3e-33) (- x a) (if (<= z 3.7e+70) (- x (* y (/ a t))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e-33) {
tmp = x - a;
} else if (z <= 3.7e+70) {
tmp = x - (y * (a / t));
} 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.3d-33)) then
tmp = x - a
else if (z <= 3.7d+70) then
tmp = x - (y * (a / t))
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.3e-33) {
tmp = x - a;
} else if (z <= 3.7e+70) {
tmp = x - (y * (a / t));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.3e-33: tmp = x - a elif z <= 3.7e+70: tmp = x - (y * (a / t)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e-33) tmp = Float64(x - a); elseif (z <= 3.7e+70) tmp = Float64(x - Float64(y * Float64(a / t))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.3e-33) tmp = x - a; elseif (z <= 3.7e+70) tmp = x - (y * (a / t)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e-33], N[(x - a), $MachinePrecision], If[LessEqual[z, 3.7e+70], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-33}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+70}:\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.29999999999999986e-33 or 3.69999999999999989e70 < z Initial program 96.8%
Taylor expanded in z around inf
Applied rewrites60.1%
if -2.29999999999999986e-33 < z < 3.69999999999999989e70Initial program 96.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.9
Applied rewrites69.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6472.5
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6472.5
Applied rewrites72.5%
Taylor expanded in t around inf
lower-/.f6456.3
Applied rewrites56.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.02e+31) (- x a) (if (<= z 4.3e-15) (- x (/ (* a y) t)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.02e+31) {
tmp = x - a;
} else if (z <= 4.3e-15) {
tmp = x - ((a * y) / t);
} 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 <= (-1.02d+31)) then
tmp = x - a
else if (z <= 4.3d-15) then
tmp = x - ((a * y) / t)
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 <= -1.02e+31) {
tmp = x - a;
} else if (z <= 4.3e-15) {
tmp = x - ((a * y) / t);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.02e+31: tmp = x - a elif z <= 4.3e-15: tmp = x - ((a * y) / t) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.02e+31) tmp = Float64(x - a); elseif (z <= 4.3e-15) tmp = Float64(x - Float64(Float64(a * y) / t)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.02e+31) tmp = x - a; elseif (z <= 4.3e-15) tmp = x - ((a * y) / t); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.02e+31], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.3e-15], N[(x - N[(N[(a * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+31}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-15}:\\
\;\;\;\;x - \frac{a \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.02000000000000007e31 or 4.2999999999999997e-15 < z Initial program 96.8%
Taylor expanded in z around inf
Applied rewrites60.1%
if -1.02000000000000007e31 < z < 4.2999999999999997e-15Initial program 96.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.9
Applied rewrites69.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.6
Applied rewrites54.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.4e-18) (- x a) (if (<= z 1.06e-74) (* 1.0 x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.4e-18) {
tmp = x - a;
} else if (z <= 1.06e-74) {
tmp = 1.0 * x;
} 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 <= (-5.4d-18)) then
tmp = x - a
else if (z <= 1.06d-74) then
tmp = 1.0d0 * x
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 <= -5.4e-18) {
tmp = x - a;
} else if (z <= 1.06e-74) {
tmp = 1.0 * x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.4e-18: tmp = x - a elif z <= 1.06e-74: tmp = 1.0 * x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.4e-18) tmp = Float64(x - a); elseif (z <= 1.06e-74) tmp = Float64(1.0 * x); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.4e-18) tmp = x - a; elseif (z <= 1.06e-74) tmp = 1.0 * x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.4e-18], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.06e-74], N[(1.0 * x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-18}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-74}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.39999999999999977e-18 or 1.06e-74 < z Initial program 96.8%
Taylor expanded in z around inf
Applied rewrites60.1%
if -5.39999999999999977e-18 < z < 1.06e-74Initial program 96.8%
Taylor expanded in z around inf
Applied rewrites60.1%
lift--.f64N/A
sub-to-multN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6457.5
Applied rewrites57.5%
Taylor expanded in x around inf
Applied rewrites53.8%
(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.8%
Taylor expanded in z around inf
Applied rewrites60.1%
herbie shell --seed 2025156
(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))))