
(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 17 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 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -1e-273)
(fma (- x t) (* (/ -1.0 (- a z)) (- z)) (fma (/ y (- z a)) (- x t) x))
(if (<= t_1 0.0)
(+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
(fma (/ (- z y) (- z a)) (- t x) 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 <= -1e-273) {
tmp = fma((x - t), ((-1.0 / (a - z)) * -z), fma((y / (z - a)), (x - t), x));
} else if (t_1 <= 0.0) {
tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
} else {
tmp = fma(((z - y) / (z - a)), (t - x), 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 <= -1e-273) tmp = fma(Float64(x - t), Float64(Float64(-1.0 / Float64(a - z)) * Float64(-z)), fma(Float64(y / Float64(z - a)), Float64(x - t), 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 = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), 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, -1e-273], N[(N[(x - t), $MachinePrecision] * N[(N[(-1.0 / N[(a - z), $MachinePrecision]), $MachinePrecision] * (-z)), $MachinePrecision] + N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision] + x), $MachinePrecision]), $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[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $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 -1 \cdot 10^{-273}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{-1}{a - z} \cdot \left(-z\right), \mathsf{fma}\left(\frac{y}{z - a}, x - t, x\right)\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}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1e-273Initial program 80.4%
Applied rewrites84.8%
if -1e-273 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6446.1
Applied rewrites46.1%
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -1e-273)
(fma (/ (- z) (- z a)) (- x t) (fma (/ y (- z a)) (- x t) x))
(if (<= t_1 0.0)
(+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
(fma (/ (- z y) (- z a)) (- t x) 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 <= -1e-273) {
tmp = fma((-z / (z - a)), (x - t), fma((y / (z - a)), (x - t), x));
} else if (t_1 <= 0.0) {
tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
} else {
tmp = fma(((z - y) / (z - a)), (t - x), 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 <= -1e-273) tmp = fma(Float64(Float64(-z) / Float64(z - a)), Float64(x - t), fma(Float64(y / Float64(z - a)), Float64(x - t), 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 = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), 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, -1e-273], N[(N[((-z) / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision] + N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision] + x), $MachinePrecision]), $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[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $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 -1 \cdot 10^{-273}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{z - a}, x - t, \mathsf{fma}\left(\frac{y}{z - a}, x - t, x\right)\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}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1e-273Initial program 80.4%
Applied rewrites84.9%
if -1e-273 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6446.1
Applied rewrites46.1%
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.8%
(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 -1e-273)
t_1
(if (<= t_2 0.0)
(+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
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 <= -1e-273) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
} 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 <= -1e-273) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(t + Float64(-1.0 * Float64(Float64(Float64(y * Float64(t - x)) - Float64(a * Float64(t - x))) / z))); 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, -1e-273], t$95$1, If[LessEqual[t$95$2, 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], 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 -1 \cdot 10^{-273}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1e-273 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.8%
if -1e-273 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6446.1
Applied rewrites46.1%
(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 -1e-295)
t_1
(if (<= t_2 0.0) (* (* -1.0 (/ (- a y) z)) x) 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 <= -1e-295) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (-1.0 * ((a - y) / z)) * x;
} 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 <= -1e-295) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(Float64(a - y) / z)) * x); 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, -1e-295], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(-1.0 * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * x), $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 -1 \cdot 10^{-295}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(-1 \cdot \frac{a - y}{z}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.00000000000000006e-295 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.8%
if -1.00000000000000006e-295 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f6425.0
Applied rewrites25.0%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
Applied rewrites25.0%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6423.2
Applied rewrites23.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x t) (- z a)) (- y z) x))
(t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -1e-273)
t_1
(if (<= t_2 0.0) (* (* -1.0 (/ (- a y) z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - t) / (z - a)), (y - z), x);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -1e-273) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (-1.0 * ((a - y) / z)) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -1e-273) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(Float64(a - y) / z)) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $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-273], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(-1.0 * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-273}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(-1 \cdot \frac{a - y}{z}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1e-273 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites80.5%
if -1e-273 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f6425.0
Applied rewrites25.0%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
Applied rewrites25.0%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6423.2
Applied rewrites23.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- x t)) (- z a)))
(t_2 (+ x (* (- y z) (/ (- t x) (- a z)))))
(t_3 (+ x (* (- y z) (/ t (- a z))))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-273)
t_3
(if (<= t_2 0.0)
(* (* -1.0 (/ (- a y) z)) x)
(if (<= t_2 2e+299) t_3 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (x - t)) / (z - a);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double t_3 = x + ((y - z) * (t / (a - z)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e-273) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = (-1.0 * ((a - y) / z)) * x;
} else if (t_2 <= 2e+299) {
tmp = t_3;
} 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 - a);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double t_3 = x + ((y - z) * (t / (a - z)));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -1e-273) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = (-1.0 * ((a - y) / z)) * x;
} else if (t_2 <= 2e+299) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (x - t)) / (z - a) t_2 = x + ((y - z) * ((t - x) / (a - z))) t_3 = x + ((y - z) * (t / (a - z))) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -1e-273: tmp = t_3 elif t_2 <= 0.0: tmp = (-1.0 * ((a - y) / z)) * x elif t_2 <= 2e+299: tmp = t_3 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(x - t)) / Float64(z - a)) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) t_3 = Float64(x + Float64(Float64(y - z) * Float64(t / Float64(a - z)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e-273) tmp = t_3; elseif (t_2 <= 0.0) tmp = Float64(Float64(-1.0 * Float64(Float64(a - y) / z)) * x); elseif (t_2 <= 2e+299) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (x - t)) / (z - a); t_2 = x + ((y - z) * ((t - x) / (a - z))); t_3 = x + ((y - z) * (t / (a - z))); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -1e-273) tmp = t_3; elseif (t_2 <= 0.0) tmp = (-1.0 * ((a - y) / z)) * x; elseif (t_2 <= 2e+299) tmp = t_3; 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] / 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]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e-273], t$95$3, If[LessEqual[t$95$2, 0.0], N[(N[(-1.0 * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$2, 2e+299], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(x - t\right)}{z - a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
t_3 := x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-273}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(-1 \cdot \frac{a - y}{z}\right) \cdot x\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+299}:\\
\;\;\;\;t\_3\\
\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 2.0000000000000001e299 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
Applied rewrites84.8%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6438.0
Applied rewrites38.0%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1e-273 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.0000000000000001e299Initial program 80.4%
Taylor expanded in x around 0
Applied rewrites64.0%
if -1e-273 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f6425.0
Applied rewrites25.0%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
Applied rewrites25.0%
Taylor expanded in z around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f6423.2
Applied rewrites23.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- z y) (- z a)) t)))
(if (<= z -1.7e+27)
t_1
(if (<= z 0.0138) (fma (/ (- x t) a) (- z y) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - y) / (z - a)) * t;
double tmp;
if (z <= -1.7e+27) {
tmp = t_1;
} else if (z <= 0.0138) {
tmp = fma(((x - t) / a), (z - y), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - y) / Float64(z - a)) * t) tmp = 0.0 if (z <= -1.7e+27) tmp = t_1; elseif (z <= 0.0138) tmp = fma(Float64(Float64(x - t) / 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[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -1.7e+27], t$95$1, If[LessEqual[z, 0.0138], N[(N[(N[(x - t), $MachinePrecision] / a), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - y}{z - a} \cdot t\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.0138:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{a}, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.7e27 or 0.0138 < z Initial program 80.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.8
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
if -1.7e27 < z < 0.0138Initial program 80.4%
Taylor expanded in z around 0
Applied rewrites51.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ t a) (- y z) x))) (if (<= a -3e+124) t_1 (if (<= a 7.2e+24) (* (/ (- z y) (- z a)) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / a), (y - z), x);
double tmp;
if (a <= -3e+124) {
tmp = t_1;
} else if (a <= 7.2e+24) {
tmp = ((z - y) / (z - a)) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / a), Float64(y - z), x) tmp = 0.0 if (a <= -3e+124) tmp = t_1; elseif (a <= 7.2e+24) tmp = Float64(Float64(Float64(z - y) / Float64(z - a)) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / a), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3e+124], t$95$1, If[LessEqual[a, 7.2e+24], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{a}, y - z, x\right)\\
\mathbf{if}\;a \leq -3 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{+24}:\\
\;\;\;\;\frac{z - y}{z - a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3e124 or 7.19999999999999966e24 < a Initial program 80.4%
Taylor expanded in z around 0
Applied rewrites51.8%
Taylor expanded in x around 0
Applied rewrites44.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6444.2
Applied rewrites44.2%
if -3e124 < a < 7.19999999999999966e24Initial program 80.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.8
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* -1.0 (* -1.0 t)))) (if (<= z -9e+27) t_1 (if (<= z 8.2e+73) (fma (/ t a) (- y z) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (-1.0 * t);
double tmp;
if (z <= -9e+27) {
tmp = t_1;
} else if (z <= 8.2e+73) {
tmp = fma((t / a), (y - z), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(-1.0 * t)) tmp = 0.0 if (z <= -9e+27) tmp = t_1; elseif (z <= 8.2e+73) tmp = fma(Float64(t / a), Float64(y - z), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e+27], t$95$1, If[LessEqual[z, 8.2e+73], N[(N[(t / a), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \left(-1 \cdot t\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+73}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.9999999999999998e27 or 8.1999999999999996e73 < z Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites71.9%
Taylor expanded in z around inf
lower-*.f6425.4
Applied rewrites25.4%
if -8.9999999999999998e27 < z < 8.1999999999999996e73Initial program 80.4%
Taylor expanded in z around 0
Applied rewrites51.8%
Taylor expanded in x around 0
Applied rewrites44.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6444.2
Applied rewrites44.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -1.0 (* -1.0 t))))
(if (<= z -5e+184)
t_1
(if (<= z -4.4e-24)
(+ x t)
(if (<= z 2.5e+71) (* (- 1.0 (/ y a)) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (-1.0 * t);
double tmp;
if (z <= -5e+184) {
tmp = t_1;
} else if (z <= -4.4e-24) {
tmp = x + t;
} else if (z <= 2.5e+71) {
tmp = (1.0 - (y / a)) * 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 = (-1.0d0) * ((-1.0d0) * t)
if (z <= (-5d+184)) then
tmp = t_1
else if (z <= (-4.4d-24)) then
tmp = x + t
else if (z <= 2.5d+71) then
tmp = (1.0d0 - (y / a)) * 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 = -1.0 * (-1.0 * t);
double tmp;
if (z <= -5e+184) {
tmp = t_1;
} else if (z <= -4.4e-24) {
tmp = x + t;
} else if (z <= 2.5e+71) {
tmp = (1.0 - (y / a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -1.0 * (-1.0 * t) tmp = 0 if z <= -5e+184: tmp = t_1 elif z <= -4.4e-24: tmp = x + t elif z <= 2.5e+71: tmp = (1.0 - (y / a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(-1.0 * t)) tmp = 0.0 if (z <= -5e+184) tmp = t_1; elseif (z <= -4.4e-24) tmp = Float64(x + t); elseif (z <= 2.5e+71) tmp = Float64(Float64(1.0 - Float64(y / a)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -1.0 * (-1.0 * t); tmp = 0.0; if (z <= -5e+184) tmp = t_1; elseif (z <= -4.4e-24) tmp = x + t; elseif (z <= 2.5e+71) tmp = (1.0 - (y / a)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+184], t$95$1, If[LessEqual[z, -4.4e-24], N[(x + t), $MachinePrecision], If[LessEqual[z, 2.5e+71], N[(N[(1.0 - N[(y / a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \left(-1 \cdot t\right)\\
\mathbf{if}\;z \leq -5 \cdot 10^{+184}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{-24}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+71}:\\
\;\;\;\;\left(1 - \frac{y}{a}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.9999999999999999e184 or 2.49999999999999986e71 < z Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites71.9%
Taylor expanded in z around inf
lower-*.f6425.4
Applied rewrites25.4%
if -4.9999999999999999e184 < z < -4.40000000000000003e-24Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -4.40000000000000003e-24 < z < 2.49999999999999986e71Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f6425.0
Applied rewrites25.0%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
Applied rewrites25.0%
Taylor expanded in z around 0
lower--.f64N/A
lower-/.f6436.2
Applied rewrites36.2%
(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)
(if (<= t_1 -1e-202)
(+ x t)
(if (<= t_1 1e-53)
(* -1.0 (* -1.0 t))
(if (<= t_1 400000000.0)
(/ (* t y) a)
(if (<= t_1 2e+299) (+ x t) (* t (/ y a)))))))))
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;
} else if (t_1 <= -1e-202) {
tmp = x + t;
} else if (t_1 <= 1e-53) {
tmp = -1.0 * (-1.0 * t);
} else if (t_1 <= 400000000.0) {
tmp = (t * y) / a;
} else if (t_1 <= 2e+299) {
tmp = x + t;
} else {
tmp = t * (y / a);
}
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;
} else if (t_1 <= -1e-202) {
tmp = x + t;
} else if (t_1 <= 1e-53) {
tmp = -1.0 * (-1.0 * t);
} else if (t_1 <= 400000000.0) {
tmp = (t * y) / a;
} else if (t_1 <= 2e+299) {
tmp = x + t;
} else {
tmp = t * (y / a);
}
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 elif t_1 <= -1e-202: tmp = x + t elif t_1 <= 1e-53: tmp = -1.0 * (-1.0 * t) elif t_1 <= 400000000.0: tmp = (t * y) / a elif t_1 <= 2e+299: tmp = x + t else: tmp = t * (y / a) 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) / z); elseif (t_1 <= -1e-202) tmp = Float64(x + t); elseif (t_1 <= 1e-53) tmp = Float64(-1.0 * Float64(-1.0 * t)); elseif (t_1 <= 400000000.0) tmp = Float64(Float64(t * y) / a); elseif (t_1 <= 2e+299) tmp = Float64(x + t); else tmp = Float64(t * Float64(y / a)); 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; elseif (t_1 <= -1e-202) tmp = x + t; elseif (t_1 <= 1e-53) tmp = -1.0 * (-1.0 * t); elseif (t_1 <= 400000000.0) tmp = (t * y) / a; elseif (t_1 <= 2e+299) tmp = x + t; else tmp = t * (y / a); 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] / z), $MachinePrecision], If[LessEqual[t$95$1, -1e-202], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 1e-53], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 400000000.0], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$1, 2e+299], N[(x + t), $MachinePrecision], N[(t * N[(y / a), $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 -\infty:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-202}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_1 \leq 10^{-53}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\
\mathbf{elif}\;t\_1 \leq 400000000:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+299}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6416.6
Applied rewrites16.6%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1e-202 or 4e8 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.0000000000000001e299Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -1e-202 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.00000000000000003e-53Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites71.9%
Taylor expanded in z around inf
lower-*.f6425.4
Applied rewrites25.4%
if 1.00000000000000003e-53 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4e8Initial program 80.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6416.6
Applied rewrites16.6%
if 2.0000000000000001e299 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
Taylor expanded in z around 0
lower-/.f6419.2
Applied rewrites19.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* t y) a)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 (- INFINITY))
(/ (* x y) z)
(if (<= t_2 -1e-202)
(+ x t)
(if (<= t_2 1e-53)
(* -1.0 (* -1.0 t))
(if (<= t_2 400000000.0) t_1 (if (<= t_2 2e+299) (+ x t) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (x * y) / z;
} else if (t_2 <= -1e-202) {
tmp = x + t;
} else if (t_2 <= 1e-53) {
tmp = -1.0 * (-1.0 * t);
} else if (t_2 <= 400000000.0) {
tmp = t_1;
} else if (t_2 <= 2e+299) {
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;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = (x * y) / z;
} else if (t_2 <= -1e-202) {
tmp = x + t;
} else if (t_2 <= 1e-53) {
tmp = -1.0 * (-1.0 * t);
} else if (t_2 <= 400000000.0) {
tmp = t_1;
} else if (t_2 <= 2e+299) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / a t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -math.inf: tmp = (x * y) / z elif t_2 <= -1e-202: tmp = x + t elif t_2 <= 1e-53: tmp = -1.0 * (-1.0 * t) elif t_2 <= 400000000.0: tmp = t_1 elif t_2 <= 2e+299: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / a) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(x * y) / z); elseif (t_2 <= -1e-202) tmp = Float64(x + t); elseif (t_2 <= 1e-53) tmp = Float64(-1.0 * Float64(-1.0 * t)); elseif (t_2 <= 400000000.0) tmp = t_1; elseif (t_2 <= 2e+299) 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; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -Inf) tmp = (x * y) / z; elseif (t_2 <= -1e-202) tmp = x + t; elseif (t_2 <= 1e-53) tmp = -1.0 * (-1.0 * t); elseif (t_2 <= 400000000.0) tmp = t_1; elseif (t_2 <= 2e+299) 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] / a), $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)], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$2, -1e-202], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, 1e-53], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 400000000.0], t$95$1, If[LessEqual[t$95$2, 2e+299], N[(x + t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot y}{a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-202}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq 10^{-53}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\
\mathbf{elif}\;t\_2 \leq 400000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+299}:\\
\;\;\;\;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.0Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6416.6
Applied rewrites16.6%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1e-202 or 4e8 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.0000000000000001e299Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -1e-202 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.00000000000000003e-53Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites71.9%
Taylor expanded in z around inf
lower-*.f6425.4
Applied rewrites25.4%
if 1.00000000000000003e-53 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4e8 or 2.0000000000000001e299 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6416.6
Applied rewrites16.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -1.0 (* -1.0 t))))
(if (<= z -5e+184)
t_1
(if (<= z -9e-32) (+ x t) (if (<= z 1.1e+68) (* y (/ t (- a z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (-1.0 * t);
double tmp;
if (z <= -5e+184) {
tmp = t_1;
} else if (z <= -9e-32) {
tmp = x + t;
} else if (z <= 1.1e+68) {
tmp = y * (t / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (-1.0d0) * ((-1.0d0) * t)
if (z <= (-5d+184)) then
tmp = t_1
else if (z <= (-9d-32)) then
tmp = x + t
else if (z <= 1.1d+68) then
tmp = y * (t / (a - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (-1.0 * t);
double tmp;
if (z <= -5e+184) {
tmp = t_1;
} else if (z <= -9e-32) {
tmp = x + t;
} else if (z <= 1.1e+68) {
tmp = y * (t / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -1.0 * (-1.0 * t) tmp = 0 if z <= -5e+184: tmp = t_1 elif z <= -9e-32: tmp = x + t elif z <= 1.1e+68: tmp = y * (t / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(-1.0 * t)) tmp = 0.0 if (z <= -5e+184) tmp = t_1; elseif (z <= -9e-32) tmp = Float64(x + t); elseif (z <= 1.1e+68) tmp = Float64(y * Float64(t / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -1.0 * (-1.0 * t); tmp = 0.0; if (z <= -5e+184) tmp = t_1; elseif (z <= -9e-32) tmp = x + t; elseif (z <= 1.1e+68) tmp = y * (t / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+184], t$95$1, If[LessEqual[z, -9e-32], N[(x + t), $MachinePrecision], If[LessEqual[z, 1.1e+68], N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \left(-1 \cdot t\right)\\
\mathbf{if}\;z \leq -5 \cdot 10^{+184}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-32}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+68}:\\
\;\;\;\;y \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.9999999999999999e184 or 1.09999999999999994e68 < z Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites71.9%
Taylor expanded in z around inf
lower-*.f6425.4
Applied rewrites25.4%
if -4.9999999999999999e184 < z < -9.00000000000000009e-32Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -9.00000000000000009e-32 < z < 1.09999999999999994e68Initial program 80.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6421.3
Applied rewrites21.3%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6423.1
Applied rewrites23.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) z)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-202)
(+ x t)
(if (<= t_2 400000000.0)
(* -1.0 (* -1.0 t))
(if (<= t_2 2e+299) (+ x t) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / 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 <= -1e-202) {
tmp = x + t;
} else if (t_2 <= 400000000.0) {
tmp = -1.0 * (-1.0 * t);
} else if (t_2 <= 2e+299) {
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 = (x * y) / 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 <= -1e-202) {
tmp = x + t;
} else if (t_2 <= 400000000.0) {
tmp = -1.0 * (-1.0 * t);
} else if (t_2 <= 2e+299) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) / z t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -1e-202: tmp = x + t elif t_2 <= 400000000.0: tmp = -1.0 * (-1.0 * t) elif t_2 <= 2e+299: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / 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 <= -1e-202) tmp = Float64(x + t); elseif (t_2 <= 400000000.0) tmp = Float64(-1.0 * Float64(-1.0 * t)); elseif (t_2 <= 2e+299) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) / z; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -1e-202) tmp = x + t; elseif (t_2 <= 400000000.0) tmp = -1.0 * (-1.0 * t); elseif (t_2 <= 2e+299) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $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, -1e-202], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, 400000000.0], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+299], N[(x + t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{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 -1 \cdot 10^{-202}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq 400000000:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+299}:\\
\;\;\;\;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 2.0000000000000001e299 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6416.6
Applied rewrites16.6%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1e-202 or 4e8 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.0000000000000001e299Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -1e-202 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4e8Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites71.9%
Taylor expanded in z around inf
lower-*.f6425.4
Applied rewrites25.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.16e+29) (* x 1.0) (if (<= a 7.2e+24) (* -1.0 (* -1.0 t)) (* x 1.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.16e+29) {
tmp = x * 1.0;
} else if (a <= 7.2e+24) {
tmp = -1.0 * (-1.0 * t);
} else {
tmp = x * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-1.16d+29)) then
tmp = x * 1.0d0
else if (a <= 7.2d+24) then
tmp = (-1.0d0) * ((-1.0d0) * t)
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.16e+29) {
tmp = x * 1.0;
} else if (a <= 7.2e+24) {
tmp = -1.0 * (-1.0 * t);
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.16e+29: tmp = x * 1.0 elif a <= 7.2e+24: tmp = -1.0 * (-1.0 * t) else: tmp = x * 1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.16e+29) tmp = Float64(x * 1.0); elseif (a <= 7.2e+24) tmp = Float64(-1.0 * Float64(-1.0 * t)); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.16e+29) tmp = x * 1.0; elseif (a <= 7.2e+24) tmp = -1.0 * (-1.0 * t); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.16e+29], N[(x * 1.0), $MachinePrecision], If[LessEqual[a, 7.2e+24], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.16 \cdot 10^{+29}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{+24}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if a < -1.16e29 or 7.19999999999999966e24 < a Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6425.3
Applied rewrites25.3%
Taylor expanded in z around 0
Applied rewrites25.0%
if -1.16e29 < a < 7.19999999999999966e24Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites71.9%
Taylor expanded in z around inf
lower-*.f6425.4
Applied rewrites25.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.3e-31) (+ x t) (if (<= z 2.8e-34) (* x 1.0) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.3e-31) {
tmp = x + t;
} else if (z <= 2.8e-34) {
tmp = x * 1.0;
} else {
tmp = x + 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 (z <= (-3.3d-31)) then
tmp = x + t
else if (z <= 2.8d-34) then
tmp = x * 1.0d0
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.3e-31) {
tmp = x + t;
} else if (z <= 2.8e-34) {
tmp = x * 1.0;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.3e-31: tmp = x + t elif z <= 2.8e-34: tmp = x * 1.0 else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.3e-31) tmp = Float64(x + t); elseif (z <= 2.8e-34) tmp = Float64(x * 1.0); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.3e-31) tmp = x + t; elseif (z <= 2.8e-34) tmp = x * 1.0; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.3e-31], N[(x + t), $MachinePrecision], If[LessEqual[z, 2.8e-34], N[(x * 1.0), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-31}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-34}:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -3.2999999999999999e-31 or 2.79999999999999997e-34 < z Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -3.2999999999999999e-31 < z < 2.79999999999999997e-34Initial program 80.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6425.3
Applied rewrites25.3%
Taylor expanded in z around 0
Applied rewrites25.0%
(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.4%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
herbie shell --seed 2025149
(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)))))