
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
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 - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
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 - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* y (/ (- x t) z)) t)))
(if (<= z -5e+242)
t_1
(if (<= z 1.75e+133) (fma (- y z) (/ (- t x) (- a z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * ((x - t) / z)) + t;
double tmp;
if (z <= -5e+242) {
tmp = t_1;
} else if (z <= 1.75e+133) {
tmp = fma((y - z), ((t - x) / (a - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(Float64(x - t) / z)) + t) tmp = 0.0 if (z <= -5e+242) tmp = t_1; elseif (z <= 1.75e+133) tmp = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -5e+242], t$95$1, If[LessEqual[z, 1.75e+133], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{x - t}{z} + t\\
\mathbf{if}\;z \leq -5 \cdot 10^{+242}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+133}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.0000000000000004e242 or 1.7499999999999999e133 < z Initial program 30.0%
Taylor expanded in z 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
lower-+.f64N/A
Applied rewrites65.1%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6477.5
Applied rewrites77.5%
if -5.0000000000000004e242 < z < 1.7499999999999999e133Initial program 77.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--.f6486.5
Applied rewrites86.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* y (/ (- x t) z)) t)))
(if (<= z -1.8e+39)
t_1
(if (<= z 1.03e+65) (fma y (/ (- t x) (- a z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * ((x - t) / z)) + t;
double tmp;
if (z <= -1.8e+39) {
tmp = t_1;
} else if (z <= 1.03e+65) {
tmp = fma(y, ((t - x) / (a - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(Float64(x - t) / z)) + t) tmp = 0.0 if (z <= -1.8e+39) tmp = t_1; elseif (z <= 1.03e+65) tmp = fma(y, Float64(Float64(t - x) / Float64(a - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1.8e+39], t$95$1, If[LessEqual[z, 1.03e+65], N[(y * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{x - t}{z} + t\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.03 \cdot 10^{+65}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.79999999999999992e39 or 1.03000000000000002e65 < z Initial program 40.8%
Taylor expanded in z 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
lower-+.f64N/A
Applied rewrites62.3%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6470.2
Applied rewrites70.2%
if -1.79999999999999992e39 < z < 1.03000000000000002e65Initial program 87.2%
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--.f6490.7
Applied rewrites90.7%
Taylor expanded in y around inf
Applied rewrites80.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- t x) (/ (- y z) a) x))) (if (<= a -8.8e-33) t_1 (if (<= a 1.1e-89) (+ (* y (/ (- x t) z)) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), ((y - z) / a), x);
double tmp;
if (a <= -8.8e-33) {
tmp = t_1;
} else if (a <= 1.1e-89) {
tmp = (y * ((x - t) / z)) + t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -8.8e-33) tmp = t_1; elseif (a <= 1.1e-89) tmp = Float64(Float64(y * Float64(Float64(x - t) / z)) + t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -8.8e-33], t$95$1, If[LessEqual[a, 1.1e-89], N[(N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -8.8 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{-89}:\\
\;\;\;\;y \cdot \frac{x - t}{z} + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -8.80000000000000022e-33 or 1.10000000000000006e-89 < a Initial program 68.9%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6470.4
Applied rewrites70.4%
if -8.80000000000000022e-33 < a < 1.10000000000000006e-89Initial program 67.3%
Taylor expanded in z 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
lower-+.f64N/A
Applied rewrites77.1%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6476.8
Applied rewrites76.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ (- y z) (- a z)))) (t_2 (fma y (/ (- t x) a) x)))
(if (<= a -1.35e+99)
t_2
(if (<= a -2.75e-33)
t_1
(if (<= a 2.2e-138)
(+ (* y (/ (- x t) z)) t)
(if (<= a 5.4e-7) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * ((y - z) / (a - z));
double t_2 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -1.35e+99) {
tmp = t_2;
} else if (a <= -2.75e-33) {
tmp = t_1;
} else if (a <= 2.2e-138) {
tmp = (y * ((x - t) / z)) + t;
} else if (a <= 5.4e-7) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(y - z) / Float64(a - z))) t_2 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -1.35e+99) tmp = t_2; elseif (a <= -2.75e-33) tmp = t_1; elseif (a <= 2.2e-138) tmp = Float64(Float64(y * Float64(Float64(x - t) / z)) + t); elseif (a <= 5.4e-7) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.35e+99], t$95$2, If[LessEqual[a, -2.75e-33], t$95$1, If[LessEqual[a, 2.2e-138], N[(N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[a, 5.4e-7], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y - z}{a - z}\\
t_2 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.35 \cdot 10^{+99}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq -2.75 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.2 \cdot 10^{-138}:\\
\;\;\;\;y \cdot \frac{x - t}{z} + t\\
\mathbf{elif}\;a \leq 5.4 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -1.34999999999999994e99 or 5.40000000000000018e-7 < a Initial program 68.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6468.2
Applied rewrites68.2%
if -1.34999999999999994e99 < a < -2.75e-33 or 2.1999999999999999e-138 < a < 5.40000000000000018e-7Initial program 70.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.3
Applied rewrites80.3%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6455.1
Applied rewrites55.1%
if -2.75e-33 < a < 2.1999999999999999e-138Initial program 67.3%
Taylor expanded in z 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
lower-+.f64N/A
Applied rewrites78.4%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6478.2
Applied rewrites78.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- t x) a) x))) (if (<= a -1.35e+99) t_1 (if (<= a 5.4e-7) (* t (/ (- y z) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -1.35e+99) {
tmp = t_1;
} else if (a <= 5.4e-7) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -1.35e+99) tmp = t_1; elseif (a <= 5.4e-7) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.35e+99], t$95$1, If[LessEqual[a, 5.4e-7], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.35 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.4 \cdot 10^{-7}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.34999999999999994e99 or 5.40000000000000018e-7 < a Initial program 68.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6468.2
Applied rewrites68.2%
if -1.34999999999999994e99 < a < 5.40000000000000018e-7Initial program 68.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--.f6475.9
Applied rewrites75.9%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6460.3
Applied rewrites60.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- y z) t) (- a z))) (t_2 (fma y (/ (- t x) a) x)))
(if (<= a -3.8e+20)
t_2
(if (<= a -8.2e-84)
t_1
(if (<= a 1.2e-68)
(/ (* (- t x) y) (- a z))
(if (<= a 1.25e-7) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) * t) / (a - z);
double t_2 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -3.8e+20) {
tmp = t_2;
} else if (a <= -8.2e-84) {
tmp = t_1;
} else if (a <= 1.2e-68) {
tmp = ((t - x) * y) / (a - z);
} else if (a <= 1.25e-7) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y - z) * t) / Float64(a - z)) t_2 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -3.8e+20) tmp = t_2; elseif (a <= -8.2e-84) tmp = t_1; elseif (a <= 1.2e-68) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); elseif (a <= 1.25e-7) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.8e+20], t$95$2, If[LessEqual[a, -8.2e-84], t$95$1, If[LessEqual[a, 1.2e-68], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.25e-7], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(y - z\right) \cdot t}{a - z}\\
t_2 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -3.8 \cdot 10^{+20}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq -8.2 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{-68}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -3.8e20 or 1.24999999999999994e-7 < a Initial program 68.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6466.4
Applied rewrites66.4%
if -3.8e20 < a < -8.2000000000000001e-84 or 1.19999999999999996e-68 < a < 1.24999999999999994e-7Initial program 71.7%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6446.3
Applied rewrites46.3%
if -8.2000000000000001e-84 < a < 1.19999999999999996e-68Initial program 66.7%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6453.6
Applied rewrites53.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- t x) a) x)))
(if (<= a -1.4e-28)
t_1
(if (<= a 1.05e-90) (/ (* (- t x) y) (- a z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -1.4e-28) {
tmp = t_1;
} else if (a <= 1.05e-90) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -1.4e-28) tmp = t_1; elseif (a <= 1.05e-90) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.4e-28], t$95$1, If[LessEqual[a, 1.05e-90], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.4 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-90}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.3999999999999999e-28 or 1.05e-90 < a Initial program 69.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6462.6
Applied rewrites62.6%
if -1.3999999999999999e-28 < a < 1.05e-90Initial program 67.2%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6453.0
Applied rewrites53.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.65e+126) t (if (<= z 1e+66) (fma y (/ (- t x) a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.65e+126) {
tmp = t;
} else if (z <= 1e+66) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.65e+126) tmp = t; elseif (z <= 1e+66) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.65e+126], t, If[LessEqual[z, 1e+66], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+126}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.65000000000000014e126 or 9.99999999999999945e65 < z Initial program 36.6%
Taylor expanded in z around inf
Applied rewrites50.9%
if -2.65000000000000014e126 < z < 9.99999999999999945e65Initial program 84.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6464.4
Applied rewrites64.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e+71)
t
(if (<= z -2.05e-253)
(* t (/ (- y z) a))
(if (<= z 4.2e+65) (* (- 1.0 (/ y a)) x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+71) {
tmp = t;
} else if (z <= -2.05e-253) {
tmp = t * ((y - z) / a);
} else if (z <= 4.2e+65) {
tmp = (1.0 - (y / a)) * x;
} else {
tmp = 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 <= (-5d+71)) then
tmp = t
else if (z <= (-2.05d-253)) then
tmp = t * ((y - z) / a)
else if (z <= 4.2d+65) then
tmp = (1.0d0 - (y / a)) * x
else
tmp = 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 <= -5e+71) {
tmp = t;
} else if (z <= -2.05e-253) {
tmp = t * ((y - z) / a);
} else if (z <= 4.2e+65) {
tmp = (1.0 - (y / a)) * x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5e+71: tmp = t elif z <= -2.05e-253: tmp = t * ((y - z) / a) elif z <= 4.2e+65: tmp = (1.0 - (y / a)) * x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+71) tmp = t; elseif (z <= -2.05e-253) tmp = Float64(t * Float64(Float64(y - z) / a)); elseif (z <= 4.2e+65) tmp = Float64(Float64(1.0 - Float64(y / a)) * x); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5e+71) tmp = t; elseif (z <= -2.05e-253) tmp = t * ((y - z) / a); elseif (z <= 4.2e+65) tmp = (1.0 - (y / a)) * x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+71], t, If[LessEqual[z, -2.05e-253], N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+65], N[(N[(1.0 - N[(y / a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+71}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -2.05 \cdot 10^{-253}:\\
\;\;\;\;t \cdot \frac{y - z}{a}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+65}:\\
\;\;\;\;\left(1 - \frac{y}{a}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -4.99999999999999972e71 or 4.19999999999999983e65 < z Initial program 39.1%
Taylor expanded in z around inf
Applied rewrites48.6%
if -4.99999999999999972e71 < z < -2.05000000000000001e-253Initial program 85.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--.f6490.4
Applied rewrites90.4%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6443.4
Applied rewrites43.4%
Taylor expanded in z around 0
Applied rewrites28.3%
if -2.05000000000000001e-253 < z < 4.19999999999999983e65Initial program 87.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6457.7
Applied rewrites57.7%
Taylor expanded in z around 0
lower--.f64N/A
lower-/.f6452.0
Applied rewrites52.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.85e+40) t (if (<= z 4.2e+65) (* (- 1.0 (/ y a)) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.85e+40) {
tmp = t;
} else if (z <= 4.2e+65) {
tmp = (1.0 - (y / a)) * x;
} else {
tmp = 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 <= (-1.85d+40)) then
tmp = t
else if (z <= 4.2d+65) then
tmp = (1.0d0 - (y / a)) * x
else
tmp = 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 <= -1.85e+40) {
tmp = t;
} else if (z <= 4.2e+65) {
tmp = (1.0 - (y / a)) * x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.85e+40: tmp = t elif z <= 4.2e+65: tmp = (1.0 - (y / a)) * x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.85e+40) tmp = t; elseif (z <= 4.2e+65) tmp = Float64(Float64(1.0 - Float64(y / a)) * x); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.85e+40) tmp = t; elseif (z <= 4.2e+65) tmp = (1.0 - (y / a)) * x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.85e+40], t, If[LessEqual[z, 4.2e+65], N[(N[(1.0 - N[(y / a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+40}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+65}:\\
\;\;\;\;\left(1 - \frac{y}{a}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -1.85e40 or 4.19999999999999983e65 < z Initial program 40.7%
Taylor expanded in z around inf
Applied rewrites47.4%
if -1.85e40 < z < 4.19999999999999983e65Initial program 87.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f64N/A
lift--.f6457.8
Applied rewrites57.8%
Taylor expanded in z around 0
lower--.f64N/A
lower-/.f6451.3
Applied rewrites51.3%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.55e+41)
x
(if (<= a -3.8e-61)
t
(if (<= a 8e-130) (* y (/ (- x t) z)) (if (<= a 220000.0) t x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.55e+41) {
tmp = x;
} else if (a <= -3.8e-61) {
tmp = t;
} else if (a <= 8e-130) {
tmp = y * ((x - t) / z);
} else if (a <= 220000.0) {
tmp = t;
} 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 <= (-2.55d+41)) then
tmp = x
else if (a <= (-3.8d-61)) then
tmp = t
else if (a <= 8d-130) then
tmp = y * ((x - t) / z)
else if (a <= 220000.0d0) then
tmp = t
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 <= -2.55e+41) {
tmp = x;
} else if (a <= -3.8e-61) {
tmp = t;
} else if (a <= 8e-130) {
tmp = y * ((x - t) / z);
} else if (a <= 220000.0) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.55e+41: tmp = x elif a <= -3.8e-61: tmp = t elif a <= 8e-130: tmp = y * ((x - t) / z) elif a <= 220000.0: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.55e+41) tmp = x; elseif (a <= -3.8e-61) tmp = t; elseif (a <= 8e-130) tmp = Float64(y * Float64(Float64(x - t) / z)); elseif (a <= 220000.0) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.55e+41) tmp = x; elseif (a <= -3.8e-61) tmp = t; elseif (a <= 8e-130) tmp = y * ((x - t) / z); elseif (a <= 220000.0) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.55e+41], x, If[LessEqual[a, -3.8e-61], t, If[LessEqual[a, 8e-130], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 220000.0], t, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.55 \cdot 10^{+41}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -3.8 \cdot 10^{-61}:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 8 \cdot 10^{-130}:\\
\;\;\;\;y \cdot \frac{x - t}{z}\\
\mathbf{elif}\;a \leq 220000:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.54999999999999989e41 or 2.2e5 < a Initial program 68.1%
Taylor expanded in a around inf
Applied rewrites44.8%
if -2.54999999999999989e41 < a < -3.7999999999999998e-61 or 8.0000000000000007e-130 < a < 2.2e5Initial program 71.4%
Taylor expanded in z around inf
Applied rewrites29.5%
if -3.7999999999999998e-61 < a < 8.0000000000000007e-130Initial program 66.8%
Taylor expanded in z 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
lower-+.f64N/A
Applied rewrites79.7%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6446.3
Applied rewrites46.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.55e+41) x (if (<= a 220000.0) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.55e+41) {
tmp = x;
} else if (a <= 220000.0) {
tmp = t;
} 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 <= (-2.55d+41)) then
tmp = x
else if (a <= 220000.0d0) then
tmp = t
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 <= -2.55e+41) {
tmp = x;
} else if (a <= 220000.0) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.55e+41: tmp = x elif a <= 220000.0: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.55e+41) tmp = x; elseif (a <= 220000.0) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.55e+41) tmp = x; elseif (a <= 220000.0) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.55e+41], x, If[LessEqual[a, 220000.0], t, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.55 \cdot 10^{+41}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 220000:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.54999999999999989e41 or 2.2e5 < a Initial program 68.1%
Taylor expanded in a around inf
Applied rewrites44.8%
if -2.54999999999999989e41 < a < 2.2e5Initial program 68.4%
Taylor expanded in z around inf
Applied rewrites34.1%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return 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 = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 68.3%
Taylor expanded in z around inf
Applied rewrites25.5%
herbie shell --seed 2025114
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y z) (- t x)) (- a z))))