
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - 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 - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - 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 - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t z) (- a z)) y x))
(t_2 (+ x (/ (* y (- z t)) (- z a)))))
(if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 1e+308) t_2 t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - z) / (a - z)), y, x);
double t_2 = x + ((y * (z - t)) / (z - a));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+308) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - z) / Float64(a - z)), y, x) t_2 = Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+308) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+308], t$95$2, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - z}{a - z}, y, x\right)\\
t_2 := x + \frac{y \cdot \left(z - t\right)}{z - a}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+308}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a))) < -inf.0 or 1e308 < (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a))) Initial program 40.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6499.9
Applied rewrites99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a))) < 1e308Initial program 99.6%
(FPCore (x y z t a) :precision binary64 (fma (/ (- t z) (- a z)) y x))
double code(double x, double y, double z, double t, double a) {
return fma(((t - z) / (a - z)), y, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(t - z) / Float64(a - z)), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{t - z}{a - z}, y, x\right)
\end{array}
Initial program 85.9%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6498.1
Applied rewrites98.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- z t) z) x))
(t_2 (/ (* y (- z t)) (- z a)))
(t_3 (/ (* (- z t) y) (- z a))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e+83)
t_3
(if (<= t_2 2e+67)
(fma y (/ z (- z a)) x)
(if (<= t_2 1e+308) t_3 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((z - t) / z), x);
double t_2 = (y * (z - t)) / (z - a);
double t_3 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e+83) {
tmp = t_3;
} else if (t_2 <= 2e+67) {
tmp = fma(y, (z / (z - a)), x);
} else if (t_2 <= 1e+308) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(z - t) / z), x) t_2 = Float64(Float64(y * Float64(z - t)) / Float64(z - a)) t_3 = Float64(Float64(Float64(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e+83) tmp = t_3; elseif (t_2 <= 2e+67) tmp = fma(y, Float64(z / Float64(z - a)), x); elseif (t_2 <= 1e+308) tmp = t_3; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e+83], t$95$3, If[LessEqual[t$95$2, 2e+67], N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1e+308], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z - t}{z}, x\right)\\
t_2 := \frac{y \cdot \left(z - t\right)}{z - a}\\
t_3 := \frac{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+83}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{z - a}, x\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+308}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 1e308 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 40.6%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6472.5
Applied rewrites72.5%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -1.00000000000000003e83 or 1.99999999999999997e67 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1e308Initial program 99.7%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6475.7
Applied rewrites75.7%
if -1.00000000000000003e83 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.99999999999999997e67Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6486.5
Applied rewrites86.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- z t) z) x))) (if (<= z -1e-93) t_1 (if (<= z 1.75e-76) (+ x (/ (* t y) a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((z - t) / z), x);
double tmp;
if (z <= -1e-93) {
tmp = t_1;
} else if (z <= 1.75e-76) {
tmp = x + ((t * y) / a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(z - t) / z), x) tmp = 0.0 if (z <= -1e-93) tmp = t_1; elseif (z <= 1.75e-76) tmp = Float64(x + Float64(Float64(t * y) / a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1e-93], t$95$1, If[LessEqual[z, 1.75e-76], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z - t}{z}, x\right)\\
\mathbf{if}\;z \leq -1 \cdot 10^{-93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-76}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.999999999999999e-94 or 1.74999999999999999e-76 < z Initial program 80.3%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6481.5
Applied rewrites81.5%
if -9.999999999999999e-94 < z < 1.74999999999999999e-76Initial program 95.3%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6480.3
Applied rewrites80.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.1e+245)
(/ (* t y) (- a z))
(if (<= t -1.7e+119)
(fma t (/ y a) x)
(if (<= t 3.5e+207) (fma y (/ z (- z a)) x) (* t (/ y (- a z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.1e+245) {
tmp = (t * y) / (a - z);
} else if (t <= -1.7e+119) {
tmp = fma(t, (y / a), x);
} else if (t <= 3.5e+207) {
tmp = fma(y, (z / (z - a)), x);
} else {
tmp = t * (y / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.1e+245) tmp = Float64(Float64(t * y) / Float64(a - z)); elseif (t <= -1.7e+119) tmp = fma(t, Float64(y / a), x); elseif (t <= 3.5e+207) tmp = fma(y, Float64(z / Float64(z - a)), x); else tmp = Float64(t * Float64(y / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.1e+245], N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.7e+119], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 3.5e+207], N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+245}:\\
\;\;\;\;\frac{t \cdot y}{a - z}\\
\mathbf{elif}\;t \leq -1.7 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+207}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{z - a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if t < -1.1e245Initial program 84.2%
Taylor expanded in t around inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6456.6
Applied rewrites56.6%
if -1.1e245 < t < -1.70000000000000007e119Initial program 82.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6464.4
Applied rewrites64.4%
if -1.70000000000000007e119 < t < 3.50000000000000028e207Initial program 87.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6480.6
Applied rewrites80.6%
if 3.50000000000000028e207 < t Initial program 80.2%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6493.3
Applied rewrites93.3%
Taylor expanded in t around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6459.1
Applied rewrites59.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.9e+168)
(+ x y)
(if (<= z -3.2e-87)
(fma y (/ (- t) z) x)
(if (<= z 1.8e-76) (+ x (/ (* t y) a)) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.9e+168) {
tmp = x + y;
} else if (z <= -3.2e-87) {
tmp = fma(y, (-t / z), x);
} else if (z <= 1.8e-76) {
tmp = x + ((t * y) / a);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.9e+168) tmp = Float64(x + y); elseif (z <= -3.2e-87) tmp = fma(y, Float64(Float64(-t) / z), x); elseif (z <= 1.8e-76) tmp = Float64(x + Float64(Float64(t * y) / a)); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.9e+168], N[(x + y), $MachinePrecision], If[LessEqual[z, -3.2e-87], N[(y * N[((-t) / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.8e-76], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+168}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-87}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-t}{z}, x\right)\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-76}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.9000000000000001e168 or 1.8e-76 < z Initial program 76.0%
Taylor expanded in z around inf
Applied rewrites75.8%
if -1.9000000000000001e168 < z < -3.19999999999999979e-87Initial program 89.4%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.7
Applied rewrites73.7%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6462.0
Applied rewrites62.0%
if -3.19999999999999979e-87 < z < 1.8e-76Initial program 95.3%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6480.1
Applied rewrites80.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -700000.0) (+ x y) (if (<= z 1.8e-76) (+ x (/ (* t y) a)) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -700000.0) {
tmp = x + y;
} else if (z <= 1.8e-76) {
tmp = x + ((t * y) / a);
} else {
tmp = x + y;
}
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 <= (-700000.0d0)) then
tmp = x + y
else if (z <= 1.8d-76) then
tmp = x + ((t * y) / a)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -700000.0) {
tmp = x + y;
} else if (z <= 1.8e-76) {
tmp = x + ((t * y) / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -700000.0: tmp = x + y elif z <= 1.8e-76: tmp = x + ((t * y) / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -700000.0) tmp = Float64(x + y); elseif (z <= 1.8e-76) tmp = Float64(x + Float64(Float64(t * y) / a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -700000.0) tmp = x + y; elseif (z <= 1.8e-76) tmp = x + ((t * y) / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -700000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.8e-76], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -700000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-76}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -7e5 or 1.8e-76 < z Initial program 78.0%
Taylor expanded in z around inf
Applied rewrites73.9%
if -7e5 < z < 1.8e-76Initial program 95.6%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6477.7
Applied rewrites77.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.7e-34) (+ x y) (if (<= z 1.75e-76) (fma t (/ y a) x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.7e-34) {
tmp = x + y;
} else if (z <= 1.75e-76) {
tmp = fma(t, (y / a), x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.7e-34) tmp = Float64(x + y); elseif (z <= 1.75e-76) tmp = fma(t, Float64(y / a), x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.7e-34], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.75e-76], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.7 \cdot 10^{-34}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-76}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -5.69999999999999974e-34 or 1.74999999999999999e-76 < z Initial program 78.9%
Taylor expanded in z around inf
Applied rewrites72.8%
if -5.69999999999999974e-34 < z < 1.74999999999999999e-76Initial program 95.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6480.7
Applied rewrites80.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.95e+178) (* (/ y a) t) (if (<= t 4.8e+208) (+ x y) (* t (/ y (- z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.95e+178) {
tmp = (y / a) * t;
} else if (t <= 4.8e+208) {
tmp = x + y;
} else {
tmp = t * (y / -z);
}
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 (t <= (-1.95d+178)) then
tmp = (y / a) * t
else if (t <= 4.8d+208) then
tmp = x + y
else
tmp = t * (y / -z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.95e+178) {
tmp = (y / a) * t;
} else if (t <= 4.8e+208) {
tmp = x + y;
} else {
tmp = t * (y / -z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.95e+178: tmp = (y / a) * t elif t <= 4.8e+208: tmp = x + y else: tmp = t * (y / -z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.95e+178) tmp = Float64(Float64(y / a) * t); elseif (t <= 4.8e+208) tmp = Float64(x + y); else tmp = Float64(t * Float64(y / Float64(-z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.95e+178) tmp = (y / a) * t; elseif (t <= 4.8e+208) tmp = x + y; else tmp = t * (y / -z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.95e+178], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t, 4.8e+208], N[(x + y), $MachinePrecision], N[(t * N[(y / (-z)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{+178}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{+208}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{-z}\\
\end{array}
\end{array}
if t < -1.9499999999999999e178Initial program 82.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6460.8
Applied rewrites60.8%
Taylor expanded in x around 0
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6438.5
Applied rewrites38.5%
if -1.9499999999999999e178 < t < 4.79999999999999973e208Initial program 86.9%
Taylor expanded in z around inf
Applied rewrites65.2%
if 4.79999999999999973e208 < t Initial program 80.0%
Taylor expanded in t around inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6451.4
Applied rewrites51.4%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6433.4
Applied rewrites33.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6435.4
Applied rewrites35.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.95e+178) (* (/ y a) t) (if (<= t 1e+209) (+ x y) (- (/ (* y t) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.95e+178) {
tmp = (y / a) * t;
} else if (t <= 1e+209) {
tmp = x + y;
} else {
tmp = -((y * t) / z);
}
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 (t <= (-1.95d+178)) then
tmp = (y / a) * t
else if (t <= 1d+209) then
tmp = x + y
else
tmp = -((y * t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.95e+178) {
tmp = (y / a) * t;
} else if (t <= 1e+209) {
tmp = x + y;
} else {
tmp = -((y * t) / z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.95e+178: tmp = (y / a) * t elif t <= 1e+209: tmp = x + y else: tmp = -((y * t) / z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.95e+178) tmp = Float64(Float64(y / a) * t); elseif (t <= 1e+209) tmp = Float64(x + y); else tmp = Float64(-Float64(Float64(y * t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.95e+178) tmp = (y / a) * t; elseif (t <= 1e+209) tmp = x + y; else tmp = -((y * t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.95e+178], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t, 1e+209], N[(x + y), $MachinePrecision], (-N[(N[(y * t), $MachinePrecision] / z), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{+178}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{elif}\;t \leq 10^{+209}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-\frac{y \cdot t}{z}\\
\end{array}
\end{array}
if t < -1.9499999999999999e178Initial program 82.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6460.8
Applied rewrites60.8%
Taylor expanded in x around 0
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6438.5
Applied rewrites38.5%
if -1.9499999999999999e178 < t < 1.0000000000000001e209Initial program 86.9%
Taylor expanded in z around inf
Applied rewrites65.2%
if 1.0000000000000001e209 < t Initial program 79.9%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6459.9
Applied rewrites59.9%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6433.2
Applied rewrites33.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.95e+178) (* (/ y a) t) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.95e+178) {
tmp = (y / a) * t;
} else {
tmp = x + y;
}
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 (t <= (-1.95d+178)) then
tmp = (y / a) * t
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.95e+178) {
tmp = (y / a) * t;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.95e+178: tmp = (y / a) * t else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.95e+178) tmp = Float64(Float64(y / a) * t); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.95e+178) tmp = (y / a) * t; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.95e+178], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{+178}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.9499999999999999e178Initial program 82.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6460.8
Applied rewrites60.8%
Taylor expanded in x around 0
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6438.5
Applied rewrites38.5%
if -1.9499999999999999e178 < t Initial program 86.3%
Taylor expanded in z around inf
Applied rewrites62.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.9e+133) x (if (<= a 9.5e+120) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.9e+133) {
tmp = x;
} else if (a <= 9.5e+120) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 (a <= (-1.9d+133)) then
tmp = x
else if (a <= 9.5d+120) then
tmp = x + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.9e+133) {
tmp = x;
} else if (a <= 9.5e+120) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.9e+133: tmp = x elif a <= 9.5e+120: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.9e+133) tmp = x; elseif (a <= 9.5e+120) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.9e+133) tmp = x; elseif (a <= 9.5e+120) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.9e+133], x, If[LessEqual[a, 9.5e+120], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{+133}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{+120}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.9000000000000001e133 or 9.5e120 < a Initial program 81.7%
Taylor expanded in x around inf
Applied rewrites66.9%
if -1.9000000000000001e133 < a < 9.5e120Initial program 87.7%
Taylor expanded in z around inf
Applied rewrites62.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) (- z a)))) (if (<= t_1 -1e+83) y (if (<= t_1 5e+198) x y))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (z - a);
double tmp;
if (t_1 <= -1e+83) {
tmp = y;
} else if (t_1 <= 5e+198) {
tmp = x;
} else {
tmp = y;
}
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) :: t_1
real(8) :: tmp
t_1 = (y * (z - t)) / (z - a)
if (t_1 <= (-1d+83)) then
tmp = y
else if (t_1 <= 5d+198) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (z - a);
double tmp;
if (t_1 <= -1e+83) {
tmp = y;
} else if (t_1 <= 5e+198) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (z - a) tmp = 0 if t_1 <= -1e+83: tmp = y elif t_1 <= 5e+198: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / Float64(z - a)) tmp = 0.0 if (t_1 <= -1e+83) tmp = y; elseif (t_1 <= 5e+198) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / (z - a); tmp = 0.0; if (t_1 <= -1e+83) tmp = y; elseif (t_1 <= 5e+198) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+83], y, If[LessEqual[t$95$1, 5e+198], x, y]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{z - a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+83}:\\
\;\;\;\;y\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+198}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -1.00000000000000003e83 or 5.00000000000000049e198 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 58.9%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6465.8
Applied rewrites65.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6434.2
Applied rewrites34.2%
Taylor expanded in z around inf
Applied rewrites28.5%
if -1.00000000000000003e83 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 5.00000000000000049e198Initial program 99.5%
Taylor expanded in x around inf
Applied rewrites68.7%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 85.9%
Taylor expanded in x around inf
Applied rewrites51.2%
herbie shell --seed 2025110
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
(+ x (/ (* y (- z t)) (- z a))))