
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ y z) (/ t (- 1.0 z)))))
(if (<= t_1 -2e+304)
(/ (* (fma (- 1.0 z) y (* (- z) t)) x) (* (- 1.0 z) z))
(if (<= t_1 1e+306) (* x t_1) (/ (* y x) z)))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -2e+304) {
tmp = (fma((1.0 - z), y, (-z * t)) * x) / ((1.0 - z) * z);
} else if (t_1 <= 1e+306) {
tmp = x * t_1;
} else {
tmp = (y * x) / z;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_1 <= -2e+304) tmp = Float64(Float64(fma(Float64(1.0 - z), y, Float64(Float64(-z) * t)) * x) / Float64(Float64(1.0 - z) * z)); elseif (t_1 <= 1e+306) tmp = Float64(x * t_1); else tmp = Float64(Float64(y * x) / z); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+304], N[(N[(N[(N[(1.0 - z), $MachinePrecision] * y + N[((-z) * t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(N[(1.0 - z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+306], N[(x * t$95$1), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+304}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1 - z, y, \left(-z\right) \cdot t\right) \cdot x}{\left(1 - z\right) \cdot z}\\
\mathbf{elif}\;t\_1 \leq 10^{+306}:\\
\;\;\;\;x \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -1.9999999999999999e304Initial program 68.9%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
if -1.9999999999999999e304 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1.00000000000000002e306Initial program 97.0%
if 1.00000000000000002e306 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 71.0%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.0
Applied rewrites71.0%
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ y z) (/ t (- 1.0 z)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+306)))
(/ (* y x) z)
(* x t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+306)) {
tmp = (y * x) / z;
} else {
tmp = x * t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+306)) {
tmp = (y * x) / z;
} else {
tmp = x * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 1e+306): tmp = (y * x) / z else: tmp = x * t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+306)) tmp = Float64(Float64(y * x) / z); else tmp = Float64(x * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 1e+306))) tmp = (y * x) / z; else tmp = x * t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+306]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], N[(x * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 10^{+306}\right):\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 1.00000000000000002e306 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 69.0%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6469.0
Applied rewrites69.0%
Applied rewrites100.0%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1.00000000000000002e306Initial program 97.0%
Final simplification97.3%
(FPCore (x y z t)
:precision binary64
(if (<= t -2.2e+17)
(/ (* t x) (- z 1.0))
(if (<= t -9.2e-240)
(* (/ y z) x)
(if (<= t 9.2e+55) (* (/ x z) y) (* (/ x (- z 1.0)) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.2e+17) {
tmp = (t * x) / (z - 1.0);
} else if (t <= -9.2e-240) {
tmp = (y / z) * x;
} else if (t <= 9.2e+55) {
tmp = (x / z) * y;
} else {
tmp = (x / (z - 1.0)) * 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)
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) :: tmp
if (t <= (-2.2d+17)) then
tmp = (t * x) / (z - 1.0d0)
else if (t <= (-9.2d-240)) then
tmp = (y / z) * x
else if (t <= 9.2d+55) then
tmp = (x / z) * y
else
tmp = (x / (z - 1.0d0)) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.2e+17) {
tmp = (t * x) / (z - 1.0);
} else if (t <= -9.2e-240) {
tmp = (y / z) * x;
} else if (t <= 9.2e+55) {
tmp = (x / z) * y;
} else {
tmp = (x / (z - 1.0)) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.2e+17: tmp = (t * x) / (z - 1.0) elif t <= -9.2e-240: tmp = (y / z) * x elif t <= 9.2e+55: tmp = (x / z) * y else: tmp = (x / (z - 1.0)) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.2e+17) tmp = Float64(Float64(t * x) / Float64(z - 1.0)); elseif (t <= -9.2e-240) tmp = Float64(Float64(y / z) * x); elseif (t <= 9.2e+55) tmp = Float64(Float64(x / z) * y); else tmp = Float64(Float64(x / Float64(z - 1.0)) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.2e+17) tmp = (t * x) / (z - 1.0); elseif (t <= -9.2e-240) tmp = (y / z) * x; elseif (t <= 9.2e+55) tmp = (x / z) * y; else tmp = (x / (z - 1.0)) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.2e+17], N[(N[(t * x), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -9.2e-240], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 9.2e+55], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], N[(N[(x / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{+17}:\\
\;\;\;\;\frac{t \cdot x}{z - 1}\\
\mathbf{elif}\;t \leq -9.2 \cdot 10^{-240}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{+55}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - 1} \cdot t\\
\end{array}
\end{array}
if t < -2.2e17Initial program 96.4%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
fp-cancel-sub-signN/A
metadata-evalN/A
lower--.f6467.8
Applied rewrites67.8%
if -2.2e17 < t < -9.19999999999999972e-240Initial program 91.2%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.3
Applied rewrites83.3%
if -9.19999999999999972e-240 < t < 9.1999999999999995e55Initial program 92.2%
Taylor expanded in y around inf
*-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites89.7%
Taylor expanded in y around inf
Applied rewrites88.7%
if 9.1999999999999995e55 < t Initial program 95.2%
Taylor expanded in y around inf
*-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites76.5%
Taylor expanded in y around 0
Applied rewrites77.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x (- z 1.0)) t)))
(if (<= t -2.2e+17)
t_1
(if (<= t -9.2e-240)
(* (/ y z) x)
(if (<= t 9.2e+55) (* (/ x z) y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / (z - 1.0)) * t;
double tmp;
if (t <= -2.2e+17) {
tmp = t_1;
} else if (t <= -9.2e-240) {
tmp = (y / z) * x;
} else if (t <= 9.2e+55) {
tmp = (x / z) * y;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = (x / (z - 1.0d0)) * t
if (t <= (-2.2d+17)) then
tmp = t_1
else if (t <= (-9.2d-240)) then
tmp = (y / z) * x
else if (t <= 9.2d+55) then
tmp = (x / z) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / (z - 1.0)) * t;
double tmp;
if (t <= -2.2e+17) {
tmp = t_1;
} else if (t <= -9.2e-240) {
tmp = (y / z) * x;
} else if (t <= 9.2e+55) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / (z - 1.0)) * t tmp = 0 if t <= -2.2e+17: tmp = t_1 elif t <= -9.2e-240: tmp = (y / z) * x elif t <= 9.2e+55: tmp = (x / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(z - 1.0)) * t) tmp = 0.0 if (t <= -2.2e+17) tmp = t_1; elseif (t <= -9.2e-240) tmp = Float64(Float64(y / z) * x); elseif (t <= 9.2e+55) tmp = Float64(Float64(x / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / (z - 1.0)) * t; tmp = 0.0; if (t <= -2.2e+17) tmp = t_1; elseif (t <= -9.2e-240) tmp = (y / z) * x; elseif (t <= 9.2e+55) tmp = (x / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -2.2e+17], t$95$1, If[LessEqual[t, -9.2e-240], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 9.2e+55], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z - 1} \cdot t\\
\mathbf{if}\;t \leq -2.2 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -9.2 \cdot 10^{-240}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{+55}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.2e17 or 9.1999999999999995e55 < t Initial program 95.8%
Taylor expanded in y around inf
*-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites76.2%
Taylor expanded in y around 0
Applied rewrites70.8%
if -2.2e17 < t < -9.19999999999999972e-240Initial program 91.2%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.3
Applied rewrites83.3%
if -9.19999999999999972e-240 < t < 9.1999999999999995e55Initial program 92.2%
Taylor expanded in y around inf
*-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites89.7%
Taylor expanded in y around inf
Applied rewrites88.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* (+ y t) (/ x z)) (if (<= z 1.0) (/ (* x (- y (* t z))) z) (/ (* (+ t y) x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = (y + t) * (x / z);
} else if (z <= 1.0) {
tmp = (x * (y - (t * z))) / z;
} else {
tmp = ((t + y) * x) / z;
}
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)
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) :: tmp
if (z <= (-1.0d0)) then
tmp = (y + t) * (x / z)
else if (z <= 1.0d0) then
tmp = (x * (y - (t * z))) / z
else
tmp = ((t + y) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = (y + t) * (x / z);
} else if (z <= 1.0) {
tmp = (x * (y - (t * z))) / z;
} else {
tmp = ((t + y) * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = (y + t) * (x / z) elif z <= 1.0: tmp = (x * (y - (t * z))) / z else: tmp = ((t + y) * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(y + t) * Float64(x / z)); elseif (z <= 1.0) tmp = Float64(Float64(x * Float64(y - Float64(t * z))) / z); else tmp = Float64(Float64(Float64(t + y) * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = (y + t) * (x / z); elseif (z <= 1.0) tmp = (x * (y - (t * z))) / z; else tmp = ((t + y) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(x * N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x \cdot \left(y - t \cdot z\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t + y\right) \cdot x}{z}\\
\end{array}
\end{array}
if z < -1Initial program 94.2%
Taylor expanded in z around -inf
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6490.0
Applied rewrites90.0%
if -1 < z < 1Initial program 91.8%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
fp-cancel-sub-signN/A
mul-1-negN/A
associate-*r*N/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
lower-*.f6495.7
Applied rewrites95.7%
if 1 < z Initial program 96.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6489.9
Applied rewrites89.9%
Final simplification92.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* (+ y t) (/ x z)) (if (<= z 1.0) (* (- y (* t z)) (/ x z)) (/ (* (+ t y) x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = (y + t) * (x / z);
} else if (z <= 1.0) {
tmp = (y - (t * z)) * (x / z);
} else {
tmp = ((t + y) * x) / z;
}
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)
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) :: tmp
if (z <= (-1.0d0)) then
tmp = (y + t) * (x / z)
else if (z <= 1.0d0) then
tmp = (y - (t * z)) * (x / z)
else
tmp = ((t + y) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = (y + t) * (x / z);
} else if (z <= 1.0) {
tmp = (y - (t * z)) * (x / z);
} else {
tmp = ((t + y) * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = (y + t) * (x / z) elif z <= 1.0: tmp = (y - (t * z)) * (x / z) else: tmp = ((t + y) * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(y + t) * Float64(x / z)); elseif (z <= 1.0) tmp = Float64(Float64(y - Float64(t * z)) * Float64(x / z)); else tmp = Float64(Float64(Float64(t + y) * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = (y + t) * (x / z); elseif (z <= 1.0) tmp = (y - (t * z)) * (x / z); else tmp = ((t + y) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\left(y - t \cdot z\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t + y\right) \cdot x}{z}\\
\end{array}
\end{array}
if z < -1Initial program 94.2%
Taylor expanded in z around -inf
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6490.0
Applied rewrites90.0%
if -1 < z < 1Initial program 91.8%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
fp-cancel-sub-signN/A
mul-1-negN/A
associate-*r*N/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
lower-*.f6495.7
Applied rewrites95.7%
Applied rewrites93.9%
if 1 < z Initial program 96.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6489.9
Applied rewrites89.9%
Final simplification91.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.92) (not (<= z 1.0))) (/ (* (+ t y) x) z) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.92) || !(z <= 1.0)) {
tmp = ((t + y) * x) / z;
} else {
tmp = x * ((y / z) - 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)
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) :: tmp
if ((z <= (-0.92d0)) .or. (.not. (z <= 1.0d0))) then
tmp = ((t + y) * x) / z
else
tmp = x * ((y / z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.92) || !(z <= 1.0)) {
tmp = ((t + y) * x) / z;
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.92) or not (z <= 1.0): tmp = ((t + y) * x) / z else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.92) || !(z <= 1.0)) tmp = Float64(Float64(Float64(t + y) * x) / z); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.92) || ~((z <= 1.0))) tmp = ((t + y) * x) / z; else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.92], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.92 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{\left(t + y\right) \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -0.92000000000000004 or 1 < z Initial program 95.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6485.2
Applied rewrites85.2%
if -0.92000000000000004 < z < 1Initial program 91.8%
Taylor expanded in z around 0
div-addN/A
associate-*r*N/A
associate-/l*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
*-inversesN/A
*-rgt-identityN/A
lower--.f64N/A
lower-/.f6490.8
Applied rewrites90.8%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.5e-69) (not (<= z 1.0))) (/ (* (+ t y) x) z) (* (/ x z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e-69) || !(z <= 1.0)) {
tmp = ((t + y) * x) / z;
} else {
tmp = (x / z) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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) :: tmp
if ((z <= (-3.5d-69)) .or. (.not. (z <= 1.0d0))) then
tmp = ((t + y) * x) / z
else
tmp = (x / z) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e-69) || !(z <= 1.0)) {
tmp = ((t + y) * x) / z;
} else {
tmp = (x / z) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.5e-69) or not (z <= 1.0): tmp = ((t + y) * x) / z else: tmp = (x / z) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.5e-69) || !(z <= 1.0)) tmp = Float64(Float64(Float64(t + y) * x) / z); else tmp = Float64(Float64(x / z) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.5e-69) || ~((z <= 1.0))) tmp = ((t + y) * x) / z; else tmp = (x / z) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.5e-69], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-69} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{\left(t + y\right) \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\end{array}
\end{array}
if z < -3.5000000000000001e-69 or 1 < z Initial program 95.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6482.3
Applied rewrites82.3%
if -3.5000000000000001e-69 < z < 1Initial program 90.2%
Taylor expanded in y around inf
*-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites83.8%
Taylor expanded in y around inf
Applied rewrites76.2%
Final simplification80.0%
(FPCore (x y z t) :precision binary64 (if (<= z -0.86) (* (+ y t) (/ x z)) (if (<= z 1.0) (* x (- (/ y z) t)) (/ (* (+ t y) x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.86) {
tmp = (y + t) * (x / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = ((t + y) * x) / z;
}
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)
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) :: tmp
if (z <= (-0.86d0)) then
tmp = (y + t) * (x / z)
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else
tmp = ((t + y) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.86) {
tmp = (y + t) * (x / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = ((t + y) * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.86: tmp = (y + t) * (x / z) elif z <= 1.0: tmp = x * ((y / z) - t) else: tmp = ((t + y) * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.86) tmp = Float64(Float64(y + t) * Float64(x / z)); elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(Float64(Float64(t + y) * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.86) tmp = (y + t) * (x / z); elseif (z <= 1.0) tmp = x * ((y / z) - t); else tmp = ((t + y) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.86], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.86:\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t + y\right) \cdot x}{z}\\
\end{array}
\end{array}
if z < -0.859999999999999987Initial program 94.2%
Taylor expanded in z around -inf
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6490.0
Applied rewrites90.0%
if -0.859999999999999987 < z < 1Initial program 91.8%
Taylor expanded in z around 0
div-addN/A
associate-*r*N/A
associate-/l*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
*-inversesN/A
*-rgt-identityN/A
lower--.f64N/A
lower-/.f6490.8
Applied rewrites90.8%
if 1 < z Initial program 96.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6489.9
Applied rewrites89.9%
Final simplification90.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.1e+194) (not (<= t 7e+112))) (* x (/ t z)) (* (/ x z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e+194) || !(t <= 7e+112)) {
tmp = x * (t / z);
} else {
tmp = (x / z) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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) :: tmp
if ((t <= (-2.1d+194)) .or. (.not. (t <= 7d+112))) then
tmp = x * (t / z)
else
tmp = (x / z) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e+194) || !(t <= 7e+112)) {
tmp = x * (t / z);
} else {
tmp = (x / z) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.1e+194) or not (t <= 7e+112): tmp = x * (t / z) else: tmp = (x / z) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.1e+194) || !(t <= 7e+112)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(Float64(x / z) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.1e+194) || ~((t <= 7e+112))) tmp = x * (t / z); else tmp = (x / z) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.1e+194], N[Not[LessEqual[t, 7e+112]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+194} \lor \neg \left(t \leq 7 \cdot 10^{+112}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\end{array}
\end{array}
if t < -2.10000000000000016e194 or 6.99999999999999994e112 < t Initial program 93.9%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
fp-cancel-sub-signN/A
metadata-evalN/A
lower--.f6487.4
Applied rewrites87.4%
Taylor expanded in z around inf
Applied rewrites66.5%
if -2.10000000000000016e194 < t < 6.99999999999999994e112Initial program 93.6%
Taylor expanded in y around inf
*-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites85.6%
Taylor expanded in y around inf
Applied rewrites73.6%
Final simplification71.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.1e+194) (not (<= t 2.8e+114))) (* (/ x z) t) (* (/ x z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e+194) || !(t <= 2.8e+114)) {
tmp = (x / z) * t;
} else {
tmp = (x / z) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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) :: tmp
if ((t <= (-2.1d+194)) .or. (.not. (t <= 2.8d+114))) then
tmp = (x / z) * t
else
tmp = (x / z) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e+194) || !(t <= 2.8e+114)) {
tmp = (x / z) * t;
} else {
tmp = (x / z) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.1e+194) or not (t <= 2.8e+114): tmp = (x / z) * t else: tmp = (x / z) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.1e+194) || !(t <= 2.8e+114)) tmp = Float64(Float64(x / z) * t); else tmp = Float64(Float64(x / z) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.1e+194) || ~((t <= 2.8e+114))) tmp = (x / z) * t; else tmp = (x / z) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.1e+194], N[Not[LessEqual[t, 2.8e+114]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+194} \lor \neg \left(t \leq 2.8 \cdot 10^{+114}\right):\\
\;\;\;\;\frac{x}{z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\end{array}
\end{array}
if t < -2.10000000000000016e194 or 2.8e114 < t Initial program 93.9%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6463.1
Applied rewrites63.1%
Taylor expanded in t around inf
Applied rewrites63.0%
Taylor expanded in y around 0
Applied rewrites53.8%
if -2.10000000000000016e194 < t < 2.8e114Initial program 93.6%
Taylor expanded in y around inf
*-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites85.6%
Taylor expanded in y around inf
Applied rewrites73.6%
Final simplification68.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.5) (not (<= z 1.0))) (* (/ x z) t) (* x (- (fma t z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.5) || !(z <= 1.0)) {
tmp = (x / z) * t;
} else {
tmp = x * -fma(t, z, t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.5) || !(z <= 1.0)) tmp = Float64(Float64(x / z) * t); else tmp = Float64(x * Float64(-fma(t, z, t))); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.5], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision], N[(x * (-N[(t * z + t), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-\mathsf{fma}\left(t, z, t\right)\right)\\
\end{array}
\end{array}
if z < -4.5 or 1 < z Initial program 95.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6485.3
Applied rewrites85.3%
Taylor expanded in t around inf
Applied rewrites72.2%
Taylor expanded in y around 0
Applied rewrites52.3%
if -4.5 < z < 1Initial program 91.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
fp-cancel-sub-signN/A
metadata-evalN/A
lower--.f6436.1
Applied rewrites36.1%
Taylor expanded in z around 0
Applied rewrites35.7%
Final simplification44.7%
(FPCore (x y z t) :precision binary64 (if (<= t -2.1e+194) (/ (* t x) z) (if (<= t 2.8e+114) (* (/ x z) y) (* (/ x z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.1e+194) {
tmp = (t * x) / z;
} else if (t <= 2.8e+114) {
tmp = (x / z) * y;
} else {
tmp = (x / z) * 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)
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) :: tmp
if (t <= (-2.1d+194)) then
tmp = (t * x) / z
else if (t <= 2.8d+114) then
tmp = (x / z) * y
else
tmp = (x / z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.1e+194) {
tmp = (t * x) / z;
} else if (t <= 2.8e+114) {
tmp = (x / z) * y;
} else {
tmp = (x / z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.1e+194: tmp = (t * x) / z elif t <= 2.8e+114: tmp = (x / z) * y else: tmp = (x / z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.1e+194) tmp = Float64(Float64(t * x) / z); elseif (t <= 2.8e+114) tmp = Float64(Float64(x / z) * y); else tmp = Float64(Float64(x / z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.1e+194) tmp = (t * x) / z; elseif (t <= 2.8e+114) tmp = (x / z) * y; else tmp = (x / z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.1e+194], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 2.8e+114], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+194}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+114}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot t\\
\end{array}
\end{array}
if t < -2.10000000000000016e194Initial program 94.3%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6475.3
Applied rewrites75.3%
Taylor expanded in y around 0
Applied rewrites66.0%
if -2.10000000000000016e194 < t < 2.8e114Initial program 93.6%
Taylor expanded in y around inf
*-commutativeN/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites85.6%
Taylor expanded in y around inf
Applied rewrites73.6%
if 2.8e114 < t Initial program 93.7%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6458.5
Applied rewrites58.5%
Taylor expanded in t around inf
Applied rewrites58.5%
Taylor expanded in y around 0
Applied rewrites56.0%
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
return x * -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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * -t
end function
public static double code(double x, double y, double z, double t) {
return x * -t;
}
def code(x, y, z, t): return x * -t
function code(x, y, z, t) return Float64(x * Float64(-t)) end
function tmp = code(x, y, z, t) tmp = x * -t; end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-t\right)
\end{array}
Initial program 93.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-subN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
fp-cancel-sub-signN/A
metadata-evalN/A
lower--.f6447.9
Applied rewrites47.9%
Taylor expanded in z around 0
Applied rewrites21.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - 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)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025008
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- (/ y z) (/ t (- 1 z)))) -3811613151656021/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 7066972463851151/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z))))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))