
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (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) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{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) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (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) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y z) t) (- a z)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+305)))
(* (- y z) (/ t (- a z)))
t_1)))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * t) / (a - z));
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+305)) {
tmp = (y - z) * (t / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * t) / (a - z));
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+305)) {
tmp = (y - z) * (t / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - z) * t) / (a - z)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 5e+305): tmp = (y - z) * (t / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+305)) tmp = Float64(Float64(y - z) * Float64(t / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - z) * t) / (a - z)); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 5e+305))) tmp = (y - z) * (t / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+305]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+305}\right):\\
\;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z))) < -inf.0 or 5.00000000000000009e305 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z))) Initial program 37.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6486.9
Applied rewrites86.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z))) < 5.00000000000000009e305Initial program 99.9%
Final simplification96.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.06e-101)
(fma (/ (- z y) z) t x)
(if (<= z 2.7e-91)
(+ x (/ (* (- y z) t) a))
(if (<= z 6.1e+88) (fma (- z y) (/ t z) x) (fma (/ z (- a z)) (- t) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.06e-101) {
tmp = fma(((z - y) / z), t, x);
} else if (z <= 2.7e-91) {
tmp = x + (((y - z) * t) / a);
} else if (z <= 6.1e+88) {
tmp = fma((z - y), (t / z), x);
} else {
tmp = fma((z / (a - z)), -t, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.06e-101) tmp = fma(Float64(Float64(z - y) / z), t, x); elseif (z <= 2.7e-91) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / a)); elseif (z <= 6.1e+88) tmp = fma(Float64(z - y), Float64(t / z), x); else tmp = fma(Float64(z / Float64(a - z)), Float64(-t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.06e-101], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 2.7e-91], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.1e+88], N[(N[(z - y), $MachinePrecision] * N[(t / z), $MachinePrecision] + x), $MachinePrecision], N[(N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision] * (-t) + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.06 \cdot 10^{-101}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z}, t, x\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-91}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a}\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(z - y, \frac{t}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a - z}, -t, x\right)\\
\end{array}
\end{array}
if z < -1.0600000000000001e-101Initial program 78.4%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6483.4
Applied rewrites83.4%
if -1.0600000000000001e-101 < z < 2.6999999999999997e-91Initial program 97.8%
Taylor expanded in a around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6488.7
Applied rewrites88.7%
if 2.6999999999999997e-91 < z < 6.0999999999999998e88Initial program 91.2%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6476.0
Applied rewrites76.0%
Applied rewrites80.8%
if 6.0999999999999998e88 < z Initial program 60.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6490.7
Applied rewrites90.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.8e-103)
(fma (/ (- z y) z) t x)
(if (<= z 1.25e-55)
(fma (/ y a) t x)
(if (<= z 6.8e-8)
(* (- y z) (/ t (- a z)))
(fma (/ z (- a z)) (- t) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.8e-103) {
tmp = fma(((z - y) / z), t, x);
} else if (z <= 1.25e-55) {
tmp = fma((y / a), t, x);
} else if (z <= 6.8e-8) {
tmp = (y - z) * (t / (a - z));
} else {
tmp = fma((z / (a - z)), -t, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.8e-103) tmp = fma(Float64(Float64(z - y) / z), t, x); elseif (z <= 1.25e-55) tmp = fma(Float64(y / a), t, x); elseif (z <= 6.8e-8) tmp = Float64(Float64(y - z) * Float64(t / Float64(a - z))); else tmp = fma(Float64(z / Float64(a - z)), Float64(-t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.8e-103], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 1.25e-55], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 6.8e-8], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision] * (-t) + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-103}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z}, t, x\right)\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-55}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-8}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a - z}, -t, x\right)\\
\end{array}
\end{array}
if z < -3.8000000000000001e-103Initial program 78.4%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6483.4
Applied rewrites83.4%
if -3.8000000000000001e-103 < z < 1.25e-55Initial program 97.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.5
Applied rewrites86.5%
if 1.25e-55 < z < 6.8e-8Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6496.5
Applied rewrites96.5%
if 6.8e-8 < z Initial program 69.6%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6484.4
Applied rewrites84.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.5e+38)
(+ t x)
(if (<= z 1.1e-48)
(fma (/ y a) t x)
(if (<= z 1.1e-12) (/ (* (- z y) t) z) (+ t x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+38) {
tmp = t + x;
} else if (z <= 1.1e-48) {
tmp = fma((y / a), t, x);
} else if (z <= 1.1e-12) {
tmp = ((z - y) * t) / z;
} else {
tmp = t + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.5e+38) tmp = Float64(t + x); elseif (z <= 1.1e-48) tmp = fma(Float64(y / a), t, x); elseif (z <= 1.1e-12) tmp = Float64(Float64(Float64(z - y) * t) / z); else tmp = Float64(t + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.5e+38], N[(t + x), $MachinePrecision], If[LessEqual[z, 1.1e-48], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 1.1e-12], N[(N[(N[(z - y), $MachinePrecision] * t), $MachinePrecision] / z), $MachinePrecision], N[(t + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+38}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-48}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-12}:\\
\;\;\;\;\frac{\left(z - y\right) \cdot t}{z}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -3.50000000000000002e38 or 1.09999999999999996e-12 < z Initial program 70.7%
Taylor expanded in z around inf
lower-+.f6472.4
Applied rewrites72.4%
if -3.50000000000000002e38 < z < 1.10000000000000006e-48Initial program 96.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.7
Applied rewrites81.7%
if 1.10000000000000006e-48 < z < 1.09999999999999996e-12Initial program 100.0%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6473.6
Applied rewrites73.6%
Taylor expanded in x around 0
Applied rewrites80.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.55e+39) (fma (/ (- z y) z) t x) (if (<= z 4.6e+71) (+ x (/ (* t y) (- a z))) (fma (/ z (- a z)) (- t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.55e+39) {
tmp = fma(((z - y) / z), t, x);
} else if (z <= 4.6e+71) {
tmp = x + ((t * y) / (a - z));
} else {
tmp = fma((z / (a - z)), -t, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.55e+39) tmp = fma(Float64(Float64(z - y) / z), t, x); elseif (z <= 4.6e+71) tmp = Float64(x + Float64(Float64(t * y) / Float64(a - z))); else tmp = fma(Float64(z / Float64(a - z)), Float64(-t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.55e+39], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 4.6e+71], N[(x + N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision] * (-t) + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.55 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z}, t, x\right)\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+71}:\\
\;\;\;\;x + \frac{t \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a - z}, -t, x\right)\\
\end{array}
\end{array}
if z < -2.5499999999999999e39Initial program 71.3%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6488.2
Applied rewrites88.2%
if -2.5499999999999999e39 < z < 4.6000000000000005e71Initial program 96.3%
Taylor expanded in y around inf
lower-*.f6489.9
Applied rewrites89.9%
if 4.6000000000000005e71 < z Initial program 62.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6489.9
Applied rewrites89.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3e-127) (not (<= z 1.65e-62))) (fma (- z y) (/ t z) x) (fma (/ y a) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3e-127) || !(z <= 1.65e-62)) {
tmp = fma((z - y), (t / z), x);
} else {
tmp = fma((y / a), t, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3e-127) || !(z <= 1.65e-62)) tmp = fma(Float64(z - y), Float64(t / z), x); else tmp = fma(Float64(y / a), t, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3e-127], N[Not[LessEqual[z, 1.65e-62]], $MachinePrecision]], N[(N[(z - y), $MachinePrecision] * N[(t / z), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{-127} \lor \neg \left(z \leq 1.65 \cdot 10^{-62}\right):\\
\;\;\;\;\mathsf{fma}\left(z - y, \frac{t}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\end{array}
\end{array}
if z < -3.00000000000000009e-127 or 1.65000000000000002e-62 < z Initial program 77.6%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6480.4
Applied rewrites80.4%
Applied rewrites79.0%
if -3.00000000000000009e-127 < z < 1.65000000000000002e-62Initial program 97.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6487.8
Applied rewrites87.8%
Final simplification82.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.8e-103) (fma (/ (- z y) z) t x) (if (<= z 1.65e-62) (fma (/ y a) t x) (fma (- z y) (/ t z) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.8e-103) {
tmp = fma(((z - y) / z), t, x);
} else if (z <= 1.65e-62) {
tmp = fma((y / a), t, x);
} else {
tmp = fma((z - y), (t / z), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.8e-103) tmp = fma(Float64(Float64(z - y) / z), t, x); elseif (z <= 1.65e-62) tmp = fma(Float64(y / a), t, x); else tmp = fma(Float64(z - y), Float64(t / z), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.8e-103], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 1.65e-62], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(N[(z - y), $MachinePrecision] * N[(t / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-103}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z}, t, x\right)\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-62}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - y, \frac{t}{z}, x\right)\\
\end{array}
\end{array}
if z < -3.8000000000000001e-103Initial program 78.4%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6483.4
Applied rewrites83.4%
if -3.8000000000000001e-103 < z < 1.65000000000000002e-62Initial program 97.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.4
Applied rewrites86.4%
if 1.65000000000000002e-62 < z Initial program 75.4%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
mul-1-negN/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6479.8
Applied rewrites79.8%
Applied rewrites80.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.5e+38) (not (<= z 3.9e-28))) (+ t x) (fma (/ y a) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.5e+38) || !(z <= 3.9e-28)) {
tmp = t + x;
} else {
tmp = fma((y / a), t, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.5e+38) || !(z <= 3.9e-28)) tmp = Float64(t + x); else tmp = fma(Float64(y / a), t, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.5e+38], N[Not[LessEqual[z, 3.9e-28]], $MachinePrecision]], N[(t + x), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+38} \lor \neg \left(z \leq 3.9 \cdot 10^{-28}\right):\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\end{array}
\end{array}
if z < -3.50000000000000002e38 or 3.89999999999999999e-28 < z Initial program 72.4%
Taylor expanded in z around inf
lower-+.f6470.5
Applied rewrites70.5%
if -3.50000000000000002e38 < z < 3.89999999999999999e-28Initial program 97.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
Final simplification75.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1e+110) (not (<= y 2.15e+171))) (* y (/ t a)) (+ t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1e+110) || !(y <= 2.15e+171)) {
tmp = y * (t / a);
} else {
tmp = t + 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 ((y <= (-1d+110)) .or. (.not. (y <= 2.15d+171))) then
tmp = y * (t / a)
else
tmp = t + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1e+110) || !(y <= 2.15e+171)) {
tmp = y * (t / a);
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1e+110) or not (y <= 2.15e+171): tmp = y * (t / a) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1e+110) || !(y <= 2.15e+171)) tmp = Float64(y * Float64(t / a)); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1e+110) || ~((y <= 2.15e+171))) tmp = y * (t / a); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1e+110], N[Not[LessEqual[y, 2.15e+171]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+110} \lor \neg \left(y \leq 2.15 \cdot 10^{+171}\right):\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if y < -1e110 or 2.15000000000000004e171 < y Initial program 87.4%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6470.5
Applied rewrites70.5%
Applied rewrites72.6%
Taylor expanded in z around 0
Applied rewrites41.7%
if -1e110 < y < 2.15000000000000004e171Initial program 84.4%
Taylor expanded in z around inf
lower-+.f6470.7
Applied rewrites70.7%
Final simplification63.0%
(FPCore (x y z t a) :precision binary64 (if (<= y -1e+110) (* y (/ t a)) (if (<= y 2.15e+171) (+ t x) (* (/ y a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1e+110) {
tmp = y * (t / a);
} else if (y <= 2.15e+171) {
tmp = t + x;
} else {
tmp = (y / a) * t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-1d+110)) then
tmp = y * (t / a)
else if (y <= 2.15d+171) then
tmp = t + x
else
tmp = (y / a) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1e+110) {
tmp = y * (t / a);
} else if (y <= 2.15e+171) {
tmp = t + x;
} else {
tmp = (y / a) * t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1e+110: tmp = y * (t / a) elif y <= 2.15e+171: tmp = t + x else: tmp = (y / a) * t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1e+110) tmp = Float64(y * Float64(t / a)); elseif (y <= 2.15e+171) tmp = Float64(t + x); else tmp = Float64(Float64(y / a) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1e+110) tmp = y * (t / a); elseif (y <= 2.15e+171) tmp = t + x; else tmp = (y / a) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1e+110], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.15e+171], N[(t + x), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+110}:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+171}:\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\end{array}
\end{array}
if y < -1e110Initial program 91.0%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6471.0
Applied rewrites71.0%
Applied rewrites71.1%
Taylor expanded in z around 0
Applied rewrites41.6%
if -1e110 < y < 2.15000000000000004e171Initial program 84.4%
Taylor expanded in z around inf
lower-+.f6470.7
Applied rewrites70.7%
if 2.15000000000000004e171 < y Initial program 81.2%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6469.7
Applied rewrites69.7%
Taylor expanded in z around 0
Applied rewrites42.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.5e+37) (not (<= z 1.3e-44))) (+ t x) (* (- x) -1.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.5e+37) || !(z <= 1.3e-44)) {
tmp = t + x;
} else {
tmp = -x * -1.0;
}
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 <= (-4.5d+37)) .or. (.not. (z <= 1.3d-44))) then
tmp = t + x
else
tmp = -x * (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.5e+37) || !(z <= 1.3e-44)) {
tmp = t + x;
} else {
tmp = -x * -1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.5e+37) or not (z <= 1.3e-44): tmp = t + x else: tmp = -x * -1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.5e+37) || !(z <= 1.3e-44)) tmp = Float64(t + x); else tmp = Float64(Float64(-x) * -1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.5e+37) || ~((z <= 1.3e-44))) tmp = t + x; else tmp = -x * -1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.5e+37], N[Not[LessEqual[z, 1.3e-44]], $MachinePrecision]], N[(t + x), $MachinePrecision], N[((-x) * -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+37} \lor \neg \left(z \leq 1.3 \cdot 10^{-44}\right):\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot -1\\
\end{array}
\end{array}
if z < -4.49999999999999962e37 or 1.2999999999999999e-44 < z Initial program 73.5%
Taylor expanded in z around inf
lower-+.f6467.8
Applied rewrites67.8%
if -4.49999999999999962e37 < z < 1.2999999999999999e-44Initial program 96.9%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
metadata-evalN/A
metadata-evalN/A
fp-cancel-sign-subN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites84.5%
Taylor expanded in x around inf
Applied rewrites55.6%
Final simplification61.7%
(FPCore (x y z t a) :precision binary64 (+ t x))
double code(double x, double y, double z, double t, double a) {
return t + x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = t + x
end function
public static double code(double x, double y, double z, double t, double a) {
return t + x;
}
def code(x, y, z, t, a): return t + x
function code(x, y, z, t, a) return Float64(t + x) end
function tmp = code(x, y, z, t, a) tmp = t + x; end
code[x_, y_, z_, t_, a_] := N[(t + x), $MachinePrecision]
\begin{array}{l}
\\
t + x
\end{array}
Initial program 85.2%
Taylor expanded in z around inf
lower-+.f6457.2
Applied rewrites57.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y z) (- a z)) t))))
(if (< t -1.0682974490174067e-39)
t_1
(if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - z) / (a - z)) * t)
if (t < (-1.0682974490174067d-39)) then
tmp = t_1
else if (t < 3.9110949887586375d-141) then
tmp = x + (((y - z) * t) / (a - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - z) / (a - z)) * t) tmp = 0 if t < -1.0682974490174067e-39: tmp = t_1 elif t < 3.9110949887586375e-141: tmp = x + (((y - z) * t) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) tmp = 0.0 if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - z) / (a - z)) * t); tmp = 0.0; if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = x + (((y - z) * t) / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.0682974490174067e-39], t$95$1, If[Less[t, 3.9110949887586375e-141], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025008
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (if (< t -10682974490174067/10000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 312887599100691/80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t)))))
(+ x (/ (* (- y z) t) (- a z))))