
(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}
Sampling outcomes in binary64 precision:
Herbie found 14 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 a) z)) (t_2 (/ (- t x) z)))
(if (<= z -3.2e+263)
(fma x t_1 t)
(if (<= z 3.7e+67)
(fma (/ (- y z) (- a z)) (- t x) x)
(+ (+ (fma (- y) t_2 (* (* t_1 (- (- t x))) (/ a z))) t) (* a t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - a) / z;
double t_2 = (t - x) / z;
double tmp;
if (z <= -3.2e+263) {
tmp = fma(x, t_1, t);
} else if (z <= 3.7e+67) {
tmp = fma(((y - z) / (a - z)), (t - x), x);
} else {
tmp = (fma(-y, t_2, ((t_1 * -(t - x)) * (a / z))) + t) + (a * t_2);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - a) / z) t_2 = Float64(Float64(t - x) / z) tmp = 0.0 if (z <= -3.2e+263) tmp = fma(x, t_1, t); elseif (z <= 3.7e+67) tmp = fma(Float64(Float64(y - z) / Float64(a - z)), Float64(t - x), x); else tmp = Float64(Float64(fma(Float64(-y), t_2, Float64(Float64(t_1 * Float64(-Float64(t - x))) * Float64(a / z))) + t) + Float64(a * t_2)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -3.2e+263], N[(x * t$95$1 + t), $MachinePrecision], If[LessEqual[z, 3.7e+67], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[((-y) * t$95$2 + N[(N[(t$95$1 * (-N[(t - x), $MachinePrecision])), $MachinePrecision] * N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] + N[(a * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - a}{z}\\
t_2 := \frac{t - x}{z}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+263}:\\
\;\;\;\;\mathsf{fma}\left(x, t\_1, t\right)\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-y, t\_2, \left(t\_1 \cdot \left(-\left(t - x\right)\right)\right) \cdot \frac{a}{z}\right) + t\right) + a \cdot t\_2\\
\end{array}
\end{array}
if z < -3.2000000000000001e263Initial program 34.6%
Taylor expanded in z around inf
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites99.9%
if -3.2000000000000001e263 < z < 3.6999999999999997e67Initial program 77.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6489.9
Applied rewrites89.9%
if 3.6999999999999997e67 < z Initial program 18.1%
Taylor expanded in z around inf
Applied rewrites89.8%
Taylor expanded in z around inf
Applied rewrites91.1%
Final simplification90.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- (- t x)) (/ (- y a) z) t)))
(if (<= z -2.35e+72)
t_1
(if (<= z -1.1e-157)
(+ x (/ (* (- y z) t) (- a z)))
(if (<= z 1e+37) (fma (- y z) (/ (- t x) a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(-(t - x), ((y - a) / z), t);
double tmp;
if (z <= -2.35e+72) {
tmp = t_1;
} else if (z <= -1.1e-157) {
tmp = x + (((y - z) * t) / (a - z));
} else if (z <= 1e+37) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t) tmp = 0.0 if (z <= -2.35e+72) tmp = t_1; elseif (z <= -1.1e-157) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))); elseif (z <= 1e+37) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); 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 - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -2.35e+72], t$95$1, If[LessEqual[z, -1.1e-157], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+37], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\mathbf{if}\;z \leq -2.35 \cdot 10^{+72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-157}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{elif}\;z \leq 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.35000000000000017e72 or 9.99999999999999954e36 < z Initial program 33.4%
Taylor expanded in z around inf
Applied rewrites81.9%
if -2.35000000000000017e72 < z < -1.10000000000000005e-157Initial program 79.7%
Taylor expanded in x around 0
Applied rewrites79.0%
if -1.10000000000000005e-157 < z < 9.99999999999999954e36Initial program 89.8%
Taylor expanded in a around inf
Applied rewrites82.2%
Final simplification81.5%
(FPCore (x y z t a)
:precision binary64
(if (<= a -4.5e+81)
(fma (- t) (/ z a) x)
(if (<= a 2e-61)
(fma (/ (- x t) z) y t)
(if (<= a 7.8e+174) (fma x (/ (- y a) z) t) (fma y (/ t a) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.5e+81) {
tmp = fma(-t, (z / a), x);
} else if (a <= 2e-61) {
tmp = fma(((x - t) / z), y, t);
} else if (a <= 7.8e+174) {
tmp = fma(x, ((y - a) / z), t);
} else {
tmp = fma(y, (t / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.5e+81) tmp = fma(Float64(-t), Float64(z / a), x); elseif (a <= 2e-61) tmp = fma(Float64(Float64(x - t) / z), y, t); elseif (a <= 7.8e+174) tmp = fma(x, Float64(Float64(y - a) / z), t); else tmp = fma(y, Float64(t / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.5e+81], N[((-t) * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 2e-61], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision], If[LessEqual[a, 7.8e+174], N[(x * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{+81}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{z}{a}, x\right)\\
\mathbf{elif}\;a \leq 2 \cdot 10^{-61}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{elif}\;a \leq 7.8 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\end{array}
\end{array}
if a < -4.50000000000000017e81Initial program 69.0%
Taylor expanded in y around 0
Applied rewrites69.6%
Taylor expanded in z around 0
Applied rewrites61.8%
Taylor expanded in x around 0
Applied rewrites62.0%
if -4.50000000000000017e81 < a < 2.0000000000000001e-61Initial program 59.0%
Taylor expanded in z around inf
Applied rewrites81.7%
Taylor expanded in a around 0
Applied rewrites74.8%
if 2.0000000000000001e-61 < a < 7.79999999999999962e174Initial program 67.5%
Taylor expanded in z around inf
Applied rewrites52.3%
Taylor expanded in x around inf
Applied rewrites52.8%
if 7.79999999999999962e174 < a Initial program 59.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6485.6
Applied rewrites85.6%
Taylor expanded in z around 0
Applied rewrites75.4%
Taylor expanded in x around 0
Applied rewrites72.7%
Final simplification67.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y a) z)))
(if (<= z -3.2e+263)
(fma x t_1 t)
(if (<= z 3.7e+67)
(fma (/ (- y z) (- a z)) (- t x) x)
(fma (- (- t x)) t_1 t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - a) / z;
double tmp;
if (z <= -3.2e+263) {
tmp = fma(x, t_1, t);
} else if (z <= 3.7e+67) {
tmp = fma(((y - z) / (a - z)), (t - x), x);
} else {
tmp = fma(-(t - x), t_1, t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - a) / z) tmp = 0.0 if (z <= -3.2e+263) tmp = fma(x, t_1, t); elseif (z <= 3.7e+67) tmp = fma(Float64(Float64(y - z) / Float64(a - z)), Float64(t - x), x); else tmp = fma(Float64(-Float64(t - x)), t_1, t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -3.2e+263], N[(x * t$95$1 + t), $MachinePrecision], If[LessEqual[z, 3.7e+67], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * t$95$1 + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - a}{z}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+263}:\\
\;\;\;\;\mathsf{fma}\left(x, t\_1, t\right)\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), t\_1, t\right)\\
\end{array}
\end{array}
if z < -3.2000000000000001e263Initial program 34.6%
Taylor expanded in z around inf
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites99.9%
if -3.2000000000000001e263 < z < 3.6999999999999997e67Initial program 77.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6489.9
Applied rewrites89.9%
if 3.6999999999999997e67 < z Initial program 18.1%
Taylor expanded in z around inf
Applied rewrites89.8%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.8e+68) (not (<= z 1e+37))) (fma (- (- t x)) (/ (- y a) z) t) (fma (- y z) (/ (- t x) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.8e+68) || !(z <= 1e+37)) {
tmp = fma(-(t - x), ((y - a) / z), t);
} else {
tmp = fma((y - z), ((t - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.8e+68) || !(z <= 1e+37)) tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); else tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.8e+68], N[Not[LessEqual[z, 1e+37]], $MachinePrecision]], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+68} \lor \neg \left(z \leq 10^{+37}\right):\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\end{array}
\end{array}
if z < -3.8000000000000001e68 or 9.99999999999999954e36 < z Initial program 34.0%
Taylor expanded in z around inf
Applied rewrites82.1%
if -3.8000000000000001e68 < z < 9.99999999999999954e36Initial program 86.3%
Taylor expanded in a around inf
Applied rewrites75.1%
Final simplification78.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.4e+76)
t
(if (<= z 1.2e-156)
(fma y (/ t a) x)
(if (<= z 1.82e+37) (fma (- x) (/ y a) x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e+76) {
tmp = t;
} else if (z <= 1.2e-156) {
tmp = fma(y, (t / a), x);
} else if (z <= 1.82e+37) {
tmp = fma(-x, (y / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.4e+76) tmp = t; elseif (z <= 1.2e-156) tmp = fma(y, Float64(t / a), x); elseif (z <= 1.82e+37) tmp = fma(Float64(-x), Float64(y / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.4e+76], t, If[LessEqual[z, 1.2e-156], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.82e+37], N[((-x) * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+76}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-156}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.82 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -1.3999999999999999e76 or 1.81999999999999998e37 < z Initial program 33.1%
Taylor expanded in z around inf
Applied rewrites60.5%
if -1.3999999999999999e76 < z < 1.2e-156Initial program 86.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6492.1
Applied rewrites92.1%
Taylor expanded in z around 0
Applied rewrites67.3%
Taylor expanded in x around 0
Applied rewrites55.8%
if 1.2e-156 < z < 1.81999999999999998e37Initial program 83.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6494.8
Applied rewrites94.8%
Taylor expanded in z around 0
Applied rewrites64.5%
Taylor expanded in t around 0
Applied rewrites59.6%
Final simplification58.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.8e+68) (not (<= z 1.15e+37))) (fma x (/ (- y a) z) t) (fma (- y z) (/ (- t x) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.8e+68) || !(z <= 1.15e+37)) {
tmp = fma(x, ((y - a) / z), t);
} else {
tmp = fma((y - z), ((t - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.8e+68) || !(z <= 1.15e+37)) tmp = fma(x, Float64(Float64(y - a) / z), t); else tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.8e+68], N[Not[LessEqual[z, 1.15e+37]], $MachinePrecision]], N[(x * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+68} \lor \neg \left(z \leq 1.15 \cdot 10^{+37}\right):\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\end{array}
\end{array}
if z < -3.8000000000000001e68 or 1.15000000000000001e37 < z Initial program 34.0%
Taylor expanded in z around inf
Applied rewrites82.1%
Taylor expanded in x around inf
Applied rewrites76.8%
if -3.8000000000000001e68 < z < 1.15000000000000001e37Initial program 86.3%
Taylor expanded in a around inf
Applied rewrites75.1%
Final simplification75.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.5e+81) x (if (<= a 4.1e-11) t (if (<= a 1.65e+179) (+ x t) (fma x (/ z a) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.5e+81) {
tmp = x;
} else if (a <= 4.1e-11) {
tmp = t;
} else if (a <= 1.65e+179) {
tmp = x + t;
} else {
tmp = fma(x, (z / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.5e+81) tmp = x; elseif (a <= 4.1e-11) tmp = t; elseif (a <= 1.65e+179) tmp = Float64(x + t); else tmp = fma(x, Float64(z / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.5e+81], x, If[LessEqual[a, 4.1e-11], t, If[LessEqual[a, 1.65e+179], N[(x + t), $MachinePrecision], N[(x * N[(z / a), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.1 \cdot 10^{-11}:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 1.65 \cdot 10^{+179}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{z}{a}, x\right)\\
\end{array}
\end{array}
if a < -4.50000000000000017e81Initial program 69.0%
Taylor expanded in a around inf
Applied rewrites47.4%
if -4.50000000000000017e81 < a < 4.1000000000000001e-11Initial program 59.3%
Taylor expanded in z around inf
Applied rewrites45.3%
if 4.1000000000000001e-11 < a < 1.64999999999999989e179Initial program 68.7%
Taylor expanded in z around inf
Applied rewrites35.9%
Taylor expanded in x around 0
Applied rewrites49.0%
if 1.64999999999999989e179 < a Initial program 59.9%
Taylor expanded in y around 0
Applied rewrites69.6%
Taylor expanded in z around 0
Applied rewrites65.7%
Taylor expanded in x around inf
Applied rewrites61.2%
Final simplification48.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.7e+68) (not (<= z 5.5e-6))) (fma x (/ (- y a) z) t) (fma (/ (- t x) a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.7e+68) || !(z <= 5.5e-6)) {
tmp = fma(x, ((y - a) / z), t);
} else {
tmp = fma(((t - x) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.7e+68) || !(z <= 5.5e-6)) tmp = fma(x, Float64(Float64(y - a) / z), t); else tmp = fma(Float64(Float64(t - x) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.7e+68], N[Not[LessEqual[z, 5.5e-6]], $MachinePrecision]], N[(x * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+68} \lor \neg \left(z \leq 5.5 \cdot 10^{-6}\right):\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -3.69999999999999998e68 or 5.4999999999999999e-6 < z Initial program 38.0%
Taylor expanded in z around inf
Applied rewrites78.4%
Taylor expanded in x around inf
Applied rewrites73.3%
if -3.69999999999999998e68 < z < 5.4999999999999999e-6Initial program 87.5%
Taylor expanded in z around 0
Applied rewrites69.9%
Final simplification71.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.5e+81) (fma (- t) (/ z a) x) (if (<= a 7.8e+174) (fma (/ (- x t) z) y t) (fma y (/ t a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.5e+81) {
tmp = fma(-t, (z / a), x);
} else if (a <= 7.8e+174) {
tmp = fma(((x - t) / z), y, t);
} else {
tmp = fma(y, (t / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.5e+81) tmp = fma(Float64(-t), Float64(z / a), x); elseif (a <= 7.8e+174) tmp = fma(Float64(Float64(x - t) / z), y, t); else tmp = fma(y, Float64(t / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.5e+81], N[((-t) * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 7.8e+174], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{+81}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{z}{a}, x\right)\\
\mathbf{elif}\;a \leq 7.8 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\end{array}
\end{array}
if a < -4.50000000000000017e81Initial program 69.0%
Taylor expanded in y around 0
Applied rewrites69.6%
Taylor expanded in z around 0
Applied rewrites61.8%
Taylor expanded in x around 0
Applied rewrites62.0%
if -4.50000000000000017e81 < a < 7.79999999999999962e174Initial program 61.6%
Taylor expanded in z around inf
Applied rewrites72.8%
Taylor expanded in a around 0
Applied rewrites65.2%
if 7.79999999999999962e174 < a Initial program 59.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6485.6
Applied rewrites85.6%
Taylor expanded in z around 0
Applied rewrites75.4%
Taylor expanded in x around 0
Applied rewrites72.7%
Final simplification65.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.4e+76) t (if (<= z 1500000000.0) (fma y (/ t a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e+76) {
tmp = t;
} else if (z <= 1500000000.0) {
tmp = fma(y, (t / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.4e+76) tmp = t; elseif (z <= 1500000000.0) tmp = fma(y, Float64(t / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.4e+76], t, If[LessEqual[z, 1500000000.0], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+76}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 1500000000:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -1.3999999999999999e76 or 1.5e9 < z Initial program 36.8%
Taylor expanded in z around inf
Applied rewrites57.6%
if -1.3999999999999999e76 < z < 1.5e9Initial program 85.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6492.5
Applied rewrites92.5%
Taylor expanded in z around 0
Applied rewrites68.0%
Taylor expanded in x around 0
Applied rewrites53.8%
Final simplification55.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.5e+81) x (if (<= a 4.1e-11) t (if (<= a 1.65e+179) (+ x t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.5e+81) {
tmp = x;
} else if (a <= 4.1e-11) {
tmp = t;
} else if (a <= 1.65e+179) {
tmp = x + 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 <= (-4.5d+81)) then
tmp = x
else if (a <= 4.1d-11) then
tmp = t
else if (a <= 1.65d+179) then
tmp = x + 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 <= -4.5e+81) {
tmp = x;
} else if (a <= 4.1e-11) {
tmp = t;
} else if (a <= 1.65e+179) {
tmp = x + t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.5e+81: tmp = x elif a <= 4.1e-11: tmp = t elif a <= 1.65e+179: tmp = x + t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.5e+81) tmp = x; elseif (a <= 4.1e-11) tmp = t; elseif (a <= 1.65e+179) tmp = Float64(x + t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.5e+81) tmp = x; elseif (a <= 4.1e-11) tmp = t; elseif (a <= 1.65e+179) tmp = x + t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.5e+81], x, If[LessEqual[a, 4.1e-11], t, If[LessEqual[a, 1.65e+179], N[(x + t), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.1 \cdot 10^{-11}:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 1.65 \cdot 10^{+179}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.50000000000000017e81 or 1.64999999999999989e179 < a Initial program 65.2%
Taylor expanded in a around inf
Applied rewrites52.9%
if -4.50000000000000017e81 < a < 4.1000000000000001e-11Initial program 59.3%
Taylor expanded in z around inf
Applied rewrites45.3%
if 4.1000000000000001e-11 < a < 1.64999999999999989e179Initial program 68.7%
Taylor expanded in z around inf
Applied rewrites35.9%
Taylor expanded in x around 0
Applied rewrites49.0%
Final simplification48.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.5e+81) x (if (<= a 6e+175) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.5e+81) {
tmp = x;
} else if (a <= 6e+175) {
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 <= (-4.5d+81)) then
tmp = x
else if (a <= 6d+175) 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 <= -4.5e+81) {
tmp = x;
} else if (a <= 6e+175) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.5e+81: tmp = x elif a <= 6e+175: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.5e+81) tmp = x; elseif (a <= 6e+175) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.5e+81) tmp = x; elseif (a <= 6e+175) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.5e+81], x, If[LessEqual[a, 6e+175], t, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 6 \cdot 10^{+175}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.50000000000000017e81 or 6.0000000000000003e175 < a Initial program 65.2%
Taylor expanded in a around inf
Applied rewrites52.9%
if -4.50000000000000017e81 < a < 6.0000000000000003e175Initial program 61.6%
Taylor expanded in z around inf
Applied rewrites43.1%
Final simplification46.3%
(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 62.8%
Taylor expanded in z around inf
Applied rewrites32.6%
Final simplification32.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ y z) (- t x)))))
(if (< z -1.2536131056095036e+188)
t_1
(if (< z 4.446702369113811e+64)
(+ x (/ (- y z) (/ (- a z) (- t x))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x))
if (z < (-1.2536131056095036d+188)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - ((y / z) * (t - x)) tmp = 0 if z < -1.2536131056095036e+188: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x + ((y - z) / ((a - z) / (t - x))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(y / z) * Float64(t - x))) tmp = 0.0 if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x + Float64(Float64(y - z) / Float64(Float64(a - z) / Float64(t - x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - ((y / z) * (t - x)); tmp = 0.0; if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x + ((y - z) / ((a - z) / (t - x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(y / z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -1.2536131056095036e+188], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x + N[(N[(y - z), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{y}{z} \cdot \left(t - x\right)\\
\mathbf{if}\;z < -1.2536131056095036 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025019
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< z -125361310560950360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- t (* (/ y z) (- t x))) (if (< z 44467023691138110000000000000000000000000000000000000000000000000) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x))))))
(+ x (/ (* (- y z) (- t x)) (- a z))))