
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z y) (- z a))) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e-86)
(fma (* (/ 1.0 (- z a)) (- z y)) (- t x) x)
(if (<= t_2 1e-7)
(fma
x
(- (fma -1.0 t_1 (/ z (- z a))) (/ a (- z a)))
(/ (* t (- z y)) (- z a)))
(+ x (* t_1 (- t x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - y) / (z - a);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e-86) {
tmp = fma(((1.0 / (z - a)) * (z - y)), (t - x), x);
} else if (t_2 <= 1e-7) {
tmp = fma(x, (fma(-1.0, t_1, (z / (z - a))) - (a / (z - a))), ((t * (z - y)) / (z - a)));
} else {
tmp = x + (t_1 * (t - x));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - y) / Float64(z - a)) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e-86) tmp = fma(Float64(Float64(1.0 / Float64(z - a)) * Float64(z - y)), Float64(t - x), x); elseif (t_2 <= 1e-7) tmp = fma(x, Float64(fma(-1.0, t_1, Float64(z / Float64(z - a))) - Float64(a / Float64(z - a))), Float64(Float64(t * Float64(z - y)) / Float64(z - a))); else tmp = Float64(x + Float64(t_1 * Float64(t - x))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-86], N[(N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1e-7], N[(x * N[(N[(-1.0 * t$95$1 + N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - y}{z - a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-86}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{z - a} \cdot \left(z - y\right), t - x, x\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(-1, t\_1, \frac{z}{z - a}\right) - \frac{a}{z - a}, \frac{t \cdot \left(z - y\right)}{z - a}\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1 \cdot \left(t - x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.9999999999999999e-86Initial program 80.1%
Applied rewrites84.2%
Applied rewrites84.1%
if -4.9999999999999999e-86 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 9.9999999999999995e-8Initial program 80.1%
Applied rewrites63.4%
Taylor expanded in x around 0
Applied rewrites78.9%
if 9.9999999999999995e-8 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Applied rewrites84.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -4e-254)
(fma (* (/ 1.0 (- z a)) (- z y)) (- t x) x)
(if (<= t_1 0.0)
(+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
(+ x (* (/ (- z y) (- z a)) (- t x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -4e-254) {
tmp = fma(((1.0 / (z - a)) * (z - y)), (t - x), x);
} else if (t_1 <= 0.0) {
tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
} else {
tmp = x + (((z - y) / (z - a)) * (t - x));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= -4e-254) tmp = fma(Float64(Float64(1.0 / Float64(z - a)) * Float64(z - y)), Float64(t - x), x); elseif (t_1 <= 0.0) tmp = Float64(t + Float64(-1.0 * Float64(Float64(Float64(y * Float64(t - x)) - Float64(a * Float64(t - x))) / z))); else tmp = Float64(x + Float64(Float64(Float64(z - y) / Float64(z - a)) * Float64(t - x))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-254], N[(N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(t + N[(-1.0 * N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-254}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{z - a} \cdot \left(z - y\right), t - x, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - y}{z - a} \cdot \left(t - x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -3.9999999999999996e-254Initial program 80.1%
Applied rewrites84.2%
Applied rewrites84.1%
if -3.9999999999999996e-254 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.1%
Taylor expanded in z around -inf
Applied rewrites45.8%
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Applied rewrites84.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -4e-254)
(fma (* (/ 1.0 (- z a)) (- z y)) (- t x) x)
(if (<= t_1 0.0)
(* t (- (/ y (- a z)) (/ z (- a z))))
(+ x (* (/ (- z y) (- z a)) (- t x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -4e-254) {
tmp = fma(((1.0 / (z - a)) * (z - y)), (t - x), x);
} else if (t_1 <= 0.0) {
tmp = t * ((y / (a - z)) - (z / (a - z)));
} else {
tmp = x + (((z - y) / (z - a)) * (t - x));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= -4e-254) tmp = fma(Float64(Float64(1.0 / Float64(z - a)) * Float64(z - y)), Float64(t - x), x); elseif (t_1 <= 0.0) tmp = Float64(t * Float64(Float64(y / Float64(a - z)) - Float64(z / Float64(a - z)))); else tmp = Float64(x + Float64(Float64(Float64(z - y) / Float64(z - a)) * Float64(t - x))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-254], N[(N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(t * N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-254}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{z - a} \cdot \left(z - y\right), t - x, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - y}{z - a} \cdot \left(t - x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -3.9999999999999996e-254Initial program 80.1%
Applied rewrites84.2%
Applied rewrites84.1%
if -3.9999999999999996e-254 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.1%
Taylor expanded in t around inf
Applied rewrites50.8%
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Applied rewrites84.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z y) (- z a))) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -4e-254)
(fma t_1 (- t x) x)
(if (<= t_2 0.0)
(* t (- (/ y (- a z)) (/ z (- a z))))
(+ x (* t_1 (- t x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - y) / (z - a);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -4e-254) {
tmp = fma(t_1, (t - x), x);
} else if (t_2 <= 0.0) {
tmp = t * ((y / (a - z)) - (z / (a - z)));
} else {
tmp = x + (t_1 * (t - x));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - y) / Float64(z - a)) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -4e-254) tmp = fma(t_1, Float64(t - x), x); elseif (t_2 <= 0.0) tmp = Float64(t * Float64(Float64(y / Float64(a - z)) - Float64(z / Float64(a - z)))); else tmp = Float64(x + Float64(t_1 * Float64(t - x))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-254], N[(t$95$1 * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t * N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - y}{z - a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{-254}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t - x, x\right)\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1 \cdot \left(t - x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -3.9999999999999996e-254Initial program 80.1%
Applied rewrites84.2%
if -3.9999999999999996e-254 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.1%
Taylor expanded in t around inf
Applied rewrites50.8%
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Applied rewrites84.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z y) (- z a))) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e-289)
(fma t_1 (- t x) x)
(if (<= t_2 0.0) (/ (* -1.0 (* a x)) (- z a)) (+ x (* t_1 (- t x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - y) / (z - a);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e-289) {
tmp = fma(t_1, (t - x), x);
} else if (t_2 <= 0.0) {
tmp = (-1.0 * (a * x)) / (z - a);
} else {
tmp = x + (t_1 * (t - x));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - y) / Float64(z - a)) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e-289) tmp = fma(t_1, Float64(t - x), x); elseif (t_2 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(a * x)) / Float64(z - a)); else tmp = Float64(x + Float64(t_1 * Float64(t - x))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-289], N[(t$95$1 * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(-1.0 * N[(a * x), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - y}{z - a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-289}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t - x, x\right)\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{-1 \cdot \left(a \cdot x\right)}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + t\_1 \cdot \left(t - x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.00000000000000029e-289Initial program 80.1%
Applied rewrites84.2%
if -5.00000000000000029e-289 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.1%
Applied rewrites63.4%
Taylor expanded in a around inf
Applied rewrites21.3%
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Applied rewrites84.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) (- z a)) (- t x) x))
(t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e-289)
t_1
(if (<= t_2 0.0) (/ (* -1.0 (* a x)) (- z a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / (z - a)), (t - x), x);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e-289) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (-1.0 * (a * x)) / (z - a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e-289) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(a * x)) / Float64(z - a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-289], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(-1.0 * N[(a * x), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-289}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{-1 \cdot \left(a \cdot x\right)}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.00000000000000029e-289 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Applied rewrites84.2%
if -5.00000000000000029e-289 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.1%
Applied rewrites63.4%
Taylor expanded in a around inf
Applied rewrites21.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t x) (- z a)) (- z y) x))
(t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -1e-146)
t_1
(if (<= t_2 4e-274) (/ (* t (- y z)) (- a z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - x) / (z - a)), (z - y), x);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -1e-146) {
tmp = t_1;
} else if (t_2 <= 4e-274) {
tmp = (t * (y - z)) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - x) / Float64(z - a)), Float64(z - y), x) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -1e-146) tmp = t_1; elseif (t_2 <= 4e-274) tmp = Float64(Float64(t * Float64(y - z)) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - x), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-146], t$95$1, If[LessEqual[t$95$2, 4e-274], N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - x}{z - a}, z - y, x\right)\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-146}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-274}:\\
\;\;\;\;\frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.00000000000000003e-146 or 3.99999999999999986e-274 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Applied rewrites80.2%
if -1.00000000000000003e-146 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 3.99999999999999986e-274Initial program 80.1%
Taylor expanded in x around 0
Applied rewrites39.0%
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.7e+114)
(* (/ y (- z a)) (- x t))
(if (<= y 5.4e+46)
(fma (/ (- z y) (- z a)) t x)
(* (- t x) (* (/ 1.0 (- z a)) (- y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.7e+114) {
tmp = (y / (z - a)) * (x - t);
} else if (y <= 5.4e+46) {
tmp = fma(((z - y) / (z - a)), t, x);
} else {
tmp = (t - x) * ((1.0 / (z - a)) * -y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.7e+114) tmp = Float64(Float64(y / Float64(z - a)) * Float64(x - t)); elseif (y <= 5.4e+46) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), t, x); else tmp = Float64(Float64(t - x) * Float64(Float64(1.0 / Float64(z - a)) * Float64(-y))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.7e+114], N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e+46], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+114}:\\
\;\;\;\;\frac{y}{z - a} \cdot \left(x - t\right)\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot \left(\frac{1}{z - a} \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if y < -1.7e114Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites44.0%
if -1.7e114 < y < 5.4000000000000003e46Initial program 80.1%
Applied rewrites84.2%
Taylor expanded in x around 0
Applied rewrites67.0%
if 5.4000000000000003e46 < y Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites38.4%
Applied rewrites44.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y (- z a)) (- x t))))
(if (<= y -1.7e+114)
t_1
(if (<= y 5.4e+46) (fma (/ (- z y) (- z a)) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (z - a)) * (x - t);
double tmp;
if (y <= -1.7e+114) {
tmp = t_1;
} else if (y <= 5.4e+46) {
tmp = fma(((z - y) / (z - a)), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(z - a)) * Float64(x - t)) tmp = 0.0 if (y <= -1.7e+114) tmp = t_1; elseif (y <= 5.4e+46) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.7e+114], t$95$1, If[LessEqual[y, 5.4e+46], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot \left(x - t\right)\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.7e114 or 5.4000000000000003e46 < y Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites44.0%
if -1.7e114 < y < 5.4000000000000003e46Initial program 80.1%
Applied rewrites84.2%
Taylor expanded in x around 0
Applied rewrites67.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y (- z a)) (- x t))))
(if (<= y -1.7e+114)
t_1
(if (<= y 1.65e+45) (fma (/ t (- z a)) (- z y) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (z - a)) * (x - t);
double tmp;
if (y <= -1.7e+114) {
tmp = t_1;
} else if (y <= 1.65e+45) {
tmp = fma((t / (z - a)), (z - y), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(z - a)) * Float64(x - t)) tmp = 0.0 if (y <= -1.7e+114) tmp = t_1; elseif (y <= 1.65e+45) tmp = fma(Float64(t / Float64(z - a)), Float64(z - y), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.7e+114], t$95$1, If[LessEqual[y, 1.65e+45], N[(N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot \left(x - t\right)\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+45}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z - a}, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.7e114 or 1.65e45 < y Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites44.0%
if -1.7e114 < y < 1.65e45Initial program 80.1%
Applied rewrites80.2%
Taylor expanded in x around 0
Applied rewrites63.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.7e+154) (fma (/ y a) (- t x) x) (if (<= a 4.7e+17) (* (/ y (- z a)) (- x t)) (+ x (* (- y z) (/ t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.7e+154) {
tmp = fma((y / a), (t - x), x);
} else if (a <= 4.7e+17) {
tmp = (y / (z - a)) * (x - t);
} else {
tmp = x + ((y - z) * (t / a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.7e+154) tmp = fma(Float64(y / a), Float64(t - x), x); elseif (a <= 4.7e+17) tmp = Float64(Float64(y / Float64(z - a)) * Float64(x - t)); else tmp = Float64(x + Float64(Float64(y - z) * Float64(t / a))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.7e+154], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 4.7e+17], N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.7 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{elif}\;a \leq 4.7 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{z - a} \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a}\\
\end{array}
\end{array}
if a < -1.69999999999999987e154Initial program 80.1%
Applied rewrites84.2%
Taylor expanded in z around 0
Applied rewrites49.2%
if -1.69999999999999987e154 < a < 4.7e17Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites44.0%
if 4.7e17 < a Initial program 80.1%
Taylor expanded in z around 0
Applied rewrites51.9%
Taylor expanded in x around 0
Applied rewrites43.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y a) (- t x) x)))
(if (<= a -1.7e+154)
t_1
(if (<= a 1020000.0) (* (/ y (- z a)) (- x t)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), (t - x), x);
double tmp;
if (a <= -1.7e+154) {
tmp = t_1;
} else if (a <= 1020000.0) {
tmp = (y / (z - a)) * (x - t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), Float64(t - x), x) tmp = 0.0 if (a <= -1.7e+154) tmp = t_1; elseif (a <= 1020000.0) tmp = Float64(Float64(y / Float64(z - a)) * Float64(x - t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.7e+154], t$95$1, If[LessEqual[a, 1020000.0], N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{if}\;a \leq -1.7 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1020000:\\
\;\;\;\;\frac{y}{z - a} \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.69999999999999987e154 or 1.02e6 < a Initial program 80.1%
Applied rewrites84.2%
Taylor expanded in z around 0
Applied rewrites49.2%
if -1.69999999999999987e154 < a < 1.02e6Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites44.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y a) (- t x) x)))
(if (<= a -2e-92)
t_1
(if (<= a 8.5e-184)
(/ (* y (- x t)) z)
(if (<= a 1.05e-59) (/ (* t z) (- z a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), (t - x), x);
double tmp;
if (a <= -2e-92) {
tmp = t_1;
} else if (a <= 8.5e-184) {
tmp = (y * (x - t)) / z;
} else if (a <= 1.05e-59) {
tmp = (t * z) / (z - a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), Float64(t - x), x) tmp = 0.0 if (a <= -2e-92) tmp = t_1; elseif (a <= 8.5e-184) tmp = Float64(Float64(y * Float64(x - t)) / z); elseif (a <= 1.05e-59) tmp = Float64(Float64(t * z) / Float64(z - a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2e-92], t$95$1, If[LessEqual[a, 8.5e-184], N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[a, 1.05e-59], N[(N[(t * z), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{if}\;a \leq -2 \cdot 10^{-92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 8.5 \cdot 10^{-184}:\\
\;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-59}:\\
\;\;\;\;\frac{t \cdot z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.99999999999999998e-92 or 1.04999999999999998e-59 < a Initial program 80.1%
Applied rewrites84.2%
Taylor expanded in z around 0
Applied rewrites49.2%
if -1.99999999999999998e-92 < a < 8.50000000000000036e-184Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites38.4%
Taylor expanded in z around inf
Applied rewrites24.0%
if 8.50000000000000036e-184 < a < 1.04999999999999998e-59Initial program 80.1%
Applied rewrites63.4%
Taylor expanded in z around inf
Applied rewrites21.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 (- INFINITY))
(/ (* x y) (- z a))
(if (<= t_1 -5e-105)
(+ x t)
(if (<= t_1 2e-109)
(/ (* t z) (- z a))
(if (<= t_1 2e+307) (+ x t) (/ (* y (- x t)) z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * y) / (z - a);
} else if (t_1 <= -5e-105) {
tmp = x + t;
} else if (t_1 <= 2e-109) {
tmp = (t * z) / (z - a);
} else if (t_1 <= 2e+307) {
tmp = x + t;
} else {
tmp = (y * (x - t)) / z;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x * y) / (z - a);
} else if (t_1 <= -5e-105) {
tmp = x + t;
} else if (t_1 <= 2e-109) {
tmp = (t * z) / (z - a);
} else if (t_1 <= 2e+307) {
tmp = x + t;
} else {
tmp = (y * (x - t)) / z;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_1 <= -math.inf: tmp = (x * y) / (z - a) elif t_1 <= -5e-105: tmp = x + t elif t_1 <= 2e-109: tmp = (t * z) / (z - a) elif t_1 <= 2e+307: tmp = x + t else: tmp = (y * (x - t)) / z return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x * y) / Float64(z - a)); elseif (t_1 <= -5e-105) tmp = Float64(x + t); elseif (t_1 <= 2e-109) tmp = Float64(Float64(t * z) / Float64(z - a)); elseif (t_1 <= 2e+307) tmp = Float64(x + t); else tmp = Float64(Float64(y * Float64(x - t)) / z); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_1 <= -Inf) tmp = (x * y) / (z - a); elseif (t_1 <= -5e-105) tmp = x + t; elseif (t_1 <= 2e-109) tmp = (t * z) / (z - a); elseif (t_1 <= 2e+307) tmp = x + t; else tmp = (y * (x - t)) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-105], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 2e-109], N[(N[(t * z), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+307], N[(x + t), $MachinePrecision], N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{x \cdot y}{z - a}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-105}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-109}:\\
\;\;\;\;\frac{t \cdot z}{z - a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites38.4%
Taylor expanded in x around inf
Applied rewrites21.9%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999963e-105 or 2e-109 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.99999999999999997e307Initial program 80.1%
Taylor expanded in z around inf
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites34.1%
if -4.99999999999999963e-105 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2e-109Initial program 80.1%
Applied rewrites63.4%
Taylor expanded in z around inf
Applied rewrites21.0%
if 1.99999999999999997e307 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites38.4%
Taylor expanded in z around inf
Applied rewrites24.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 (- INFINITY))
(/ (* x y) (- z a))
(if (<= t_1 2e+307) (+ x t) (/ (* y (- x t)) z)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * y) / (z - a);
} else if (t_1 <= 2e+307) {
tmp = x + t;
} else {
tmp = (y * (x - t)) / z;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x * y) / (z - a);
} else if (t_1 <= 2e+307) {
tmp = x + t;
} else {
tmp = (y * (x - t)) / z;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_1 <= -math.inf: tmp = (x * y) / (z - a) elif t_1 <= 2e+307: tmp = x + t else: tmp = (y * (x - t)) / z return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x * y) / Float64(z - a)); elseif (t_1 <= 2e+307) tmp = Float64(x + t); else tmp = Float64(Float64(y * Float64(x - t)) / z); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_1 <= -Inf) tmp = (x * y) / (z - a); elseif (t_1 <= 2e+307) tmp = x + t; else tmp = (y * (x - t)) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+307], N[(x + t), $MachinePrecision], N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{x \cdot y}{z - a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites38.4%
Taylor expanded in x around inf
Applied rewrites21.9%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.99999999999999997e307Initial program 80.1%
Taylor expanded in z around inf
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites34.1%
if 1.99999999999999997e307 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites38.4%
Taylor expanded in z around inf
Applied rewrites24.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- x t)) z)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z)))))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 2e+307) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (x - t)) / z;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+307) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (x - t)) / z;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 2e+307) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (x - t)) / z t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 2e+307: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(x - t)) / z) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+307) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (x - t)) / z; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 2e+307) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+307], N[(x + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(x - t\right)}{z}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0 or 1.99999999999999997e307 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Applied rewrites38.4%
Taylor expanded in z around inf
Applied rewrites24.0%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.99999999999999997e307Initial program 80.1%
Taylor expanded in z around inf
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites34.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* t y) (- a z))) (t_2 (+ x (* (- y z) (/ (- t x) (- a z)))))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 INFINITY) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / (a - z);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= ((double) INFINITY)) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / (a - z);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / (a - z) t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= math.inf: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= Inf) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * y) / (a - z); t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= Inf) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, Infinity], N[(x + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot y}{a - z}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0 or +inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.1%
Taylor expanded in y around inf
Applied rewrites42.1%
Taylor expanded in x around 0
Applied rewrites21.2%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < +inf.0Initial program 80.1%
Taylor expanded in z around inf
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites34.1%
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
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, 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 + t
end function
public static double code(double x, double y, double z, double t, double a) {
return x + t;
}
def code(x, y, z, t, a): return x + t
function code(x, y, z, t, a) return Float64(x + t) end
function tmp = code(x, y, z, t, a) tmp = x + t; end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}
\\
x + t
\end{array}
Initial program 80.1%
Taylor expanded in z around inf
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites34.1%
herbie shell --seed 2025153
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))