
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (or (<= t_1 -1e-293) (not (<= t_1 0.0)))
(fma (/ (- z t) (- a t)) (- y x) x)
(- y (* (- x) (/ (- z a) t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if ((t_1 <= -1e-293) || !(t_1 <= 0.0)) {
tmp = fma(((z - t) / (a - t)), (y - x), x);
} else {
tmp = y - (-x * ((z - a) / t));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if ((t_1 <= -1e-293) || !(t_1 <= 0.0)) tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); else tmp = Float64(y - Float64(Float64(-x) * Float64(Float64(z - a) / t))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e-293], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(y - N[((-x) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-293} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \left(-x\right) \cdot \frac{z - a}{t}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -1.0000000000000001e-293 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 77.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.0
Applied rewrites90.0%
if -1.0000000000000001e-293 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 3.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f643.1
Applied rewrites3.1%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6490.1
Applied rewrites90.1%
Taylor expanded in x around inf
Applied rewrites99.8%
Final simplification90.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z t) (/ y a) x)))
(if (<= a -1.75e-98)
t_1
(if (<= a -2.1e-260)
(/ (* z y) (- a t))
(if (<= a 6.2e-60) (/ (* (- z a) x) t) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z - t), (y / a), x);
double tmp;
if (a <= -1.75e-98) {
tmp = t_1;
} else if (a <= -2.1e-260) {
tmp = (z * y) / (a - t);
} else if (a <= 6.2e-60) {
tmp = ((z - a) * x) / t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z - t), Float64(y / a), x) tmp = 0.0 if (a <= -1.75e-98) tmp = t_1; elseif (a <= -2.1e-260) tmp = Float64(Float64(z * y) / Float64(a - t)); elseif (a <= 6.2e-60) tmp = Float64(Float64(Float64(z - a) * x) / t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.75e-98], t$95$1, If[LessEqual[a, -2.1e-260], N[(N[(z * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.2e-60], N[(N[(N[(z - a), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\mathbf{if}\;a \leq -1.75 \cdot 10^{-98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -2.1 \cdot 10^{-260}:\\
\;\;\;\;\frac{z \cdot y}{a - t}\\
\mathbf{elif}\;a \leq 6.2 \cdot 10^{-60}:\\
\;\;\;\;\frac{\left(z - a\right) \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.7500000000000001e-98 or 6.19999999999999976e-60 < a Initial program 77.9%
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--.f6473.6
Applied rewrites73.6%
Taylor expanded in x around 0
Applied rewrites64.1%
if -1.7500000000000001e-98 < a < -2.10000000000000005e-260Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6476.2
Applied rewrites76.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6462.5
Applied rewrites62.5%
Taylor expanded in z around inf
Applied rewrites42.8%
Applied rewrites46.3%
if -2.10000000000000005e-260 < a < 6.19999999999999976e-60Initial program 59.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.2
Applied rewrites71.2%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6488.5
Applied rewrites88.5%
Taylor expanded in x around inf
Applied rewrites36.6%
Final simplification54.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.98e-47) (not (<= a 6.5e+50))) (fma (/ (- z t) a) (- y x) x) (- y (* (/ (- y x) t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.98e-47) || !(a <= 6.5e+50)) {
tmp = fma(((z - t) / a), (y - x), x);
} else {
tmp = y - (((y - x) / t) * (z - a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.98e-47) || !(a <= 6.5e+50)) tmp = fma(Float64(Float64(z - t) / a), Float64(y - x), x); else tmp = Float64(y - Float64(Float64(Float64(y - x) / t) * Float64(z - a))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.98e-47], N[Not[LessEqual[a, 6.5e+50]], $MachinePrecision]], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.98 \cdot 10^{-47} \lor \neg \left(a \leq 6.5 \cdot 10^{+50}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{y - x}{t} \cdot \left(z - a\right)\\
\end{array}
\end{array}
if a < -1.98e-47 or 6.5000000000000003e50 < a Initial program 79.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.6
Applied rewrites93.6%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6484.8
Applied rewrites84.8%
if -1.98e-47 < a < 6.5000000000000003e50Initial program 63.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.5
Applied rewrites73.5%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6482.2
Applied rewrites82.2%
Final simplification83.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y a) z x)))
(if (<= a -6.2e-106)
t_1
(if (<= a -2.1e-260)
(/ (* z y) (- a t))
(if (<= a 6.2e+50) (/ (* (- z a) x) t) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), z, x);
double tmp;
if (a <= -6.2e-106) {
tmp = t_1;
} else if (a <= -2.1e-260) {
tmp = (z * y) / (a - t);
} else if (a <= 6.2e+50) {
tmp = ((z - a) * x) / t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), z, x) tmp = 0.0 if (a <= -6.2e-106) tmp = t_1; elseif (a <= -2.1e-260) tmp = Float64(Float64(z * y) / Float64(a - t)); elseif (a <= 6.2e+50) tmp = Float64(Float64(Float64(z - a) * x) / t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[a, -6.2e-106], t$95$1, If[LessEqual[a, -2.1e-260], N[(N[(z * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.2e+50], N[(N[(N[(z - a), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{if}\;a \leq -6.2 \cdot 10^{-106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -2.1 \cdot 10^{-260}:\\
\;\;\;\;\frac{z \cdot y}{a - t}\\
\mathbf{elif}\;a \leq 6.2 \cdot 10^{+50}:\\
\;\;\;\;\frac{\left(z - a\right) \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -6.19999999999999971e-106 or 6.20000000000000006e50 < a Initial program 79.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6474.2
Applied rewrites74.2%
Taylor expanded in x around 0
Applied rewrites63.5%
if -6.19999999999999971e-106 < a < -2.10000000000000005e-260Initial program 67.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.2
Applied rewrites75.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6460.9
Applied rewrites60.9%
Taylor expanded in z around inf
Applied rewrites44.5%
Applied rewrites48.1%
if -2.10000000000000005e-260 < a < 6.20000000000000006e50Initial program 61.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6472.0
Applied rewrites72.0%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6486.2
Applied rewrites86.2%
Taylor expanded in x around inf
Applied rewrites35.9%
Final simplification51.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ z (- a t)))))
(if (<= y -4.7e+36)
t_1
(if (<= y 55000.0)
(* (- 1.0 (/ z a)) x)
(if (<= y 7.8e+112) (fma 1.0 (- y x) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / (a - t));
double tmp;
if (y <= -4.7e+36) {
tmp = t_1;
} else if (y <= 55000.0) {
tmp = (1.0 - (z / a)) * x;
} else if (y <= 7.8e+112) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z / Float64(a - t))) tmp = 0.0 if (y <= -4.7e+36) tmp = t_1; elseif (y <= 55000.0) tmp = Float64(Float64(1.0 - Float64(z / a)) * x); elseif (y <= 7.8e+112) tmp = fma(1.0, Float64(y - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.7e+36], t$95$1, If[LessEqual[y, 55000.0], N[(N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 7.8e+112], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{a - t}\\
\mathbf{if}\;y \leq -4.7 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 55000:\\
\;\;\;\;\left(1 - \frac{z}{a}\right) \cdot x\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+112}:\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.69999999999999989e36 or 7.79999999999999937e112 < y Initial program 68.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.5
Applied rewrites91.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.7
Applied rewrites79.7%
Taylor expanded in z around inf
Applied rewrites47.0%
if -4.69999999999999989e36 < y < 55000Initial program 73.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6457.7
Applied rewrites57.7%
Taylor expanded in x around inf
Applied rewrites50.4%
if 55000 < y < 7.79999999999999937e112Initial program 71.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.8
Applied rewrites82.8%
Taylor expanded in t around inf
Applied rewrites60.2%
Final simplification49.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1e-47) (not (<= a 3.3e+50))) (fma (/ (- z t) a) (- y x) x) (- y (/ (* (- y x) z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1e-47) || !(a <= 3.3e+50)) {
tmp = fma(((z - t) / a), (y - x), x);
} else {
tmp = y - (((y - x) * z) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1e-47) || !(a <= 3.3e+50)) tmp = fma(Float64(Float64(z - t) / a), Float64(y - x), x); else tmp = Float64(y - Float64(Float64(Float64(y - x) * z) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1e-47], N[Not[LessEqual[a, 3.3e+50]], $MachinePrecision]], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{-47} \lor \neg \left(a \leq 3.3 \cdot 10^{+50}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if a < -9.9999999999999997e-48 or 3.3e50 < a Initial program 79.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.6
Applied rewrites93.6%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6484.8
Applied rewrites84.8%
if -9.9999999999999997e-48 < a < 3.3e50Initial program 63.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.5
Applied rewrites73.5%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6482.2
Applied rewrites82.2%
Taylor expanded in z around inf
Applied rewrites71.6%
Final simplification77.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.7e-47) (not (<= a 3.3e+50))) (fma (- z t) (/ (- y x) a) x) (- y (/ (* (- y x) z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.7e-47) || !(a <= 3.3e+50)) {
tmp = fma((z - t), ((y - x) / a), x);
} else {
tmp = y - (((y - x) * z) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.7e-47) || !(a <= 3.3e+50)) tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); else tmp = Float64(y - Float64(Float64(Float64(y - x) * z) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.7e-47], N[Not[LessEqual[a, 3.3e+50]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.7 \cdot 10^{-47} \lor \neg \left(a \leq 3.3 \cdot 10^{+50}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if a < -1.7000000000000001e-47 or 3.3e50 < a Initial program 79.6%
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--.f6482.0
Applied rewrites82.0%
if -1.7000000000000001e-47 < a < 3.3e50Initial program 63.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.5
Applied rewrites73.5%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6482.2
Applied rewrites82.2%
Taylor expanded in z around inf
Applied rewrites71.6%
Final simplification76.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1e-47) (not (<= a 3.3e+50))) (fma (/ z a) (- y x) x) (- y (/ (* (- y x) z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1e-47) || !(a <= 3.3e+50)) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = y - (((y - x) * z) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1e-47) || !(a <= 3.3e+50)) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = Float64(y - Float64(Float64(Float64(y - x) * z) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1e-47], N[Not[LessEqual[a, 3.3e+50]], $MachinePrecision]], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(y - N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{-47} \lor \neg \left(a \leq 3.3 \cdot 10^{+50}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if a < -9.9999999999999997e-48 or 3.3e50 < a Initial program 79.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.6
Applied rewrites93.6%
Taylor expanded in t around 0
lower-/.f6478.7
Applied rewrites78.7%
if -9.9999999999999997e-48 < a < 3.3e50Initial program 63.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.5
Applied rewrites73.5%
Taylor expanded in t around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6482.2
Applied rewrites82.2%
Taylor expanded in z around inf
Applied rewrites71.6%
Final simplification75.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -8e+26) (not (<= y 7.6e-31))) (* (/ (- z t) (- a t)) y) (fma (/ z a) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -8e+26) || !(y <= 7.6e-31)) {
tmp = ((z - t) / (a - t)) * y;
} else {
tmp = fma((z / a), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -8e+26) || !(y <= 7.6e-31)) tmp = Float64(Float64(Float64(z - t) / Float64(a - t)) * y); else tmp = fma(Float64(z / a), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -8e+26], N[Not[LessEqual[y, 7.6e-31]], $MachinePrecision]], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+26} \lor \neg \left(y \leq 7.6 \cdot 10^{-31}\right):\\
\;\;\;\;\frac{z - t}{a - t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\end{array}
\end{array}
if y < -8.00000000000000038e26 or 7.5999999999999999e-31 < y Initial program 68.8%
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%
Taylor expanded in y around inf
Applied rewrites88.5%
Taylor expanded in x around 0
Applied rewrites82.6%
if -8.00000000000000038e26 < y < 7.5999999999999999e-31Initial program 73.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6478.5
Applied rewrites78.5%
Taylor expanded in t around 0
lower-/.f6461.2
Applied rewrites61.2%
Final simplification71.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -8e+26) (not (<= y 7.6e-31))) (* (- z t) (/ y (- a t))) (fma (/ z a) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -8e+26) || !(y <= 7.6e-31)) {
tmp = (z - t) * (y / (a - t));
} else {
tmp = fma((z / a), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -8e+26) || !(y <= 7.6e-31)) tmp = Float64(Float64(z - t) * Float64(y / Float64(a - t))); else tmp = fma(Float64(z / a), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -8e+26], N[Not[LessEqual[y, 7.6e-31]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+26} \lor \neg \left(y \leq 7.6 \cdot 10^{-31}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\end{array}
\end{array}
if y < -8.00000000000000038e26 or 7.5999999999999999e-31 < y Initial program 68.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.7
Applied rewrites79.7%
if -8.00000000000000038e26 < y < 7.5999999999999999e-31Initial program 73.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6478.5
Applied rewrites78.5%
Taylor expanded in t around 0
lower-/.f6461.2
Applied rewrites61.2%
Final simplification69.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ z a))))
(if (<= z -1.4e-33)
t_1
(if (<= z 1.65e-296)
(fma 1.0 (- y x) x)
(if (<= z 1.65e+16) (* (/ x y) y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / a);
double tmp;
if (z <= -1.4e-33) {
tmp = t_1;
} else if (z <= 1.65e-296) {
tmp = fma(1.0, (y - x), x);
} else if (z <= 1.65e+16) {
tmp = (x / y) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z / a)) tmp = 0.0 if (z <= -1.4e-33) tmp = t_1; elseif (z <= 1.65e-296) tmp = fma(1.0, Float64(y - x), x); elseif (z <= 1.65e+16) tmp = Float64(Float64(x / y) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.4e-33], t$95$1, If[LessEqual[z, 1.65e-296], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.65e+16], N[(N[(x / y), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{a}\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-296}:\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{y} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.4e-33 or 1.65e16 < z Initial program 74.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6487.9
Applied rewrites87.9%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6453.6
Applied rewrites53.6%
Taylor expanded in z around inf
Applied rewrites45.6%
Taylor expanded in t around 0
Applied rewrites33.7%
if -1.4e-33 < z < 1.65e-296Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.6
Applied rewrites80.6%
Taylor expanded in t around inf
Applied rewrites38.6%
if 1.65e-296 < z < 1.65e16Initial program 69.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.7
Applied rewrites75.7%
Taylor expanded in y around inf
Applied rewrites65.8%
Taylor expanded in a around inf
Applied rewrites36.7%
Final simplification35.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -6.1e-50) (not (<= a 0.0125))) (fma (/ z a) (- y x) x) (* (- y) (/ (- z t) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -6.1e-50) || !(a <= 0.0125)) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = -y * ((z - t) / t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -6.1e-50) || !(a <= 0.0125)) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = Float64(Float64(-y) * Float64(Float64(z - t) / t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -6.1e-50], N[Not[LessEqual[a, 0.0125]], $MachinePrecision]], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[((-y) * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.1 \cdot 10^{-50} \lor \neg \left(a \leq 0.0125\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z - t}{t}\\
\end{array}
\end{array}
if a < -6.0999999999999996e-50 or 0.012500000000000001 < a Initial program 79.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6492.1
Applied rewrites92.1%
Taylor expanded in t around 0
lower-/.f6475.1
Applied rewrites75.1%
if -6.0999999999999996e-50 < a < 0.012500000000000001Initial program 62.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.1
Applied rewrites73.1%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6458.1
Applied rewrites58.1%
Taylor expanded in a around 0
Applied rewrites56.8%
Final simplification66.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8e+145) (not (<= t 9.8e+142))) (* (- t) (/ (- y) t)) (fma (/ z a) (- y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8e+145) || !(t <= 9.8e+142)) {
tmp = -t * (-y / t);
} else {
tmp = fma((z / a), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8e+145) || !(t <= 9.8e+142)) tmp = Float64(Float64(-t) * Float64(Float64(-y) / t)); else tmp = fma(Float64(z / a), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8e+145], N[Not[LessEqual[t, 9.8e+142]], $MachinePrecision]], N[((-t) * N[((-y) / t), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+145} \lor \neg \left(t \leq 9.8 \cdot 10^{+142}\right):\\
\;\;\;\;\left(-t\right) \cdot \frac{-y}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\end{array}
\end{array}
if t < -7.9999999999999999e145 or 9.80000000000000101e142 < t Initial program 29.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6461.8
Applied rewrites61.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6464.7
Applied rewrites64.7%
Taylor expanded in t around inf
Applied rewrites60.9%
Taylor expanded in z around 0
Applied rewrites58.8%
if -7.9999999999999999e145 < t < 9.80000000000000101e142Initial program 81.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6488.4
Applied rewrites88.4%
Taylor expanded in t around 0
lower-/.f6461.4
Applied rewrites61.4%
Final simplification60.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8e+145) (not (<= t 9.8e+142))) (* (- t) (/ (- y) t)) (fma (/ (- y x) a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8e+145) || !(t <= 9.8e+142)) {
tmp = -t * (-y / t);
} else {
tmp = fma(((y - x) / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8e+145) || !(t <= 9.8e+142)) tmp = Float64(Float64(-t) * Float64(Float64(-y) / t)); else tmp = fma(Float64(Float64(y - x) / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8e+145], N[Not[LessEqual[t, 9.8e+142]], $MachinePrecision]], N[((-t) * N[((-y) / t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+145} \lor \neg \left(t \leq 9.8 \cdot 10^{+142}\right):\\
\;\;\;\;\left(-t\right) \cdot \frac{-y}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -7.9999999999999999e145 or 9.80000000000000101e142 < t Initial program 29.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6461.8
Applied rewrites61.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6464.7
Applied rewrites64.7%
Taylor expanded in t around inf
Applied rewrites60.9%
Taylor expanded in z around 0
Applied rewrites58.8%
if -7.9999999999999999e145 < t < 9.80000000000000101e142Initial program 81.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6458.6
Applied rewrites58.6%
Final simplification58.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.2e+145) (not (<= t 6.5e+142))) (fma (- 1.0 (/ x y)) y x) (fma (/ (- y x) a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.2e+145) || !(t <= 6.5e+142)) {
tmp = fma((1.0 - (x / y)), y, x);
} else {
tmp = fma(((y - x) / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.2e+145) || !(t <= 6.5e+142)) tmp = fma(Float64(1.0 - Float64(x / y)), y, x); else tmp = fma(Float64(Float64(y - x) / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.2e+145], N[Not[LessEqual[t, 6.5e+142]], $MachinePrecision]], N[(N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+145} \lor \neg \left(t \leq 6.5 \cdot 10^{+142}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{x}{y}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -8.2000000000000003e145 or 6.4999999999999997e142 < t Initial program 29.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6461.8
Applied rewrites61.8%
Taylor expanded in y around inf
Applied rewrites53.4%
Applied rewrites53.4%
Taylor expanded in t around -inf
Applied rewrites46.5%
if -8.2000000000000003e145 < t < 6.4999999999999997e142Initial program 81.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6458.6
Applied rewrites58.6%
Final simplification56.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.8e+146) (not (<= t 1e+143))) (fma 1.0 (- y x) x) (fma (/ (- y x) a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.8e+146) || !(t <= 1e+143)) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = fma(((y - x) / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.8e+146) || !(t <= 1e+143)) tmp = fma(1.0, Float64(y - x), x); else tmp = fma(Float64(Float64(y - x) / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.8e+146], N[Not[LessEqual[t, 1e+143]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+146} \lor \neg \left(t \leq 10^{+143}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -2.8000000000000001e146 or 1e143 < t Initial program 29.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6461.8
Applied rewrites61.8%
Taylor expanded in t around inf
Applied rewrites46.3%
if -2.8000000000000001e146 < t < 1e143Initial program 81.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6458.6
Applied rewrites58.6%
Final simplification56.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.2e+145) (not (<= t 1e+143))) (fma 1.0 (- y x) x) (fma (/ y a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.2e+145) || !(t <= 1e+143)) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = fma((y / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.2e+145) || !(t <= 1e+143)) tmp = fma(1.0, Float64(y - x), x); else tmp = fma(Float64(y / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.2e+145], N[Not[LessEqual[t, 1e+143]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+145} \lor \neg \left(t \leq 10^{+143}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -8.2000000000000003e145 or 1e143 < t Initial program 29.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6461.8
Applied rewrites61.8%
Taylor expanded in t around inf
Applied rewrites46.3%
if -8.2000000000000003e145 < t < 1e143Initial program 81.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6458.6
Applied rewrites58.6%
Taylor expanded in x around 0
Applied rewrites48.0%
Final simplification47.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.6e+33) (not (<= t 9.5e-41))) (fma 1.0 (- y x) x) (* y (/ z a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.6e+33) || !(t <= 9.5e-41)) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = y * (z / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.6e+33) || !(t <= 9.5e-41)) tmp = fma(1.0, Float64(y - x), x); else tmp = Float64(y * Float64(z / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.6e+33], N[Not[LessEqual[t, 9.5e-41]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+33} \lor \neg \left(t \leq 9.5 \cdot 10^{-41}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -5.6000000000000002e33 or 9.4999999999999997e-41 < t Initial program 52.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.9
Applied rewrites73.9%
Taylor expanded in t around inf
Applied rewrites30.9%
if -5.6000000000000002e33 < t < 9.4999999999999997e-41Initial program 88.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.6
Applied rewrites91.6%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.4
Applied rewrites42.4%
Taylor expanded in z around inf
Applied rewrites38.9%
Taylor expanded in t around 0
Applied rewrites32.3%
Final simplification31.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.6e+33) (not (<= t 2.4e-43))) (fma 1.0 (- y x) x) (/ (* y z) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.6e+33) || !(t <= 2.4e-43)) {
tmp = fma(1.0, (y - x), x);
} else {
tmp = (y * z) / a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.6e+33) || !(t <= 2.4e-43)) tmp = fma(1.0, Float64(y - x), x); else tmp = Float64(Float64(y * z) / a); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.6e+33], N[Not[LessEqual[t, 2.4e-43]], $MachinePrecision]], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+33} \lor \neg \left(t \leq 2.4 \cdot 10^{-43}\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\end{array}
\end{array}
if t < -5.6000000000000002e33 or 2.4000000000000002e-43 < t Initial program 52.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.9
Applied rewrites73.9%
Taylor expanded in t around inf
Applied rewrites30.9%
if -5.6000000000000002e33 < t < 2.4000000000000002e-43Initial program 88.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6471.0
Applied rewrites71.0%
Taylor expanded in x around 0
Applied rewrites31.5%
Final simplification31.2%
(FPCore (x y z t a) :precision binary64 (fma 1.0 (- y x) x))
double code(double x, double y, double z, double t, double a) {
return fma(1.0, (y - x), x);
}
function code(x, y, z, t, a) return fma(1.0, Float64(y - x), x) end
code[x_, y_, z_, t_, a_] := N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1, y - x, x\right)
\end{array}
Initial program 71.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.2
Applied rewrites83.2%
Taylor expanded in t around inf
Applied rewrites17.8%
(FPCore (x y z t a) :precision binary64 (fma 1.0 (- x) x))
double code(double x, double y, double z, double t, double a) {
return fma(1.0, -x, x);
}
function code(x, y, z, t, a) return fma(1.0, Float64(-x), x) end
code[x_, y_, z_, t_, a_] := N[(1.0 * (-x) + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1, -x, x\right)
\end{array}
Initial program 71.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.2
Applied rewrites83.2%
Taylor expanded in t around inf
Applied rewrites17.8%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f642.8
Applied rewrites2.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025006
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))