
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.2e+204) (not (<= t 4.6e+200))) (- y (* (/ (- y x) t) (- z a))) (fma (/ (- z t) (- a t)) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.2e+204) || !(t <= 4.6e+200)) {
tmp = y - (((y - x) / t) * (z - a));
} else {
tmp = fma(((z - t) / (a - t)), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.2e+204) || !(t <= 4.6e+200)) tmp = Float64(y - Float64(Float64(Float64(y - x) / t) * Float64(z - a))); else tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.2e+204], N[Not[LessEqual[t, 4.6e+200]], $MachinePrecision]], N[(y - N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+204} \lor \neg \left(t \leq 4.6 \cdot 10^{+200}\right):\\
\;\;\;\;y - \frac{y - x}{t} \cdot \left(z - a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\end{array}
\end{array}
if t < -4.2000000000000001e204 or 4.60000000000000006e200 < t Initial program 22.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6453.0
Applied rewrites53.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6453.0
Applied rewrites53.0%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6495.4
Applied rewrites95.4%
if -4.2000000000000001e204 < t < 4.60000000000000006e200Initial program 84.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
Final simplification91.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- y (* (/ (- y x) t) (- z a)))))
(if (<= t -9.5e+121)
t_1
(if (<= t -8.5e-14)
(+ x (/ (* (- z t) y) (- a t)))
(if (<= t 5e+66) (+ x (/ (* (- y x) z) (- a t))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y - (((y - x) / t) * (z - a));
double tmp;
if (t <= -9.5e+121) {
tmp = t_1;
} else if (t <= -8.5e-14) {
tmp = x + (((z - t) * y) / (a - t));
} else if (t <= 5e+66) {
tmp = x + (((y - x) * z) / (a - t));
} 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 = y - (((y - x) / t) * (z - a))
if (t <= (-9.5d+121)) then
tmp = t_1
else if (t <= (-8.5d-14)) then
tmp = x + (((z - t) * y) / (a - t))
else if (t <= 5d+66) then
tmp = x + (((y - x) * z) / (a - t))
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 = y - (((y - x) / t) * (z - a));
double tmp;
if (t <= -9.5e+121) {
tmp = t_1;
} else if (t <= -8.5e-14) {
tmp = x + (((z - t) * y) / (a - t));
} else if (t <= 5e+66) {
tmp = x + (((y - x) * z) / (a - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y - (((y - x) / t) * (z - a)) tmp = 0 if t <= -9.5e+121: tmp = t_1 elif t <= -8.5e-14: tmp = x + (((z - t) * y) / (a - t)) elif t <= 5e+66: tmp = x + (((y - x) * z) / (a - t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y - Float64(Float64(Float64(y - x) / t) * Float64(z - a))) tmp = 0.0 if (t <= -9.5e+121) tmp = t_1; elseif (t <= -8.5e-14) tmp = Float64(x + Float64(Float64(Float64(z - t) * y) / Float64(a - t))); elseif (t <= 5e+66) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / Float64(a - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y - (((y - x) / t) * (z - a)); tmp = 0.0; if (t <= -9.5e+121) tmp = t_1; elseif (t <= -8.5e-14) tmp = x + (((z - t) * y) / (a - t)); elseif (t <= 5e+66) tmp = x + (((y - x) * z) / (a - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y - N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9.5e+121], t$95$1, If[LessEqual[t, -8.5e-14], N[(x + N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5e+66], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - \frac{y - x}{t} \cdot \left(z - a\right)\\
\mathbf{if}\;t \leq -9.5 \cdot 10^{+121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -8.5 \cdot 10^{-14}:\\
\;\;\;\;x + \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+66}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.49999999999999949e121 or 4.99999999999999991e66 < t Initial program 38.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6463.3
Applied rewrites63.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6463.3
Applied rewrites63.3%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6481.9
Applied rewrites81.9%
if -9.49999999999999949e121 < t < -8.50000000000000038e-14Initial program 88.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6477.4
Applied rewrites77.4%
if -8.50000000000000038e-14 < t < 4.99999999999999991e66Initial program 90.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.8
Applied rewrites82.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.1e+49) (not (<= t 5e+66))) (- y (* (/ (- y x) t) (- z a))) (+ x (/ (* (- y x) z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.1e+49) || !(t <= 5e+66)) {
tmp = y - (((y - x) / t) * (z - a));
} else {
tmp = x + (((y - x) * z) / (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 ((t <= (-4.1d+49)) .or. (.not. (t <= 5d+66))) then
tmp = y - (((y - x) / t) * (z - a))
else
tmp = x + (((y - x) * z) / (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 ((t <= -4.1e+49) || !(t <= 5e+66)) {
tmp = y - (((y - x) / t) * (z - a));
} else {
tmp = x + (((y - x) * z) / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.1e+49) or not (t <= 5e+66): tmp = y - (((y - x) / t) * (z - a)) else: tmp = x + (((y - x) * z) / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.1e+49) || !(t <= 5e+66)) tmp = Float64(y - Float64(Float64(Float64(y - x) / t) * Float64(z - a))); else tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.1e+49) || ~((t <= 5e+66))) tmp = y - (((y - x) / t) * (z - a)); else tmp = x + (((y - x) * z) / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.1e+49], N[Not[LessEqual[t, 5e+66]], $MachinePrecision]], N[(y - N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{+49} \lor \neg \left(t \leq 5 \cdot 10^{+66}\right):\\
\;\;\;\;y - \frac{y - x}{t} \cdot \left(z - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{a - t}\\
\end{array}
\end{array}
if t < -4.1e49 or 4.99999999999999991e66 < t Initial program 46.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6467.9
Applied rewrites67.9%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6480.0
Applied rewrites80.0%
if -4.1e49 < t < 4.99999999999999991e66Initial program 89.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6480.1
Applied rewrites80.1%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2e-29) (not (<= a 2.9e-51))) (fma (- z t) (/ (- y x) a) x) (- y (* (/ (- y x) t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2e-29) || !(a <= 2.9e-51)) {
tmp = fma((z - t), ((y - x) / a), x);
} else {
tmp = y - (((y - x) / t) * (z - a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2e-29) || !(a <= 2.9e-51)) tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); else tmp = Float64(y - Float64(Float64(Float64(y - x) / t) * Float64(z - a))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2e-29], N[Not[LessEqual[a, 2.9e-51]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{-29} \lor \neg \left(a \leq 2.9 \cdot 10^{-51}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{y - x}{t} \cdot \left(z - a\right)\\
\end{array}
\end{array}
if a < -1.99999999999999989e-29 or 2.89999999999999973e-51 < a Initial program 75.5%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
if -1.99999999999999989e-29 < a < 2.89999999999999973e-51Initial program 71.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6478.7
Applied rewrites78.7%
Final simplification78.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma 1.0 (- y x) x)))
(if (<= t -3.6e+102)
t_1
(if (<= t -1.05e-254)
(fma (/ y a) z x)
(if (<= t 9.2e+142) (fma (- x) (/ z a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(1.0, (y - x), x);
double tmp;
if (t <= -3.6e+102) {
tmp = t_1;
} else if (t <= -1.05e-254) {
tmp = fma((y / a), z, x);
} else if (t <= 9.2e+142) {
tmp = fma(-x, (z / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(1.0, Float64(y - x), x) tmp = 0.0 if (t <= -3.6e+102) tmp = t_1; elseif (t <= -1.05e-254) tmp = fma(Float64(y / a), z, x); elseif (t <= 9.2e+142) tmp = fma(Float64(-x), Float64(z / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -3.6e+102], t$95$1, If[LessEqual[t, -1.05e-254], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[t, 9.2e+142], N[((-x) * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{if}\;t \leq -3.6 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.05 \cdot 10^{-254}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.6000000000000002e102 or 9.20000000000000009e142 < t Initial program 42.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6466.7
Applied rewrites66.7%
Taylor expanded in t around inf
Applied rewrites38.2%
if -3.6000000000000002e102 < t < -1.04999999999999998e-254Initial program 94.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6472.7
Applied rewrites72.7%
Taylor expanded in x around 0
Applied rewrites64.5%
if -1.04999999999999998e-254 < t < 9.20000000000000009e142Initial program 81.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6464.6
Applied rewrites64.6%
Taylor expanded in y around 0
Applied rewrites52.9%
Final simplification51.9%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2e-29)
(fma (- z t) (/ (- y x) a) x)
(if (<= a 4.8e-42)
(- y (* (/ (- y x) t) (- z a)))
(+ x (* (/ (- z t) a) (- y x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2e-29) {
tmp = fma((z - t), ((y - x) / a), x);
} else if (a <= 4.8e-42) {
tmp = y - (((y - x) / t) * (z - a));
} else {
tmp = x + (((z - t) / a) * (y - x));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2e-29) tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); elseif (a <= 4.8e-42) tmp = Float64(y - Float64(Float64(Float64(y - x) / t) * Float64(z - a))); else tmp = Float64(x + Float64(Float64(Float64(z - t) / a) * Float64(y - x))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2e-29], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 4.8e-42], N[(y - N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{-42}:\\
\;\;\;\;y - \frac{y - x}{t} \cdot \left(z - a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{a} \cdot \left(y - x\right)\\
\end{array}
\end{array}
if a < -1.99999999999999989e-29Initial program 80.1%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.6
Applied rewrites80.6%
if -1.99999999999999989e-29 < a < 4.80000000000000005e-42Initial program 71.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6478.7
Applied rewrites78.7%
if 4.80000000000000005e-42 < a Initial program 71.4%
Taylor expanded in a around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6478.1
Applied rewrites78.1%
Final simplification79.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.5e-42) (not (<= a 1.15e-52))) (fma (- z t) (/ (- y x) a) x) (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.5e-42) || !(a <= 1.15e-52)) {
tmp = fma((z - t), ((y - x) / a), x);
} else {
tmp = y * ((z - t) / (a - t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.5e-42) || !(a <= 1.15e-52)) tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); else tmp = Float64(y * Float64(Float64(z - t) / Float64(a - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.5e-42], N[Not[LessEqual[a, 1.15e-52]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.5 \cdot 10^{-42} \lor \neg \left(a \leq 1.15 \cdot 10^{-52}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t}\\
\end{array}
\end{array}
if a < -2.50000000000000001e-42 or 1.14999999999999997e-52 < a Initial program 75.7%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.8
Applied rewrites77.8%
if -2.50000000000000001e-42 < a < 1.14999999999999997e-52Initial program 70.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6477.2
Applied rewrites77.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6460.4
Applied rewrites60.4%
Applied rewrites67.0%
Final simplification73.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma t (/ x a) x)))
(if (<= a -4.1e+15)
t_1
(if (<= a 3.7e-202) (* x (/ z t)) (if (<= a 3.2e-5) (/ (* y z) a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, (x / a), x);
double tmp;
if (a <= -4.1e+15) {
tmp = t_1;
} else if (a <= 3.7e-202) {
tmp = x * (z / t);
} else if (a <= 3.2e-5) {
tmp = (y * z) / a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(x / a), x) tmp = 0.0 if (a <= -4.1e+15) tmp = t_1; elseif (a <= 3.7e-202) tmp = Float64(x * Float64(z / t)); elseif (a <= 3.2e-5) tmp = Float64(Float64(y * z) / a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(x / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -4.1e+15], t$95$1, If[LessEqual[a, 3.7e-202], N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.2e-5], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, \frac{x}{a}, x\right)\\
\mathbf{if}\;a \leq -4.1 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{-202}:\\
\;\;\;\;x \cdot \frac{z}{t}\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.1e15 or 3.19999999999999986e-5 < a Initial program 73.1%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6454.4
Applied rewrites54.4%
Taylor expanded in z around 0
Applied rewrites44.7%
Taylor expanded in t around 0
Applied rewrites44.5%
if -4.1e15 < a < 3.69999999999999991e-202Initial program 72.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6427.5
Applied rewrites27.5%
Taylor expanded in z around inf
Applied rewrites33.3%
Taylor expanded in t around inf
Applied rewrites29.1%
if 3.69999999999999991e-202 < a < 3.19999999999999986e-5Initial program 81.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6443.6
Applied rewrites43.6%
Taylor expanded in x around 0
Applied rewrites34.0%
Final simplification37.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.5e+45) (not (<= t 8.8e+30))) (* y (/ (- z t) (- a t))) (fma (/ z a) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.5e+45) || !(t <= 8.8e+30)) {
tmp = y * ((z - t) / (a - t));
} else {
tmp = fma((z / a), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.5e+45) || !(t <= 8.8e+30)) tmp = Float64(y * Float64(Float64(z - t) / Float64(a - t))); else tmp = fma(Float64(z / a), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.5e+45], N[Not[LessEqual[t, 8.8e+30]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{+45} \lor \neg \left(t \leq 8.8 \cdot 10^{+30}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\end{array}
\end{array}
if t < -5.5000000000000001e45 or 8.7999999999999999e30 < t Initial program 50.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6470.7
Applied rewrites70.7%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6447.3
Applied rewrites47.3%
Applied rewrites65.1%
if -5.5000000000000001e45 < t < 8.7999999999999999e30Initial program 90.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6494.6
Applied rewrites94.6%
Taylor expanded in t around 0
lower-/.f6476.3
Applied rewrites76.3%
Final simplification71.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma 1.0 (- y x) x)))
(if (<= t -0.23)
t_1
(if (<= t 2.9e-126)
(* y (/ z a))
(if (<= t 1.65e+176) (* x (/ z t)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(1.0, (y - x), x);
double tmp;
if (t <= -0.23) {
tmp = t_1;
} else if (t <= 2.9e-126) {
tmp = y * (z / a);
} else if (t <= 1.65e+176) {
tmp = x * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(1.0, Float64(y - x), x) tmp = 0.0 if (t <= -0.23) tmp = t_1; elseif (t <= 2.9e-126) tmp = Float64(y * Float64(z / a)); elseif (t <= 1.65e+176) tmp = Float64(x * Float64(z / t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -0.23], t$95$1, If[LessEqual[t, 2.9e-126], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.65e+176], N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{if}\;t \leq -0.23:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-126}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+176}:\\
\;\;\;\;x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -0.23000000000000001 or 1.65000000000000012e176 < t Initial program 51.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.9
Applied rewrites71.9%
Taylor expanded in t around inf
Applied rewrites36.3%
if -0.23000000000000001 < t < 2.89999999999999988e-126Initial program 93.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6495.6
Applied rewrites95.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6442.9
Applied rewrites42.9%
Taylor expanded in t around 0
Applied rewrites35.2%
if 2.89999999999999988e-126 < t < 1.65000000000000012e176Initial program 71.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in z around inf
Applied rewrites30.6%
Taylor expanded in t around inf
Applied rewrites24.3%
Final simplification32.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma 1.0 (- y x) x)))
(if (<= t -0.23)
t_1
(if (<= t 2.9e-126)
(/ (* y z) a)
(if (<= t 1.65e+176) (* x (/ z t)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(1.0, (y - x), x);
double tmp;
if (t <= -0.23) {
tmp = t_1;
} else if (t <= 2.9e-126) {
tmp = (y * z) / a;
} else if (t <= 1.65e+176) {
tmp = x * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(1.0, Float64(y - x), x) tmp = 0.0 if (t <= -0.23) tmp = t_1; elseif (t <= 2.9e-126) tmp = Float64(Float64(y * z) / a); elseif (t <= 1.65e+176) tmp = Float64(x * Float64(z / t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -0.23], t$95$1, If[LessEqual[t, 2.9e-126], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t, 1.65e+176], N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{if}\;t \leq -0.23:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-126}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+176}:\\
\;\;\;\;x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -0.23000000000000001 or 1.65000000000000012e176 < t Initial program 51.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.9
Applied rewrites71.9%
Taylor expanded in t around inf
Applied rewrites36.3%
if -0.23000000000000001 < t < 2.89999999999999988e-126Initial program 93.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6481.3
Applied rewrites81.3%
Taylor expanded in x around 0
Applied rewrites31.3%
if 2.89999999999999988e-126 < t < 1.65000000000000012e176Initial program 71.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in z around inf
Applied rewrites30.6%
Taylor expanded in t around inf
Applied rewrites24.3%
Final simplification30.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.3e+49) (not (<= t 5.2e+66))) (* (- y) (/ (- z t) t)) (fma (/ z a) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.3e+49) || !(t <= 5.2e+66)) {
tmp = -y * ((z - t) / t);
} else {
tmp = fma((z / a), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.3e+49) || !(t <= 5.2e+66)) tmp = Float64(Float64(-y) * Float64(Float64(z - t) / t)); else tmp = fma(Float64(z / a), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.3e+49], N[Not[LessEqual[t, 5.2e+66]], $MachinePrecision]], N[((-y) * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{+49} \lor \neg \left(t \leq 5.2 \cdot 10^{+66}\right):\\
\;\;\;\;\left(-y\right) \cdot \frac{z - t}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\end{array}
\end{array}
if t < -4.2999999999999999e49 or 5.20000000000000024e66 < t Initial program 46.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6445.2
Applied rewrites45.2%
Taylor expanded in a around 0
Applied rewrites55.8%
if -4.2999999999999999e49 < t < 5.20000000000000024e66Initial program 89.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6494.4
Applied rewrites94.4%
Taylor expanded in t around 0
lower-/.f6473.9
Applied rewrites73.9%
Final simplification67.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.9e+49) (not (<= t 3.1e+141))) (* (- t) (/ y (- a t))) (fma (/ z a) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.9e+49) || !(t <= 3.1e+141)) {
tmp = -t * (y / (a - t));
} else {
tmp = fma((z / a), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.9e+49) || !(t <= 3.1e+141)) tmp = Float64(Float64(-t) * Float64(y / Float64(a - t))); else tmp = fma(Float64(z / a), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.9e+49], N[Not[LessEqual[t, 3.1e+141]], $MachinePrecision]], N[((-t) * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{+49} \lor \neg \left(t \leq 3.1 \cdot 10^{+141}\right):\\
\;\;\;\;\left(-t\right) \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\end{array}
\end{array}
if t < -2.9e49 or 3.10000000000000004e141 < t Initial program 47.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6470.3
Applied rewrites70.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6446.7
Applied rewrites46.7%
Taylor expanded in z around 0
Applied rewrites43.4%
if -2.9e49 < t < 3.10000000000000004e141Initial program 86.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.4
Applied rewrites91.4%
Taylor expanded in t around 0
lower-/.f6471.3
Applied rewrites71.3%
Final simplification62.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -4.2e-175) (not (<= a 6.1e-93))) (fma (/ z a) (- y x) x) (* (- z) (/ (- y x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.2e-175) || !(a <= 6.1e-93)) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = -z * ((y - x) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -4.2e-175) || !(a <= 6.1e-93)) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = Float64(Float64(-z) * Float64(Float64(y - x) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -4.2e-175], N[Not[LessEqual[a, 6.1e-93]], $MachinePrecision]], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.2 \cdot 10^{-175} \lor \neg \left(a \leq 6.1 \cdot 10^{-93}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if a < -4.2e-175 or 6.09999999999999971e-93 < a Initial program 77.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
Taylor expanded in t around 0
lower-/.f6465.9
Applied rewrites65.9%
if -4.2e-175 < a < 6.09999999999999971e-93Initial program 66.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.5
Applied rewrites74.5%
Taylor expanded in z around inf
div-subN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6458.1
Applied rewrites58.1%
Taylor expanded in t around inf
Applied rewrites53.9%
Final simplification62.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -5.5e+45) (* (- z t) (/ y (- a t))) (if (<= t 5.2e+66) (fma (/ z a) (- y x) x) (* (- y) (/ (- z t) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.5e+45) {
tmp = (z - t) * (y / (a - t));
} else if (t <= 5.2e+66) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = -y * ((z - t) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.5e+45) tmp = Float64(Float64(z - t) * Float64(y / Float64(a - t))); elseif (t <= 5.2e+66) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = Float64(Float64(-y) * Float64(Float64(z - t) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.5e+45], N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.2e+66], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[((-y) * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{+45}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a - t}\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z - t}{t}\\
\end{array}
\end{array}
if t < -5.5000000000000001e45Initial program 57.6%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6463.1
Applied rewrites63.1%
if -5.5000000000000001e45 < t < 5.20000000000000024e66Initial program 89.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6494.3
Applied rewrites94.3%
Taylor expanded in t around 0
lower-/.f6474.3
Applied rewrites74.3%
if 5.20000000000000024e66 < t Initial program 34.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6459.8
Applied rewrites59.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.3
Applied rewrites39.3%
Taylor expanded in a around 0
Applied rewrites49.8%
Final simplification67.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.05e+134) (not (<= t 9.5e+142))) (fma 1.0 (- y x) x) (fma (/ z a) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.05e+134) || !(t <= 9.5e+142)) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = fma((z / a), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.05e+134) || !(t <= 9.5e+142)) tmp = fma(1.0, Float64(y - x), x); else tmp = fma(Float64(z / a), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.05e+134], N[Not[LessEqual[t, 9.5e+142]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.05 \cdot 10^{+134} \lor \neg \left(t \leq 9.5 \cdot 10^{+142}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\end{array}
\end{array}
if t < -3.04999999999999989e134 or 9.50000000000000001e142 < t Initial program 36.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6462.5
Applied rewrites62.5%
Taylor expanded in t around inf
Applied rewrites40.0%
if -3.04999999999999989e134 < t < 9.50000000000000001e142Initial program 85.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.4
Applied rewrites91.4%
Taylor expanded in t around 0
lower-/.f6466.5
Applied rewrites66.5%
Final simplification60.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.05e+134) (not (<= t 9.5e+142))) (fma 1.0 (- y x) x) (fma (/ (- y x) a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.05e+134) || !(t <= 9.5e+142)) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = fma(((y - x) / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.05e+134) || !(t <= 9.5e+142)) tmp = fma(1.0, Float64(y - x), x); else tmp = fma(Float64(Float64(y - x) / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.05e+134], N[Not[LessEqual[t, 9.5e+142]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.05 \cdot 10^{+134} \lor \neg \left(t \leq 9.5 \cdot 10^{+142}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -3.04999999999999989e134 or 9.50000000000000001e142 < t Initial program 36.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6462.5
Applied rewrites62.5%
Taylor expanded in t around inf
Applied rewrites40.0%
if -3.04999999999999989e134 < t < 9.50000000000000001e142Initial program 85.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6465.2
Applied rewrites65.2%
Final simplification59.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.6e+102) (not (<= t 9.5e+142))) (fma 1.0 (- y x) x) (fma (/ y a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.6e+102) || !(t <= 9.5e+142)) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = fma((y / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.6e+102) || !(t <= 9.5e+142)) tmp = fma(1.0, Float64(y - x), x); else tmp = fma(Float64(y / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.6e+102], N[Not[LessEqual[t, 9.5e+142]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+102} \lor \neg \left(t \leq 9.5 \cdot 10^{+142}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -3.6000000000000002e102 or 9.50000000000000001e142 < t Initial program 42.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6466.7
Applied rewrites66.7%
Taylor expanded in t around inf
Applied rewrites38.2%
if -3.6000000000000002e102 < t < 9.50000000000000001e142Initial program 86.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6467.7
Applied rewrites67.7%
Taylor expanded in x around 0
Applied rewrites54.5%
Final simplification49.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.8e-12) (not (<= z 2.5e-65))) (* x (/ z t)) (fma 1.0 (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.8e-12) || !(z <= 2.5e-65)) {
tmp = x * (z / t);
} else {
tmp = fma(1.0, (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.8e-12) || !(z <= 2.5e-65)) tmp = Float64(x * Float64(z / t)); else tmp = fma(1.0, Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.8e-12], N[Not[LessEqual[z, 2.5e-65]], $MachinePrecision]], N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-12} \lor \neg \left(z \leq 2.5 \cdot 10^{-65}\right):\\
\;\;\;\;x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\end{array}
\end{array}
if z < -3.79999999999999996e-12 or 2.49999999999999991e-65 < z Initial program 75.1%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6445.2
Applied rewrites45.2%
Taylor expanded in z around inf
Applied rewrites36.7%
Taylor expanded in t around inf
Applied rewrites27.1%
if -3.79999999999999996e-12 < z < 2.49999999999999991e-65Initial program 72.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.0
Applied rewrites80.0%
Taylor expanded in t around inf
Applied rewrites27.3%
Final simplification27.2%
(FPCore (x y z t a) :precision binary64 (fma 1.0 (- y x) x))
double code(double x, double y, double z, double t, double a) {
return fma(1.0, (y - x), x);
}
function code(x, y, z, t, a) return fma(1.0, Float64(y - x), x) end
code[x_, y_, z_, t_, a_] := N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1, y - x, x\right)
\end{array}
Initial program 73.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.7
Applied rewrites84.7%
Taylor expanded in t around inf
Applied rewrites16.6%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 73.7%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6439.9
Applied rewrites39.9%
Taylor expanded in t around inf
Applied rewrites2.9%
Taylor expanded in x around 0
Applied rewrites2.9%
Final simplification2.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); 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 - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024364
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))