
(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(Float64(y - z) * 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[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 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(Float64(y - z) * 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[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t x) (- a z)) (- y z) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-177)
t_2
(if (<= t_2 0.0)
(fma (- (- t x)) (/ (- y a) z) t)
(if (<= t_2 1e+274) t_2 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - x) / (a - z)), (y - z), x);
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-177) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = fma(-(t - x), ((y - a) / z), t);
} else if (t_2 <= 1e+274) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - x) / Float64(a - z)), Float64(y - z), x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-177) tmp = t_2; elseif (t_2 <= 0.0) tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); elseif (t_2 <= 1e+274) tmp = t_2; 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[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-177], t$95$2, If[LessEqual[t$95$2, 0.0], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[t$95$2, 1e+274], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - x}{a - z}, y - z, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-177}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+274}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0 or 9.99999999999999921e273 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 41.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6488.5
Applied rewrites88.5%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -1.9999999999999999e-177 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 9.99999999999999921e273Initial program 94.5%
if -1.9999999999999999e-177 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 4.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6410.1
Applied rewrites10.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites99.8%
Final simplification92.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- (- t x)) (/ y z) t)))
(if (<= z -3.1e+31)
t_1
(if (<= z 7e-218)
(fma (/ (- t x) a) y x)
(if (<= z 3e+21) (* (- t x) (/ y (- a z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(-(t - x), (y / z), t);
double tmp;
if (z <= -3.1e+31) {
tmp = t_1;
} else if (z <= 7e-218) {
tmp = fma(((t - x) / a), y, x);
} else if (z <= 3e+21) {
tmp = (t - x) * (y / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(-Float64(t - x)), Float64(y / z), t) tmp = 0.0 if (z <= -3.1e+31) tmp = t_1; elseif (z <= 7e-218) tmp = fma(Float64(Float64(t - x) / a), y, x); elseif (z <= 3e+21) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-N[(t - x), $MachinePrecision]) * N[(y / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -3.1e+31], t$95$1, If[LessEqual[z, 7e-218], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 3e+21], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-\left(t - x\right), \frac{y}{z}, t\right)\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-218}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+21}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.1000000000000002e31 or 3e21 < z Initial program 45.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.8
Applied rewrites71.8%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites84.4%
Taylor expanded in y around inf
Applied rewrites81.2%
if -3.1000000000000002e31 < z < 7e-218Initial program 85.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6476.1
Applied rewrites76.1%
if 7e-218 < z < 3e21Initial program 86.7%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6466.6
Applied rewrites66.6%
Final simplification76.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x t) z) y t)))
(if (<= z -3.1e+31)
t_1
(if (<= z 7e-218)
(fma (/ (- t x) a) y x)
(if (<= z 3e+21) (* (- t x) (/ y (- a z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - t) / z), y, t);
double tmp;
if (z <= -3.1e+31) {
tmp = t_1;
} else if (z <= 7e-218) {
tmp = fma(((t - x) / a), y, x);
} else if (z <= 3e+21) {
tmp = (t - x) * (y / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - t) / z), y, t) tmp = 0.0 if (z <= -3.1e+31) tmp = t_1; elseif (z <= 7e-218) tmp = fma(Float64(Float64(t - x) / a), y, x); elseif (z <= 3e+21) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision]}, If[LessEqual[z, -3.1e+31], t$95$1, If[LessEqual[z, 7e-218], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 3e+21], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-218}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+21}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.1000000000000002e31 or 3e21 < z Initial program 45.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.8
Applied rewrites71.8%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites84.4%
Taylor expanded in a around 0
Applied rewrites80.9%
if -3.1000000000000002e31 < z < 7e-218Initial program 85.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6476.1
Applied rewrites76.1%
if 7e-218 < z < 3e21Initial program 86.7%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6466.6
Applied rewrites66.6%
Final simplification76.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.9e+145)
(fma (- a) (/ x z) t)
(if (<= z -5.8e+39)
(* (- x t) (/ y z))
(if (<= z 1.4e+24) (fma (/ (- t x) a) y x) (fma (- t) (/ y z) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.9e+145) {
tmp = fma(-a, (x / z), t);
} else if (z <= -5.8e+39) {
tmp = (x - t) * (y / z);
} else if (z <= 1.4e+24) {
tmp = fma(((t - x) / a), y, x);
} else {
tmp = fma(-t, (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.9e+145) tmp = fma(Float64(-a), Float64(x / z), t); elseif (z <= -5.8e+39) tmp = Float64(Float64(x - t) * Float64(y / z)); elseif (z <= 1.4e+24) tmp = fma(Float64(Float64(t - x) / a), y, x); else tmp = fma(Float64(-t), Float64(y / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.9e+145], N[((-a) * N[(x / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, -5.8e+39], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+24], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], N[((-t) * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{x}{z}, t\right)\\
\mathbf{elif}\;z \leq -5.8 \cdot 10^{+39}:\\
\;\;\;\;\left(x - t\right) \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+24}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if z < -4.90000000000000003e145Initial program 29.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6453.6
Applied rewrites53.6%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites96.5%
Taylor expanded in y around 0
Applied rewrites71.9%
Taylor expanded in x around inf
Applied rewrites71.9%
if -4.90000000000000003e145 < z < -5.80000000000000059e39Initial program 59.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.0
Applied rewrites71.0%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites76.7%
Taylor expanded in y around inf
Applied rewrites57.4%
Applied rewrites57.4%
if -5.80000000000000059e39 < z < 1.4000000000000001e24Initial program 86.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6468.4
Applied rewrites68.4%
if 1.4000000000000001e24 < z Initial program 44.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites81.7%
Taylor expanded in y around inf
Applied rewrites77.9%
Taylor expanded in x around 0
Applied rewrites62.9%
Final simplification66.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (- t x))))
(if (<= z -1.7e+83)
(fma t_1 (/ (- y a) z) t)
(if (<= z 1.06e+176)
(fma (/ (- t x) (- a z)) (- y z) x)
(fma (/ t_1 z) (- y a) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -(t - x);
double tmp;
if (z <= -1.7e+83) {
tmp = fma(t_1, ((y - a) / z), t);
} else if (z <= 1.06e+176) {
tmp = fma(((t - x) / (a - z)), (y - z), x);
} else {
tmp = fma((t_1 / z), (y - a), t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(-Float64(t - x)) tmp = 0.0 if (z <= -1.7e+83) tmp = fma(t_1, Float64(Float64(y - a) / z), t); elseif (z <= 1.06e+176) tmp = fma(Float64(Float64(t - x) / Float64(a - z)), Float64(y - z), x); else tmp = fma(Float64(t_1 / z), Float64(y - a), t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = (-N[(t - x), $MachinePrecision])}, If[LessEqual[z, -1.7e+83], N[(t$95$1 * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, 1.06e+176], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(N[(t$95$1 / z), $MachinePrecision] * N[(y - a), $MachinePrecision] + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\left(t - x\right)\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \frac{y - a}{z}, t\right)\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{+176}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_1}{z}, y - a, t\right)\\
\end{array}
\end{array}
if z < -1.6999999999999999e83Initial program 36.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6455.8
Applied rewrites55.8%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites92.6%
if -1.6999999999999999e83 < z < 1.06000000000000002e176Initial program 78.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6487.4
Applied rewrites87.4%
if 1.06000000000000002e176 < z Initial program 29.9%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites97.6%
Final simplification89.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -9.5e+78) (not (<= a 0.005))) (fma (- t x) (/ (- y z) a) x) (fma (- (- t x)) (/ (- y a) z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -9.5e+78) || !(a <= 0.005)) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = fma(-(t - x), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -9.5e+78) || !(a <= 0.005)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -9.5e+78], N[Not[LessEqual[a, 0.005]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.5 \cdot 10^{+78} \lor \neg \left(a \leq 0.005\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if a < -9.5000000000000006e78 or 0.0050000000000000001 < a Initial program 72.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6488.8
Applied rewrites88.8%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.6
Applied rewrites79.6%
if -9.5000000000000006e78 < a < 0.0050000000000000001Initial program 63.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.0
Applied rewrites74.0%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites81.3%
Final simplification80.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.1e+31) (not (<= z 0.028))) (fma (/ (- (- t x)) z) (- y a) t) (fma (- t x) (/ (- y z) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.1e+31) || !(z <= 0.028)) {
tmp = fma((-(t - x) / z), (y - a), t);
} else {
tmp = fma((t - x), ((y - z) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.1e+31) || !(z <= 0.028)) tmp = fma(Float64(Float64(-Float64(t - x)) / z), Float64(y - a), t); else tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.1e+31], N[Not[LessEqual[z, 0.028]], $MachinePrecision]], N[(N[((-N[(t - x), $MachinePrecision]) / z), $MachinePrecision] * N[(y - a), $MachinePrecision] + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+31} \lor \neg \left(z \leq 0.028\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{-\left(t - x\right)}{z}, y - a, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\end{array}
\end{array}
if z < -3.1000000000000002e31 or 0.0280000000000000006 < z Initial program 47.1%
Taylor expanded in z around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate--l-N/A
fp-cancel-sign-subN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites83.0%
if -3.1000000000000002e31 < z < 0.0280000000000000006Initial program 86.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6488.0
Applied rewrites88.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.0
Applied rewrites77.0%
Final simplification80.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- a) (/ x z) t)))
(if (<= z -4.9e+145)
t_1
(if (<= z -7.6e+37)
(* (- x t) (/ y z))
(if (<= z 1.25e+24) (fma y (/ t a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(-a, (x / z), t);
double tmp;
if (z <= -4.9e+145) {
tmp = t_1;
} else if (z <= -7.6e+37) {
tmp = (x - t) * (y / z);
} else if (z <= 1.25e+24) {
tmp = fma(y, (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(-a), Float64(x / z), t) tmp = 0.0 if (z <= -4.9e+145) tmp = t_1; elseif (z <= -7.6e+37) tmp = Float64(Float64(x - t) * Float64(y / z)); elseif (z <= 1.25e+24) tmp = fma(y, Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-a) * N[(x / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -4.9e+145], t$95$1, If[LessEqual[z, -7.6e+37], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e+24], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, \frac{x}{z}, t\right)\\
\mathbf{if}\;z \leq -4.9 \cdot 10^{+145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{+37}:\\
\;\;\;\;\left(x - t\right) \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+24}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.90000000000000003e145 or 1.25000000000000011e24 < z Initial program 40.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.1
Applied rewrites71.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites86.0%
Taylor expanded in y around 0
Applied rewrites60.1%
Taylor expanded in x around inf
Applied rewrites60.3%
if -4.90000000000000003e145 < z < -7.59999999999999979e37Initial program 61.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6472.1
Applied rewrites72.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites77.6%
Taylor expanded in y around inf
Applied rewrites59.0%
Applied rewrites59.0%
if -7.59999999999999979e37 < z < 1.25000000000000011e24Initial program 86.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6487.8
Applied rewrites87.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6468.2
Applied rewrites68.2%
Taylor expanded in x around 0
Applied rewrites54.6%
Final simplification57.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.1e+31) (not (<= z 0.024))) (fma (- (- t x)) (/ y z) t) (fma (- t x) (/ (- y z) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.1e+31) || !(z <= 0.024)) {
tmp = fma(-(t - x), (y / z), t);
} else {
tmp = fma((t - x), ((y - z) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.1e+31) || !(z <= 0.024)) tmp = fma(Float64(-Float64(t - x)), Float64(y / z), t); else tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.1e+31], N[Not[LessEqual[z, 0.024]], $MachinePrecision]], N[((-N[(t - x), $MachinePrecision]) * N[(y / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+31} \lor \neg \left(z \leq 0.024\right):\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\end{array}
\end{array}
if z < -3.1000000000000002e31 or 0.024 < z Initial program 47.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6472.1
Applied rewrites72.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites83.2%
Taylor expanded in y around inf
Applied rewrites80.2%
if -3.1000000000000002e31 < z < 0.024Initial program 86.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6488.0
Applied rewrites88.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.0
Applied rewrites77.0%
Final simplification78.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.9e+85) (not (<= a 0.005))) (fma (- y z) (/ (- t x) a) x) (fma (- (- t x)) (/ y z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.9e+85) || !(a <= 0.005)) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = fma(-(t - x), (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.9e+85) || !(a <= 0.005)) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = fma(Float64(-Float64(t - x)), Float64(y / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.9e+85], N[Not[LessEqual[a, 0.005]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{+85} \lor \neg \left(a \leq 0.005\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if a < -2.89999999999999997e85 or 0.0050000000000000001 < a Initial program 72.4%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.8
Applied rewrites77.8%
if -2.89999999999999997e85 < a < 0.0050000000000000001Initial program 63.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.8
Applied rewrites73.8%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites80.9%
Taylor expanded in y around inf
Applied rewrites77.0%
Final simplification77.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ t z) a t)))
(if (<= z -5.2e+145)
t_1
(if (<= z -7.6e+37)
(* (- x t) (/ y z))
(if (<= z 2.5e+97) (fma y (/ t a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / z), a, t);
double tmp;
if (z <= -5.2e+145) {
tmp = t_1;
} else if (z <= -7.6e+37) {
tmp = (x - t) * (y / z);
} else if (z <= 2.5e+97) {
tmp = fma(y, (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / z), a, t) tmp = 0.0 if (z <= -5.2e+145) tmp = t_1; elseif (z <= -7.6e+37) tmp = Float64(Float64(x - t) * Float64(y / z)); elseif (z <= 2.5e+97) tmp = fma(y, Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / z), $MachinePrecision] * a + t), $MachinePrecision]}, If[LessEqual[z, -5.2e+145], t$95$1, If[LessEqual[z, -7.6e+37], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.5e+97], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{z}, a, t\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{+37}:\\
\;\;\;\;\left(x - t\right) \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.20000000000000005e145 or 2.49999999999999999e97 < z Initial program 36.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6466.9
Applied rewrites66.9%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites89.1%
Taylor expanded in y around 0
Applied rewrites65.4%
Taylor expanded in x around 0
Applied rewrites61.8%
if -5.20000000000000005e145 < z < -7.59999999999999979e37Initial program 61.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6472.1
Applied rewrites72.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites77.6%
Taylor expanded in y around inf
Applied rewrites59.0%
Applied rewrites59.0%
if -7.59999999999999979e37 < z < 2.49999999999999999e97Initial program 82.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6488.0
Applied rewrites88.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6463.9
Applied rewrites63.9%
Taylor expanded in x around 0
Applied rewrites51.9%
Final simplification55.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.1e+31) (not (<= z 0.024))) (fma (/ (- x t) z) y t) (fma (/ (- t x) a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.1e+31) || !(z <= 0.024)) {
tmp = fma(((x - t) / z), y, t);
} else {
tmp = fma(((t - x) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.1e+31) || !(z <= 0.024)) tmp = fma(Float64(Float64(x - t) / z), y, t); else tmp = fma(Float64(Float64(t - x) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.1e+31], N[Not[LessEqual[z, 0.024]], $MachinePrecision]], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+31} \lor \neg \left(z \leq 0.024\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -3.1000000000000002e31 or 0.024 < z Initial program 47.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6472.1
Applied rewrites72.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites83.2%
Taylor expanded in a around 0
Applied rewrites79.9%
if -3.1000000000000002e31 < z < 0.024Initial program 86.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6470.1
Applied rewrites70.1%
Final simplification75.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.9e+120) (not (<= a 3.2e-7))) (fma y (/ t a) x) (fma (- t) (/ y z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.9e+120) || !(a <= 3.2e-7)) {
tmp = fma(y, (t / a), x);
} else {
tmp = fma(-t, (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.9e+120) || !(a <= 3.2e-7)) tmp = fma(y, Float64(t / a), x); else tmp = fma(Float64(-t), Float64(y / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.9e+120], N[Not[LessEqual[a, 3.2e-7]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[((-t) * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{+120} \lor \neg \left(a \leq 3.2 \cdot 10^{-7}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if a < -1.8999999999999999e120 or 3.2000000000000001e-7 < a Initial program 72.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6489.0
Applied rewrites89.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6473.2
Applied rewrites73.2%
Taylor expanded in x around 0
Applied rewrites65.0%
if -1.8999999999999999e120 < a < 3.2000000000000001e-7Initial program 63.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.5
Applied rewrites74.5%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites80.1%
Taylor expanded in y around inf
Applied rewrites76.3%
Taylor expanded in x around 0
Applied rewrites53.7%
Final simplification58.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.7e+91) (not (<= z 2.5e+97))) (fma (/ t z) a t) (fma y (/ t a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.7e+91) || !(z <= 2.5e+97)) {
tmp = fma((t / z), a, t);
} else {
tmp = fma(y, (t / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.7e+91) || !(z <= 2.5e+97)) tmp = fma(Float64(t / z), a, t); else tmp = fma(y, Float64(t / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.7e+91], N[Not[LessEqual[z, 2.5e+97]], $MachinePrecision]], N[(N[(t / z), $MachinePrecision] * a + t), $MachinePrecision], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+91} \lor \neg \left(z \leq 2.5 \cdot 10^{+97}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z}, a, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\end{array}
\end{array}
if z < -4.6999999999999997e91 or 2.49999999999999999e97 < z Initial program 37.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6466.4
Applied rewrites66.4%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites89.2%
Taylor expanded in y around 0
Applied rewrites61.7%
Taylor expanded in x around 0
Applied rewrites58.3%
if -4.6999999999999997e91 < z < 2.49999999999999999e97Initial program 81.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6487.0
Applied rewrites87.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6461.7
Applied rewrites61.7%
Taylor expanded in x around 0
Applied rewrites50.4%
Final simplification53.1%
(FPCore (x y z t a) :precision binary64 (if (<= y -7.8e+124) (/ (* y t) a) (if (<= y 7.6e-34) (fma (/ t z) a t) (* (/ y z) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -7.8e+124) {
tmp = (y * t) / a;
} else if (y <= 7.6e-34) {
tmp = fma((t / z), a, t);
} else {
tmp = (y / z) * x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (y <= -7.8e+124) tmp = Float64(Float64(y * t) / a); elseif (y <= 7.6e-34) tmp = fma(Float64(t / z), a, t); else tmp = Float64(Float64(y / z) * x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -7.8e+124], N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 7.6e-34], N[(N[(t / z), $MachinePrecision] * a + t), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+124}:\\
\;\;\;\;\frac{y \cdot t}{a}\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z}, a, t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if y < -7.8000000000000001e124Initial program 75.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.1
Applied rewrites91.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6466.2
Applied rewrites66.2%
Taylor expanded in x around 0
Applied rewrites39.1%
if -7.8000000000000001e124 < y < 7.6000000000000002e-34Initial program 63.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.8
Applied rewrites73.8%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites58.7%
Taylor expanded in y around 0
Applied rewrites45.3%
Taylor expanded in x around 0
Applied rewrites41.9%
if 7.6000000000000002e-34 < y Initial program 68.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites57.9%
Taylor expanded in y around inf
Applied rewrites48.1%
Taylor expanded in x around inf
Applied rewrites35.8%
Final simplification39.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1e+104) (not (<= z 0.85))) (+ x (- t x)) (/ (* y t) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e+104) || !(z <= 0.85)) {
tmp = x + (t - x);
} else {
tmp = (y * t) / a;
}
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 <= (-1d+104)) .or. (.not. (z <= 0.85d0))) then
tmp = x + (t - x)
else
tmp = (y * t) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e+104) || !(z <= 0.85)) {
tmp = x + (t - x);
} else {
tmp = (y * t) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1e+104) or not (z <= 0.85): tmp = x + (t - x) else: tmp = (y * t) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e+104) || !(z <= 0.85)) tmp = Float64(x + Float64(t - x)); else tmp = Float64(Float64(y * t) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1e+104) || ~((z <= 0.85))) tmp = x + (t - x); else tmp = (y * t) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e+104], N[Not[LessEqual[z, 0.85]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+104} \lor \neg \left(z \leq 0.85\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -1e104 or 0.849999999999999978 < z Initial program 42.3%
Taylor expanded in z around inf
lower--.f6443.9
Applied rewrites43.9%
if -1e104 < z < 0.849999999999999978Initial program 83.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.2
Applied rewrites86.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6464.6
Applied rewrites64.6%
Taylor expanded in x around 0
Applied rewrites24.7%
Final simplification32.5%
(FPCore (x y z t a) :precision binary64 (if (<= y -0.85) (/ (* y t) a) (if (<= y 9.5e-76) (+ x (- t x)) (* (/ y z) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -0.85) {
tmp = (y * t) / a;
} else if (y <= 9.5e-76) {
tmp = x + (t - x);
} else {
tmp = (y / z) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-0.85d0)) then
tmp = (y * t) / a
else if (y <= 9.5d-76) then
tmp = x + (t - x)
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -0.85) {
tmp = (y * t) / a;
} else if (y <= 9.5e-76) {
tmp = x + (t - x);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -0.85: tmp = (y * t) / a elif y <= 9.5e-76: tmp = x + (t - x) else: tmp = (y / z) * x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -0.85) tmp = Float64(Float64(y * t) / a); elseif (y <= 9.5e-76) tmp = Float64(x + Float64(t - x)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -0.85) tmp = (y * t) / a; elseif (y <= 9.5e-76) tmp = x + (t - x); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -0.85], N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 9.5e-76], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.85:\\
\;\;\;\;\frac{y \cdot t}{a}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-76}:\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if y < -0.849999999999999978Initial program 73.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6487.5
Applied rewrites87.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6461.1
Applied rewrites61.1%
Taylor expanded in x around 0
Applied rewrites32.5%
if -0.849999999999999978 < y < 9.49999999999999984e-76Initial program 63.8%
Taylor expanded in z around inf
lower--.f6437.4
Applied rewrites37.4%
if 9.49999999999999984e-76 < y Initial program 65.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.8
Applied rewrites83.8%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
+-commutativeN/A
Applied rewrites60.1%
Taylor expanded in y around inf
Applied rewrites47.8%
Taylor expanded in x around inf
Applied rewrites35.7%
Final simplification35.7%
(FPCore (x y z t a) :precision binary64 (+ x (- t x)))
double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (t - x)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
def code(x, y, z, t, a): return x + (t - x)
function code(x, y, z, t, a) return Float64(x + Float64(t - x)) end
function tmp = code(x, y, z, t, a) tmp = x + (t - x); end
code[x_, y_, z_, t_, a_] := N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right)
\end{array}
Initial program 66.8%
Taylor expanded in z around inf
lower--.f6423.3
Applied rewrites23.3%
(FPCore (x y z t a) :precision binary64 (+ x (- x)))
double code(double x, double y, double z, double t, double a) {
return x + -x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + -x
end function
public static double code(double x, double y, double z, double t, double a) {
return x + -x;
}
def code(x, y, z, t, a): return x + -x
function code(x, y, z, t, a) return Float64(x + Float64(-x)) end
function tmp = code(x, y, z, t, a) tmp = x + -x; end
code[x_, y_, z_, t_, a_] := N[(x + (-x)), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-x\right)
\end{array}
Initial program 66.8%
Taylor expanded in z around inf
lower--.f6423.3
Applied rewrites23.3%
Taylor expanded in x around inf
Applied rewrites2.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ y z) (- t x)))))
(if (< z -1.2536131056095036e+188)
t_1
(if (< z 4.446702369113811e+64)
(+ x (/ (- y z) (/ (- a z) (- t x))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x))
if (z < (-1.2536131056095036d+188)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - ((y / z) * (t - x)) tmp = 0 if z < -1.2536131056095036e+188: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x + ((y - z) / ((a - z) / (t - x))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(y / z) * Float64(t - x))) tmp = 0.0 if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x + Float64(Float64(y - z) / Float64(Float64(a - z) / Float64(t - x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - ((y / z) * (t - x)); tmp = 0.0; if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x + ((y - z) / ((a - z) / (t - x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(y / z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -1.2536131056095036e+188], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x + N[(N[(y - z), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{y}{z} \cdot \left(t - x\right)\\
\mathbf{if}\;z < -1.2536131056095036 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025016
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< z -125361310560950360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- t (* (/ y z) (- t x))) (if (< z 44467023691138110000000000000000000000000000000000000000000000000) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x))))))
(+ x (/ (* (- y z) (- t x)) (- a z))))