
(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 12 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 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 -2e-262)
(fma (/ (- y z) (- a z)) (- t x) x)
(if (<= t_1 0.0)
(fma (- x t) (/ (- y a) z) t)
(if (<= t_1 5e+305) t_1 (fma (/ (- (- t x)) z) (- y a) t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_1 <= -2e-262) {
tmp = fma(((y - z) / (a - z)), (t - x), x);
} else if (t_1 <= 0.0) {
tmp = fma((x - t), ((y - a) / z), t);
} else if (t_1 <= 5e+305) {
tmp = t_1;
} else {
tmp = fma((-(t - x) / z), (y - a), t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_1 <= -2e-262) tmp = fma(Float64(Float64(y - z) / Float64(a - z)), Float64(t - x), x); elseif (t_1 <= 0.0) tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); elseif (t_1 <= 5e+305) tmp = t_1; else tmp = fma(Float64(Float64(-Float64(t - x)) / z), Float64(y - a), t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-262], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[t$95$1, 5e+305], t$95$1, N[(N[((-N[(t - x), $MachinePrecision]) / z), $MachinePrecision] * N[(y - a), $MachinePrecision] + t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-262}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-\left(t - x\right)}{z}, y - a, t\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -2.00000000000000002e-262Initial program 77.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.9
Applied rewrites93.9%
if -2.00000000000000002e-262 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 4.1%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites85.0%
Taylor expanded in z around inf
Applied rewrites99.8%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 5.00000000000000009e305Initial program 97.0%
if 5.00000000000000009e305 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 30.3%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites79.0%
Final simplification92.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (or (<= t_1 -2e-262) (not (<= t_1 0.0)))
(fma (/ (- y z) (- a z)) (- t x) x)
(fma (- x t) (/ (- y a) z) t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if ((t_1 <= -2e-262) || !(t_1 <= 0.0)) {
tmp = fma(((y - z) / (a - z)), (t - x), x);
} else {
tmp = fma((x - t), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if ((t_1 <= -2e-262) || !(t_1 <= 0.0)) tmp = fma(Float64(Float64(y - z) / Float64(a - z)), Float64(t - x), x); else tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e-262], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-262} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -2.00000000000000002e-262 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 74.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.2
Applied rewrites90.2%
if -2.00000000000000002e-262 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 4.1%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites85.0%
Taylor expanded in z around inf
Applied rewrites99.8%
Final simplification90.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- x t) z) y)) (t_2 (fma (/ x z) (- a) t)))
(if (<= z -4.6e+79)
t_2
(if (<= z -7.6e-134)
t_1
(if (<= z 2.2e-57) (+ x (/ (* t y) a)) (if (<= z 2.25e+79) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - t) / z) * y;
double t_2 = fma((x / z), -a, t);
double tmp;
if (z <= -4.6e+79) {
tmp = t_2;
} else if (z <= -7.6e-134) {
tmp = t_1;
} else if (z <= 2.2e-57) {
tmp = x + ((t * y) / a);
} else if (z <= 2.25e+79) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - t) / z) * y) t_2 = fma(Float64(x / z), Float64(-a), t) tmp = 0.0 if (z <= -4.6e+79) tmp = t_2; elseif (z <= -7.6e-134) tmp = t_1; elseif (z <= 2.2e-57) tmp = Float64(x + Float64(Float64(t * y) / a)); elseif (z <= 2.25e+79) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / z), $MachinePrecision] * (-a) + t), $MachinePrecision]}, If[LessEqual[z, -4.6e+79], t$95$2, If[LessEqual[z, -7.6e-134], t$95$1, If[LessEqual[z, 2.2e-57], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.25e+79], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - t}{z} \cdot y\\
t_2 := \mathsf{fma}\left(\frac{x}{z}, -a, t\right)\\
\mathbf{if}\;z \leq -4.6 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-57}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -4.6000000000000001e79 or 2.24999999999999997e79 < z Initial program 37.5%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites74.8%
Taylor expanded in x around inf
Applied rewrites67.7%
Taylor expanded in y around 0
Applied rewrites58.0%
if -4.6000000000000001e79 < z < -7.60000000000000006e-134 or 2.19999999999999999e-57 < z < 2.24999999999999997e79Initial program 78.2%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in y around inf
Applied rewrites56.8%
if -7.60000000000000006e-134 < z < 2.19999999999999999e-57Initial program 92.4%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.0
Applied rewrites82.0%
Taylor expanded in x around 0
Applied rewrites65.5%
Final simplification60.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- x t) z) y)) (t_2 (fma (/ x z) (- a) t)))
(if (<= z -4.6e+79)
t_2
(if (<= z -7.6e-134)
t_1
(if (<= z 2.35e-57) (fma y (/ t a) x) (if (<= z 2.25e+79) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - t) / z) * y;
double t_2 = fma((x / z), -a, t);
double tmp;
if (z <= -4.6e+79) {
tmp = t_2;
} else if (z <= -7.6e-134) {
tmp = t_1;
} else if (z <= 2.35e-57) {
tmp = fma(y, (t / a), x);
} else if (z <= 2.25e+79) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - t) / z) * y) t_2 = fma(Float64(x / z), Float64(-a), t) tmp = 0.0 if (z <= -4.6e+79) tmp = t_2; elseif (z <= -7.6e-134) tmp = t_1; elseif (z <= 2.35e-57) tmp = fma(y, Float64(t / a), x); elseif (z <= 2.25e+79) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / z), $MachinePrecision] * (-a) + t), $MachinePrecision]}, If[LessEqual[z, -4.6e+79], t$95$2, If[LessEqual[z, -7.6e-134], t$95$1, If[LessEqual[z, 2.35e-57], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.25e+79], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - t}{z} \cdot y\\
t_2 := \mathsf{fma}\left(\frac{x}{z}, -a, t\right)\\
\mathbf{if}\;z \leq -4.6 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -4.6000000000000001e79 or 2.24999999999999997e79 < z Initial program 37.5%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites74.8%
Taylor expanded in x around inf
Applied rewrites67.7%
Taylor expanded in y around 0
Applied rewrites58.0%
if -4.6000000000000001e79 < z < -7.60000000000000006e-134 or 2.3499999999999999e-57 < z < 2.24999999999999997e79Initial program 78.2%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in y around inf
Applied rewrites56.8%
if -7.60000000000000006e-134 < z < 2.3499999999999999e-57Initial program 92.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.2
Applied rewrites93.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6480.0
Applied rewrites80.0%
Taylor expanded in x around 0
Applied rewrites63.5%
Final simplification59.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- x t) z) y)))
(if (<= z -7.5e+82)
t
(if (<= z -7.6e-134)
t_1
(if (<= z 2.35e-57) (fma y (/ t a) x) (if (<= z 2.25e+79) t_1 t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x - t) / z) * y;
double tmp;
if (z <= -7.5e+82) {
tmp = t;
} else if (z <= -7.6e-134) {
tmp = t_1;
} else if (z <= 2.35e-57) {
tmp = fma(y, (t / a), x);
} else if (z <= 2.25e+79) {
tmp = t_1;
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x - t) / z) * y) tmp = 0.0 if (z <= -7.5e+82) tmp = t; elseif (z <= -7.6e-134) tmp = t_1; elseif (z <= 2.35e-57) tmp = fma(y, Float64(t / a), x); elseif (z <= 2.25e+79) tmp = t_1; else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -7.5e+82], t, If[LessEqual[z, -7.6e-134], t$95$1, If[LessEqual[z, 2.35e-57], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.25e+79], t$95$1, t]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - t}{z} \cdot y\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{+82}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -7.4999999999999999e82 or 2.24999999999999997e79 < z Initial program 37.5%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6453.7
Applied rewrites53.7%
Taylor expanded in z around inf
Applied rewrites50.8%
Applied rewrites50.8%
if -7.4999999999999999e82 < z < -7.60000000000000006e-134 or 2.3499999999999999e-57 < z < 2.24999999999999997e79Initial program 78.2%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites68.4%
Taylor expanded in y around inf
Applied rewrites56.8%
if -7.60000000000000006e-134 < z < 2.3499999999999999e-57Initial program 92.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.2
Applied rewrites93.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6480.0
Applied rewrites80.0%
Taylor expanded in x around 0
Applied rewrites63.5%
Final simplification57.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -0.0068) (not (<= z 2.3e-57))) (fma (- x t) (/ (- y a) z) t) (fma (/ y a) (- t x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -0.0068) || !(z <= 2.3e-57)) {
tmp = fma((x - t), ((y - a) / z), t);
} else {
tmp = fma((y / a), (t - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -0.0068) || !(z <= 2.3e-57)) tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); else tmp = fma(Float64(y / a), Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -0.0068], N[Not[LessEqual[z, 2.3e-57]], $MachinePrecision]], N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0068 \lor \neg \left(z \leq 2.3 \cdot 10^{-57}\right):\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\end{array}
\end{array}
if z < -0.00679999999999999962 or 2.3e-57 < z Initial program 51.3%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites74.5%
Taylor expanded in z around inf
Applied rewrites77.2%
if -0.00679999999999999962 < z < 2.3e-57Initial program 89.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-/.f6492.2
Applied rewrites92.2%
Taylor expanded in z around 0
lower-/.f6479.2
Applied rewrites79.2%
Final simplification78.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -0.0068) (not (<= z 2.3e-57))) (fma (- x t) (/ y z) t) (fma (/ y a) (- t x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -0.0068) || !(z <= 2.3e-57)) {
tmp = fma((x - t), (y / z), t);
} else {
tmp = fma((y / a), (t - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -0.0068) || !(z <= 2.3e-57)) tmp = fma(Float64(x - t), Float64(y / z), t); else tmp = fma(Float64(y / a), Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -0.0068], N[Not[LessEqual[z, 2.3e-57]], $MachinePrecision]], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0068 \lor \neg \left(z \leq 2.3 \cdot 10^{-57}\right):\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\end{array}
\end{array}
if z < -0.00679999999999999962 or 2.3e-57 < z Initial program 51.3%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites74.5%
Taylor expanded in z around inf
Applied rewrites77.2%
Taylor expanded in y around inf
Applied rewrites70.8%
if -0.00679999999999999962 < z < 2.3e-57Initial program 89.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-/.f6492.2
Applied rewrites92.2%
Taylor expanded in z around 0
lower-/.f6479.2
Applied rewrites79.2%
Final simplification74.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -0.0068) (not (<= z 2.3e-57))) (fma (- x t) (/ y z) t) (fma (/ (- t x) a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -0.0068) || !(z <= 2.3e-57)) {
tmp = fma((x - t), (y / z), t);
} else {
tmp = fma(((t - x) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -0.0068) || !(z <= 2.3e-57)) tmp = fma(Float64(x - t), Float64(y / 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, -0.0068], N[Not[LessEqual[z, 2.3e-57]], $MachinePrecision]], N[(N[(x - t), $MachinePrecision] * N[(y / 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 -0.0068 \lor \neg \left(z \leq 2.3 \cdot 10^{-57}\right):\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -0.00679999999999999962 or 2.3e-57 < z Initial program 51.3%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites74.5%
Taylor expanded in z around inf
Applied rewrites77.2%
Taylor expanded in y around inf
Applied rewrites70.8%
if -0.00679999999999999962 < z < 2.3e-57Initial program 89.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6476.0
Applied rewrites76.0%
Final simplification73.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.95e-120) (not (<= z 1.45e-57))) (fma (- x t) (/ y z) t) (+ x (/ (* t y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.95e-120) || !(z <= 1.45e-57)) {
tmp = fma((x - t), (y / z), t);
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.95e-120) || !(z <= 1.45e-57)) tmp = fma(Float64(x - t), Float64(y / z), t); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.95e-120], N[Not[LessEqual[z, 1.45e-57]], $MachinePrecision]], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{-120} \lor \neg \left(z \leq 1.45 \cdot 10^{-57}\right):\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if z < -1.9500000000000001e-120 or 1.45000000000000013e-57 < z Initial program 55.1%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites72.1%
Taylor expanded in z around inf
Applied rewrites74.4%
Taylor expanded in y around inf
Applied rewrites69.0%
if -1.9500000000000001e-120 < z < 1.45000000000000013e-57Initial program 91.6%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6480.6
Applied rewrites80.6%
Taylor expanded in x around 0
Applied rewrites64.6%
Final simplification67.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.25e+38) (not (<= z 1.75e+56))) t (fma y (/ t a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.25e+38) || !(z <= 1.75e+56)) {
tmp = t;
} else {
tmp = fma(y, (t / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.25e+38) || !(z <= 1.75e+56)) tmp = t; else tmp = fma(y, Float64(t / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.25e+38], N[Not[LessEqual[z, 1.75e+56]], $MachinePrecision]], t, N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+38} \lor \neg \left(z \leq 1.75 \cdot 10^{+56}\right):\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\end{array}
\end{array}
if z < -1.24999999999999992e38 or 1.75e56 < z Initial program 40.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.1
Applied rewrites51.1%
Taylor expanded in z around inf
Applied rewrites47.4%
Applied rewrites47.4%
if -1.24999999999999992e38 < z < 1.75e56Initial program 89.0%
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.0
Applied rewrites92.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6470.4
Applied rewrites70.4%
Taylor expanded in x around 0
Applied rewrites54.2%
Final simplification51.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.65e+22) (not (<= z 2.6e-28))) t (* t (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.65e+22) || !(z <= 2.6e-28)) {
tmp = t;
} else {
tmp = t * (y / a);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-2.65d+22)) .or. (.not. (z <= 2.6d-28))) then
tmp = t
else
tmp = t * (y / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.65e+22) || !(z <= 2.6e-28)) {
tmp = t;
} else {
tmp = t * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.65e+22) or not (z <= 2.6e-28): tmp = t else: tmp = t * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.65e+22) || !(z <= 2.6e-28)) tmp = t; else tmp = Float64(t * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.65e+22) || ~((z <= 2.6e-28))) tmp = t; else tmp = t * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.65e+22], N[Not[LessEqual[z, 2.6e-28]], $MachinePrecision]], t, N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+22} \lor \neg \left(z \leq 2.6 \cdot 10^{-28}\right):\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.6499999999999999e22 or 2.6e-28 < z Initial program 47.4%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.5
Applied rewrites51.5%
Taylor expanded in z around inf
Applied rewrites43.0%
Applied rewrites43.0%
if -2.6499999999999999e22 < z < 2.6e-28Initial program 90.0%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6436.4
Applied rewrites36.4%
Applied rewrites31.2%
Taylor expanded in z around 0
Applied rewrites28.4%
Final simplification35.6%
(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 69.2%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6443.9
Applied rewrites43.9%
Taylor expanded in z around inf
Applied rewrites23.9%
Applied rewrites23.9%
Final simplification23.9%
(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 2025008
(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))))