
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
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 - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
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 - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -5e-197)
(+ x (* (- y x) t_1))
(if (<= t_2 0.0)
(fma (/ (* (- y x) (- z a)) t) -1.0 y)
(fma (- y x) t_1 x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -5e-197) {
tmp = x + ((y - x) * t_1);
} else if (t_2 <= 0.0) {
tmp = fma((((y - x) * (z - a)) / t), -1.0, y);
} else {
tmp = fma((y - x), t_1, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -5e-197) tmp = Float64(x + Float64(Float64(y - x) * t_1)); elseif (t_2 <= 0.0) tmp = fma(Float64(Float64(Float64(y - x) * Float64(z - a)) / t), -1.0, y); else tmp = fma(Float64(y - x), t_1, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-197], N[(x + N[(N[(y - x), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * -1.0 + y), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * t$95$1 + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-197}:\\
\;\;\;\;x + \left(y - x\right) \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(y - x\right) \cdot \left(z - a\right)}{t}, -1, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, t\_1, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -5.0000000000000002e-197Initial program 75.4%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6492.6
Applied rewrites92.6%
if -5.0000000000000002e-197 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 3.4%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 70.0%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6486.5
Applied rewrites86.5%
Final simplification90.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (or (<= t_1 -5e-197) (not (<= t_1 0.0)))
(fma (- y x) (/ (- z t) (- a t)) x)
(fma (/ (* (- y x) (- z a)) t) -1.0 y))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if ((t_1 <= -5e-197) || !(t_1 <= 0.0)) {
tmp = fma((y - x), ((z - t) / (a - t)), x);
} else {
tmp = fma((((y - x) * (z - a)) / t), -1.0, y);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if ((t_1 <= -5e-197) || !(t_1 <= 0.0)) tmp = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x); else tmp = fma(Float64(Float64(Float64(y - x) * Float64(z - a)) / t), -1.0, y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e-197], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * -1.0 + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-197} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(y - x\right) \cdot \left(z - a\right)}{t}, -1, y\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -5.0000000000000002e-197 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 72.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.7
Applied rewrites89.7%
if -5.0000000000000002e-197 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 3.4%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Final simplification90.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (or (<= t_1 -5e-197) (not (<= t_1 0.0)))
(fma (- y x) (/ (- z t) (- a t)) x)
(+ y (/ (* a (- y x)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if ((t_1 <= -5e-197) || !(t_1 <= 0.0)) {
tmp = fma((y - x), ((z - t) / (a - t)), x);
} else {
tmp = y + ((a * (y - x)) / t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if ((t_1 <= -5e-197) || !(t_1 <= 0.0)) tmp = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x); else tmp = Float64(y + Float64(Float64(a * Float64(y - x)) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e-197], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(y + N[(N[(a * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-197} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{a \cdot \left(y - x\right)}{t}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -5.0000000000000002e-197 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 72.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.7
Applied rewrites89.7%
if -5.0000000000000002e-197 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 3.4%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in z around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6483.1
Applied rewrites83.1%
Final simplification89.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ y (/ (* a (- y x)) t))))
(if (<= t -4.4e+89)
t_1
(if (<= t -2.8e-228)
(fma y (/ z (- a t)) x)
(if (<= t 1.1e+98) (fma (- y x) (/ z a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y + ((a * (y - x)) / t);
double tmp;
if (t <= -4.4e+89) {
tmp = t_1;
} else if (t <= -2.8e-228) {
tmp = fma(y, (z / (a - t)), x);
} else if (t <= 1.1e+98) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y + Float64(Float64(a * Float64(y - x)) / t)) tmp = 0.0 if (t <= -4.4e+89) tmp = t_1; elseif (t <= -2.8e-228) tmp = fma(y, Float64(z / Float64(a - t)), x); elseif (t <= 1.1e+98) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y + N[(N[(a * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.4e+89], t$95$1, If[LessEqual[t, -2.8e-228], N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 1.1e+98], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \frac{a \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t \leq -4.4 \cdot 10^{+89}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.8 \cdot 10^{-228}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a - t}, x\right)\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+98}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.4e89 or 1.10000000000000004e98 < t Initial program 36.7%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites65.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6456.7
Applied rewrites56.7%
if -4.4e89 < t < -2.8000000000000003e-228Initial program 86.4%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.9
Applied rewrites89.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6482.6
Applied rewrites82.6%
Taylor expanded in z around inf
Applied rewrites64.7%
Taylor expanded in x around 0
Applied rewrites60.7%
if -2.8000000000000003e-228 < t < 1.10000000000000004e98Initial program 82.9%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6495.9
Applied rewrites95.9%
Taylor expanded in t around 0
lower-/.f6469.9
Applied rewrites69.9%
Final simplification63.0%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.25e+116)
y
(if (<= t -2.8e-228)
(fma y (/ z (- a t)) x)
(if (<= t 1.4e+88) (fma (- y x) (/ z a) x) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.25e+116) {
tmp = y;
} else if (t <= -2.8e-228) {
tmp = fma(y, (z / (a - t)), x);
} else if (t <= 1.4e+88) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.25e+116) tmp = y; elseif (t <= -2.8e-228) tmp = fma(y, Float64(z / Float64(a - t)), x); elseif (t <= 1.4e+88) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.25e+116], y, If[LessEqual[t, -2.8e-228], N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 1.4e+88], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], y]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+116}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq -2.8 \cdot 10^{-228}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a - t}, x\right)\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.25000000000000006e116 or 1.39999999999999994e88 < t Initial program 37.9%
Taylor expanded in t around inf
Applied rewrites48.8%
if -1.25000000000000006e116 < t < -2.8000000000000003e-228Initial program 84.4%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.2
Applied rewrites89.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6482.2
Applied rewrites82.2%
Taylor expanded in z around inf
Applied rewrites64.0%
Taylor expanded in x around 0
Applied rewrites60.2%
if -2.8000000000000003e-228 < t < 1.39999999999999994e88Initial program 83.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6495.7
Applied rewrites95.7%
Taylor expanded in t around 0
lower-/.f6470.6
Applied rewrites70.6%
Final simplification60.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.25e+116)
y
(if (<= t -9e-236)
(fma y (/ z (- a t)) x)
(if (<= t 1.4e+88) (fma z (/ (- y x) a) x) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.25e+116) {
tmp = y;
} else if (t <= -9e-236) {
tmp = fma(y, (z / (a - t)), x);
} else if (t <= 1.4e+88) {
tmp = fma(z, ((y - x) / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.25e+116) tmp = y; elseif (t <= -9e-236) tmp = fma(y, Float64(z / Float64(a - t)), x); elseif (t <= 1.4e+88) tmp = fma(z, Float64(Float64(y - x) / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.25e+116], y, If[LessEqual[t, -9e-236], N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 1.4e+88], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], y]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+116}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq -9 \cdot 10^{-236}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a - t}, x\right)\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.25000000000000006e116 or 1.39999999999999994e88 < t Initial program 37.9%
Taylor expanded in t around inf
Applied rewrites48.8%
if -1.25000000000000006e116 < t < -8.99999999999999997e-236Initial program 85.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.7
Applied rewrites89.7%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6480.7
Applied rewrites80.7%
Taylor expanded in z around inf
Applied rewrites63.4%
Taylor expanded in x around 0
Applied rewrites61.1%
if -8.99999999999999997e-236 < t < 1.39999999999999994e88Initial program 82.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6467.4
Applied rewrites67.4%
Final simplification59.2%
(FPCore (x y z t a)
:precision binary64
(if (<= a -3.6e+161)
x
(if (<= a -3.3e-155)
(+ x y)
(if (<= a 7.4e-240) (* x (/ (- z a) t)) (if (<= a 4.5e+75) y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.6e+161) {
tmp = x;
} else if (a <= -3.3e-155) {
tmp = x + y;
} else if (a <= 7.4e-240) {
tmp = x * ((z - a) / t);
} else if (a <= 4.5e+75) {
tmp = 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 <= (-3.6d+161)) then
tmp = x
else if (a <= (-3.3d-155)) then
tmp = x + y
else if (a <= 7.4d-240) then
tmp = x * ((z - a) / t)
else if (a <= 4.5d+75) then
tmp = 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 <= -3.6e+161) {
tmp = x;
} else if (a <= -3.3e-155) {
tmp = x + y;
} else if (a <= 7.4e-240) {
tmp = x * ((z - a) / t);
} else if (a <= 4.5e+75) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.6e+161: tmp = x elif a <= -3.3e-155: tmp = x + y elif a <= 7.4e-240: tmp = x * ((z - a) / t) elif a <= 4.5e+75: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.6e+161) tmp = x; elseif (a <= -3.3e-155) tmp = Float64(x + y); elseif (a <= 7.4e-240) tmp = Float64(x * Float64(Float64(z - a) / t)); elseif (a <= 4.5e+75) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.6e+161) tmp = x; elseif (a <= -3.3e-155) tmp = x + y; elseif (a <= 7.4e-240) tmp = x * ((z - a) / t); elseif (a <= 4.5e+75) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.6e+161], x, If[LessEqual[a, -3.3e-155], N[(x + y), $MachinePrecision], If[LessEqual[a, 7.4e-240], N[(x * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.5e+75], y, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.6 \cdot 10^{+161}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -3.3 \cdot 10^{-155}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;a \leq 7.4 \cdot 10^{-240}:\\
\;\;\;\;x \cdot \frac{z - a}{t}\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{+75}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.59999999999999984e161 or 4.5000000000000004e75 < a Initial program 65.8%
Taylor expanded in a around inf
Applied rewrites55.9%
if -3.59999999999999984e161 < a < -3.29999999999999986e-155Initial program 72.0%
Taylor expanded in t around inf
lift--.f6428.9
Applied rewrites28.9%
Taylor expanded in x around 0
Applied rewrites35.7%
if -3.29999999999999986e-155 < a < 7.4000000000000003e-240Initial program 69.1%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites86.0%
Taylor expanded in x around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6443.9
Applied rewrites43.9%
if 7.4000000000000003e-240 < a < 4.5000000000000004e75Initial program 64.8%
Taylor expanded in t around inf
Applied rewrites43.6%
Final simplification45.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -4.7e+93) (not (<= x 6.4e-149))) (fma (- y x) (/ z (- a t)) x) (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -4.7e+93) || !(x <= 6.4e-149)) {
tmp = fma((y - x), (z / (a - t)), x);
} else {
tmp = y * ((z - t) / (a - t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -4.7e+93) || !(x <= 6.4e-149)) tmp = fma(Float64(y - x), Float64(z / Float64(a - t)), x); else tmp = Float64(y * Float64(Float64(z - t) / Float64(a - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -4.7e+93], N[Not[LessEqual[x, 6.4e-149]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.7 \cdot 10^{+93} \lor \neg \left(x \leq 6.4 \cdot 10^{-149}\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t}\\
\end{array}
\end{array}
if x < -4.6999999999999998e93 or 6.40000000000000004e-149 < x Initial program 64.7%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6479.9
Applied rewrites79.9%
Taylor expanded in z around inf
Applied rewrites68.7%
if -4.6999999999999998e93 < x < 6.40000000000000004e-149Initial program 71.9%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6488.2
Applied rewrites88.2%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6480.5
Applied rewrites80.5%
Final simplification74.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.15e+73) (not (<= a 9.8e-57))) (fma (- y x) (/ (- z t) a) x) (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.15e+73) || !(a <= 9.8e-57)) {
tmp = fma((y - x), ((z - t) / a), x);
} else {
tmp = y * ((z - t) / (a - t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.15e+73) || !(a <= 9.8e-57)) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); else tmp = Float64(y * Float64(Float64(z - t) / Float64(a - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.15e+73], N[Not[LessEqual[a, 9.8e-57]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.15 \cdot 10^{+73} \lor \neg \left(a \leq 9.8 \cdot 10^{-57}\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t}\\
\end{array}
\end{array}
if a < -1.15e73 or 9.79999999999999976e-57 < a Initial program 68.8%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6474.0
Applied rewrites74.0%
if -1.15e73 < a < 9.79999999999999976e-57Initial program 67.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.0
Applied rewrites80.0%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6471.6
Applied rewrites71.6%
Final simplification72.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.45e+74) (not (<= a 9.8e-57))) (fma (- y x) (/ z a) x) (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.45e+74) || !(a <= 9.8e-57)) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = y * ((z - t) / (a - t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.45e+74) || !(a <= 9.8e-57)) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = Float64(y * Float64(Float64(z - t) / Float64(a - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.45e+74], N[Not[LessEqual[a, 9.8e-57]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.45 \cdot 10^{+74} \lor \neg \left(a \leq 9.8 \cdot 10^{-57}\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t}\\
\end{array}
\end{array}
if a < -1.4500000000000001e74 or 9.79999999999999976e-57 < a Initial program 68.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6487.1
Applied rewrites87.1%
Taylor expanded in t around 0
lower-/.f6466.9
Applied rewrites66.9%
if -1.4500000000000001e74 < a < 9.79999999999999976e-57Initial program 67.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.0
Applied rewrites80.0%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6471.6
Applied rewrites71.6%
Final simplification69.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.4e+54) (not (<= a 9.8e-57))) (fma (- y x) (/ z a) x) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.4e+54) || !(a <= 9.8e-57)) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = ((z - t) * y) / (a - t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.4e+54) || !(a <= 9.8e-57)) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = Float64(Float64(Float64(z - t) * y) / Float64(a - t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.4e+54], N[Not[LessEqual[a, 9.8e-57]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.4 \cdot 10^{+54} \lor \neg \left(a \leq 9.8 \cdot 10^{-57}\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t}\\
\end{array}
\end{array}
if a < -3.4000000000000001e54 or 9.79999999999999976e-57 < a Initial program 67.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6486.8
Applied rewrites86.8%
Taylor expanded in t around 0
lower-/.f6466.4
Applied rewrites66.4%
if -3.4000000000000001e54 < a < 9.79999999999999976e-57Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6459.2
Applied rewrites59.2%
Final simplification63.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -9.5e+115) y (if (<= t 1.4e+88) (fma z (/ (- y x) a) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.5e+115) {
tmp = y;
} else if (t <= 1.4e+88) {
tmp = fma(z, ((y - x) / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.5e+115) tmp = y; elseif (t <= 1.4e+88) tmp = fma(z, Float64(Float64(y - x) / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.5e+115], y, If[LessEqual[t, 1.4e+88], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+115}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -9.4999999999999997e115 or 1.39999999999999994e88 < t Initial program 37.9%
Taylor expanded in t around inf
Applied rewrites48.8%
if -9.4999999999999997e115 < t < 1.39999999999999994e88Initial program 83.7%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6460.9
Applied rewrites60.9%
Final simplification56.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.2e+117) y (if (<= t 4.9e+30) (+ x (/ (* y z) a)) (if (<= t 1.12e+194) (+ x y) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.2e+117) {
tmp = y;
} else if (t <= 4.9e+30) {
tmp = x + ((y * z) / a);
} else if (t <= 1.12e+194) {
tmp = x + y;
} 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) :: tmp
if (t <= (-3.2d+117)) then
tmp = y
else if (t <= 4.9d+30) then
tmp = x + ((y * z) / a)
else if (t <= 1.12d+194) then
tmp = x + y
else
tmp = 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 <= -3.2e+117) {
tmp = y;
} else if (t <= 4.9e+30) {
tmp = x + ((y * z) / a);
} else if (t <= 1.12e+194) {
tmp = x + y;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.2e+117: tmp = y elif t <= 4.9e+30: tmp = x + ((y * z) / a) elif t <= 1.12e+194: tmp = x + y else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.2e+117) tmp = y; elseif (t <= 4.9e+30) tmp = Float64(x + Float64(Float64(y * z) / a)); elseif (t <= 1.12e+194) tmp = Float64(x + y); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.2e+117) tmp = y; elseif (t <= 4.9e+30) tmp = x + ((y * z) / a); elseif (t <= 1.12e+194) tmp = x + y; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.2e+117], y, If[LessEqual[t, 4.9e+30], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.12e+194], N[(x + y), $MachinePrecision], y]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+117}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 4.9 \cdot 10^{+30}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{+194}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -3.20000000000000005e117 or 1.11999999999999994e194 < t Initial program 30.2%
Taylor expanded in t around inf
Applied rewrites56.0%
if -3.20000000000000005e117 < t < 4.89999999999999984e30Initial program 83.3%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6457.0
Applied rewrites57.0%
Taylor expanded in x around 0
Applied rewrites49.8%
if 4.89999999999999984e30 < t < 1.11999999999999994e194Initial program 63.9%
Taylor expanded in t around inf
lift--.f6429.0
Applied rewrites29.0%
Taylor expanded in x around 0
Applied rewrites45.0%
Final simplification50.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.2e+34) (* z (/ (- y x) a)) (if (<= z 1.9e+39) (+ x y) (* z (/ y (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e+34) {
tmp = z * ((y - x) / a);
} else if (z <= 1.9e+39) {
tmp = x + y;
} else {
tmp = z * (y / (a - t));
}
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 <= (-7.2d+34)) then
tmp = z * ((y - x) / a)
else if (z <= 1.9d+39) then
tmp = x + y
else
tmp = z * (y / (a - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e+34) {
tmp = z * ((y - x) / a);
} else if (z <= 1.9e+39) {
tmp = x + y;
} else {
tmp = z * (y / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.2e+34: tmp = z * ((y - x) / a) elif z <= 1.9e+39: tmp = x + y else: tmp = z * (y / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.2e+34) tmp = Float64(z * Float64(Float64(y - x) / a)); elseif (z <= 1.9e+39) tmp = Float64(x + y); else tmp = Float64(z * Float64(y / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.2e+34) tmp = z * ((y - x) / a); elseif (z <= 1.9e+39) tmp = x + y; else tmp = z * (y / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.2e+34], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+39], N[(x + y), $MachinePrecision], N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+34}:\\
\;\;\;\;z \cdot \frac{y - x}{a}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+39}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if z < -7.2000000000000001e34Initial program 69.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6495.2
Applied rewrites95.2%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6481.6
Applied rewrites81.6%
Taylor expanded in t around 0
Applied rewrites56.4%
if -7.2000000000000001e34 < z < 1.8999999999999999e39Initial program 68.9%
Taylor expanded in t around inf
lift--.f6425.8
Applied rewrites25.8%
Taylor expanded in x around 0
Applied rewrites45.0%
if 1.8999999999999999e39 < z Initial program 63.9%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.1
Applied rewrites89.1%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6475.0
Applied rewrites75.0%
Taylor expanded in x around 0
lower-/.f64N/A
lift--.f6441.6
Applied rewrites41.6%
Final simplification46.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.2e+34) (/ (* z (- y x)) a) (if (<= z 1.9e+39) (+ x y) (* z (/ y (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e+34) {
tmp = (z * (y - x)) / a;
} else if (z <= 1.9e+39) {
tmp = x + y;
} else {
tmp = z * (y / (a - t));
}
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 <= (-7.2d+34)) then
tmp = (z * (y - x)) / a
else if (z <= 1.9d+39) then
tmp = x + y
else
tmp = z * (y / (a - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e+34) {
tmp = (z * (y - x)) / a;
} else if (z <= 1.9e+39) {
tmp = x + y;
} else {
tmp = z * (y / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.2e+34: tmp = (z * (y - x)) / a elif z <= 1.9e+39: tmp = x + y else: tmp = z * (y / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.2e+34) tmp = Float64(Float64(z * Float64(y - x)) / a); elseif (z <= 1.9e+39) tmp = Float64(x + y); else tmp = Float64(z * Float64(y / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.2e+34) tmp = (z * (y - x)) / a; elseif (z <= 1.9e+39) tmp = x + y; else tmp = z * (y / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.2e+34], N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 1.9e+39], N[(x + y), $MachinePrecision], N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+34}:\\
\;\;\;\;\frac{z \cdot \left(y - x\right)}{a}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+39}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if z < -7.2000000000000001e34Initial program 69.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6495.2
Applied rewrites95.2%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6481.6
Applied rewrites81.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f6448.9
Applied rewrites48.9%
if -7.2000000000000001e34 < z < 1.8999999999999999e39Initial program 68.9%
Taylor expanded in t around inf
lift--.f6425.8
Applied rewrites25.8%
Taylor expanded in x around 0
Applied rewrites45.0%
if 1.8999999999999999e39 < z Initial program 63.9%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.1
Applied rewrites89.1%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6475.0
Applied rewrites75.0%
Taylor expanded in x around 0
lower-/.f64N/A
lift--.f6441.6
Applied rewrites41.6%
Final simplification45.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.2e+34) (/ (* z (- y x)) a) (if (<= z 6e+54) (+ x y) (/ (* y z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e+34) {
tmp = (z * (y - x)) / a;
} else if (z <= 6e+54) {
tmp = x + y;
} else {
tmp = (y * z) / (a - t);
}
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 <= (-7.2d+34)) then
tmp = (z * (y - x)) / a
else if (z <= 6d+54) then
tmp = x + y
else
tmp = (y * z) / (a - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e+34) {
tmp = (z * (y - x)) / a;
} else if (z <= 6e+54) {
tmp = x + y;
} else {
tmp = (y * z) / (a - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.2e+34: tmp = (z * (y - x)) / a elif z <= 6e+54: tmp = x + y else: tmp = (y * z) / (a - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.2e+34) tmp = Float64(Float64(z * Float64(y - x)) / a); elseif (z <= 6e+54) tmp = Float64(x + y); else tmp = Float64(Float64(y * z) / Float64(a - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.2e+34) tmp = (z * (y - x)) / a; elseif (z <= 6e+54) tmp = x + y; else tmp = (y * z) / (a - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.2e+34], N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 6e+54], N[(x + y), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+34}:\\
\;\;\;\;\frac{z \cdot \left(y - x\right)}{a}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+54}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{a - t}\\
\end{array}
\end{array}
if z < -7.2000000000000001e34Initial program 69.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6495.2
Applied rewrites95.2%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6481.6
Applied rewrites81.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f6448.9
Applied rewrites48.9%
if -7.2000000000000001e34 < z < 5.9999999999999998e54Initial program 68.7%
Taylor expanded in t around inf
lift--.f6426.1
Applied rewrites26.1%
Taylor expanded in x around 0
Applied rewrites45.1%
if 5.9999999999999998e54 < z Initial program 64.4%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6488.7
Applied rewrites88.7%
Taylor expanded in z around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6475.9
Applied rewrites75.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lift--.f6436.1
Applied rewrites36.1%
Final simplification43.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.3e+73) x (if (<= a 4.5e+75) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.3e+73) {
tmp = x;
} else if (a <= 4.5e+75) {
tmp = 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.3d+73)) then
tmp = x
else if (a <= 4.5d+75) then
tmp = 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.3e+73) {
tmp = x;
} else if (a <= 4.5e+75) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.3e+73: tmp = x elif a <= 4.5e+75: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.3e+73) tmp = x; elseif (a <= 4.5e+75) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.3e+73) tmp = x; elseif (a <= 4.5e+75) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.3e+73], x, If[LessEqual[a, 4.5e+75], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{+73}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{+75}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.3e73 or 4.5000000000000004e75 < a Initial program 67.1%
Taylor expanded in a around inf
Applied rewrites46.4%
if -1.3e73 < a < 4.5000000000000004e75Initial program 68.5%
Taylor expanded in t around inf
Applied rewrites37.4%
Final simplification41.2%
(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 67.9%
Taylor expanded in a around inf
Applied rewrites23.5%
Final simplification23.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025037
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))