
(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 17 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-304) (not (<= t_1 0.0)))
(fma (/ (- z t) (- a t)) (- y x) x)
(+ (/ (* (- y x) (- z a)) (- t)) y))))
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-304) || !(t_1 <= 0.0)) {
tmp = fma(((z - t) / (a - t)), (y - x), x);
} else {
tmp = (((y - x) * (z - a)) / -t) + y;
}
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-304) || !(t_1 <= 0.0)) tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); else tmp = Float64(Float64(Float64(Float64(y - x) * Float64(z - a)) / Float64(-t)) + y); 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-304], 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[(N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / (-t)), $MachinePrecision] + y), $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^{-304} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot \left(z - a\right)}{-t} + y\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -9.99999999999999971e-305 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 71.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
if -9.99999999999999971e-305 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 4.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f644.7
Applied rewrites4.7%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
associate-*r/N/A
Applied rewrites99.9%
Final simplification91.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (or (<= t_1 -1e-304) (not (<= t_1 0.0)))
(fma (/ (- z t) (- a t)) (- y x) x)
(fma (/ (fma -1.0 y x) t) (- z a) y))))
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-304) || !(t_1 <= 0.0)) {
tmp = fma(((z - t) / (a - t)), (y - x), x);
} else {
tmp = fma((fma(-1.0, y, x) / t), (z - a), y);
}
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-304) || !(t_1 <= 0.0)) tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); else tmp = fma(Float64(fma(-1.0, y, x) / t), Float64(z - a), y); 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-304], 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[(N[(N[(-1.0 * y + x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $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^{-304} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-1, y, x\right)}{t}, z - a, y\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -9.99999999999999971e-305 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 71.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
if -9.99999999999999971e-305 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 4.7%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites88.4%
Final simplification90.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- y) (/ (- z t) t))) (t_2 (fma (- z t) (/ y a) x)))
(if (<= a -1.1e+115)
t_2
(if (<= a -7.2e-267)
t_1
(if (<= a 1.95e-284)
(* (- x) (/ z (- a t)))
(if (<= a 6.9e-47)
t_1
(if (<= a 2e+51) (fma (/ (- y x) a) z x) t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y * ((z - t) / t);
double t_2 = fma((z - t), (y / a), x);
double tmp;
if (a <= -1.1e+115) {
tmp = t_2;
} else if (a <= -7.2e-267) {
tmp = t_1;
} else if (a <= 1.95e-284) {
tmp = -x * (z / (a - t));
} else if (a <= 6.9e-47) {
tmp = t_1;
} else if (a <= 2e+51) {
tmp = fma(((y - x) / a), z, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) * Float64(Float64(z - t) / t)) t_2 = fma(Float64(z - t), Float64(y / a), x) tmp = 0.0 if (a <= -1.1e+115) tmp = t_2; elseif (a <= -7.2e-267) tmp = t_1; elseif (a <= 1.95e-284) tmp = Float64(Float64(-x) * Float64(z / Float64(a - t))); elseif (a <= 6.9e-47) tmp = t_1; elseif (a <= 2e+51) tmp = fma(Float64(Float64(y - x) / a), z, x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.1e+115], t$95$2, If[LessEqual[a, -7.2e-267], t$95$1, If[LessEqual[a, 1.95e-284], N[((-x) * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.9e-47], t$95$1, If[LessEqual[a, 2e+51], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot \frac{z - t}{t}\\
t_2 := \mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\mathbf{if}\;a \leq -1.1 \cdot 10^{+115}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq -7.2 \cdot 10^{-267}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.95 \cdot 10^{-284}:\\
\;\;\;\;\left(-x\right) \cdot \frac{z}{a - t}\\
\mathbf{elif}\;a \leq 6.9 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -1.1e115 or 2e51 < a Initial program 63.3%
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--.f6486.7
Applied rewrites86.7%
Taylor expanded in x around 0
Applied rewrites82.4%
if -1.1e115 < a < -7.2000000000000002e-267 or 1.9499999999999999e-284 < a < 6.89999999999999994e-47Initial program 65.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.1
Applied rewrites80.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in a around 0
Applied rewrites59.1%
if -7.2000000000000002e-267 < a < 1.9499999999999999e-284Initial program 49.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.7
Applied rewrites42.7%
Taylor expanded in z around inf
Applied rewrites71.6%
if 6.89999999999999994e-47 < a < 2e51Initial program 86.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6468.8
Applied rewrites68.8%
Final simplification69.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z t) (/ y a) x)))
(if (<= a -16000.0)
t_1
(if (<= a 6.5e-276)
(* (- y x) (/ z (- a t)))
(if (<= a 6.9e-47)
(* (- y) (/ (- z t) t))
(if (<= a 2e+51) (fma (/ (- y x) a) z x) 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 <= -16000.0) {
tmp = t_1;
} else if (a <= 6.5e-276) {
tmp = (y - x) * (z / (a - t));
} else if (a <= 6.9e-47) {
tmp = -y * ((z - t) / t);
} else if (a <= 2e+51) {
tmp = fma(((y - x) / a), z, x);
} 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 <= -16000.0) tmp = t_1; elseif (a <= 6.5e-276) tmp = Float64(Float64(y - x) * Float64(z / Float64(a - t))); elseif (a <= 6.9e-47) tmp = Float64(Float64(-y) * Float64(Float64(z - t) / t)); elseif (a <= 2e+51) tmp = fma(Float64(Float64(y - x) / a), z, x); 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, -16000.0], t$95$1, If[LessEqual[a, 6.5e-276], N[(N[(y - x), $MachinePrecision] * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.9e-47], N[((-y) * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2e+51], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $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 -16000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{-276}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{a - t}\\
\mathbf{elif}\;a \leq 6.9 \cdot 10^{-47}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z - t}{t}\\
\mathbf{elif}\;a \leq 2 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -16000 or 2e51 < a Initial program 65.5%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6481.7
Applied rewrites81.7%
Taylor expanded in x around 0
Applied rewrites77.3%
if -16000 < a < 6.49999999999999981e-276Initial program 63.7%
Taylor expanded in z 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--.f6465.0
Applied rewrites65.0%
if 6.49999999999999981e-276 < a < 6.89999999999999994e-47Initial program 58.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6453.1
Applied rewrites53.1%
Taylor expanded in a around 0
Applied rewrites70.1%
if 6.89999999999999994e-47 < a < 2e51Initial program 86.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6468.8
Applied rewrites68.8%
Final simplification71.6%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.95e-25)
(+ x (* (/ (- z t) a) (- y x)))
(if (<= a 6.5e-276)
(* (- y x) (/ z (- a t)))
(if (<= a 2.1e-47)
(* (- y) (/ (- z t) t))
(fma (- z t) (/ (- y x) a) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.95e-25) {
tmp = x + (((z - t) / a) * (y - x));
} else if (a <= 6.5e-276) {
tmp = (y - x) * (z / (a - t));
} else if (a <= 2.1e-47) {
tmp = -y * ((z - t) / t);
} else {
tmp = fma((z - t), ((y - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.95e-25) tmp = Float64(x + Float64(Float64(Float64(z - t) / a) * Float64(y - x))); elseif (a <= 6.5e-276) tmp = Float64(Float64(y - x) * Float64(z / Float64(a - t))); elseif (a <= 2.1e-47) tmp = Float64(Float64(-y) * Float64(Float64(z - t) / t)); else tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.95e-25], N[(x + N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.5e-276], N[(N[(y - x), $MachinePrecision] * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.1e-47], N[((-y) * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.95 \cdot 10^{-25}:\\
\;\;\;\;x + \frac{z - t}{a} \cdot \left(y - x\right)\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{-276}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{a - t}\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-47}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z - t}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\end{array}
\end{array}
if a < -1.95e-25Initial program 67.5%
Taylor expanded in a around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6478.6
Applied rewrites78.6%
if -1.95e-25 < a < 6.49999999999999981e-276Initial program 63.3%
Taylor expanded in z 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--.f6468.4
Applied rewrites68.4%
if 6.49999999999999981e-276 < a < 2.1000000000000001e-47Initial program 58.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6453.1
Applied rewrites53.1%
Taylor expanded in a around 0
Applied rewrites70.1%
if 2.1000000000000001e-47 < a Initial program 70.7%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6481.3
Applied rewrites81.3%
Final simplification74.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z t) (/ (- y x) a) x)))
(if (<= a -1.65e-25)
t_1
(if (<= a 6.5e-276)
(* (- y x) (/ z (- a t)))
(if (<= a 2.1e-47) (* (- y) (/ (- z t) t)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z - t), ((y - x) / a), x);
double tmp;
if (a <= -1.65e-25) {
tmp = t_1;
} else if (a <= 6.5e-276) {
tmp = (y - x) * (z / (a - t));
} else if (a <= 2.1e-47) {
tmp = -y * ((z - t) / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z - t), Float64(Float64(y - x) / a), x) tmp = 0.0 if (a <= -1.65e-25) tmp = t_1; elseif (a <= 6.5e-276) tmp = Float64(Float64(y - x) * Float64(z / Float64(a - t))); elseif (a <= 2.1e-47) tmp = Float64(Float64(-y) * Float64(Float64(z - t) / 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[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.65e-25], t$95$1, If[LessEqual[a, 6.5e-276], N[(N[(y - x), $MachinePrecision] * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.1e-47], N[((-y) * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.65 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{-276}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{a - t}\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-47}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z - t}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.6499999999999999e-25 or 2.1000000000000001e-47 < a Initial program 69.0%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6478.7
Applied rewrites78.7%
if -1.6499999999999999e-25 < a < 6.49999999999999981e-276Initial program 63.3%
Taylor expanded in z 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--.f6468.4
Applied rewrites68.4%
if 6.49999999999999981e-276 < a < 2.1000000000000001e-47Initial program 58.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6453.1
Applied rewrites53.1%
Taylor expanded in a around 0
Applied rewrites70.1%
Final simplification74.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4e+219)
(* (- y) (/ (- z t) t))
(if (or (<= t -430000.0) (not (<= t 2.7e-73)))
(* (- 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 (t <= -4e+219) {
tmp = -y * ((z - t) / t);
} else if ((t <= -430000.0) || !(t <= 2.7e-73)) {
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 (t <= -4e+219) tmp = Float64(Float64(-y) * Float64(Float64(z - t) / t)); elseif ((t <= -430000.0) || !(t <= 2.7e-73)) 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[LessEqual[t, -4e+219], N[((-y) * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -430000.0], N[Not[LessEqual[t, 2.7e-73]], $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}\;t \leq -4 \cdot 10^{+219}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z - t}{t}\\
\mathbf{elif}\;t \leq -430000 \lor \neg \left(t \leq 2.7 \cdot 10^{-73}\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 t < -3.99999999999999986e219Initial program 27.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6458.8
Applied rewrites58.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6449.0
Applied rewrites49.0%
Taylor expanded in a around 0
Applied rewrites74.8%
if -3.99999999999999986e219 < t < -4.3e5 or 2.69999999999999994e-73 < t Initial program 51.7%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6462.9
Applied rewrites62.9%
if -4.3e5 < t < 2.69999999999999994e-73Initial program 87.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in t around 0
lower-/.f6477.5
Applied rewrites77.5%
Final simplification70.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y x) x)))
(if (<= t -1.3e+20)
t_1
(if (<= t 7e-131)
(fma (/ (- y x) a) z x)
(if (<= t 1.85e+134) (fma (- z t) (/ y a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / x) * x;
double tmp;
if (t <= -1.3e+20) {
tmp = t_1;
} else if (t <= 7e-131) {
tmp = fma(((y - x) / a), z, x);
} else if (t <= 1.85e+134) {
tmp = fma((z - t), (y / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y / x) * x) tmp = 0.0 if (t <= -1.3e+20) tmp = t_1; elseif (t <= 7e-131) tmp = fma(Float64(Float64(y - x) / a), z, x); elseif (t <= 1.85e+134) tmp = fma(Float64(z - t), Float64(y / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -1.3e+20], t$95$1, If[LessEqual[t, 7e-131], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[t, 1.85e+134], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{x} \cdot x\\
\mathbf{if}\;t \leq -1.3 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-131}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{+134}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.3e20 or 1.85000000000000007e134 < t Initial program 40.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites57.5%
Taylor expanded in t around inf
Applied rewrites44.0%
if -1.3e20 < t < 7.0000000000000004e-131Initial program 85.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6478.4
Applied rewrites78.4%
if 7.0000000000000004e-131 < t < 1.85000000000000007e134Initial program 74.5%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6460.9
Applied rewrites60.9%
Taylor expanded in x around 0
Applied rewrites56.9%
Final simplification60.4%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.4e-66)
(+ x (* (/ (- z t) a) (- y x)))
(if (<= a 5.9e-46)
(fma (/ (fma -1.0 y x) t) (- z a) y)
(fma (- z t) (/ (- y x) a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.4e-66) {
tmp = x + (((z - t) / a) * (y - x));
} else if (a <= 5.9e-46) {
tmp = fma((fma(-1.0, y, x) / t), (z - a), y);
} else {
tmp = fma((z - t), ((y - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.4e-66) tmp = Float64(x + Float64(Float64(Float64(z - t) / a) * Float64(y - x))); elseif (a <= 5.9e-46) tmp = fma(Float64(fma(-1.0, y, x) / t), Float64(z - a), y); else tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.4e-66], N[(x + N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.9e-46], N[(N[(N[(-1.0 * y + x), $MachinePrecision] / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + y), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-66}:\\
\;\;\;\;x + \frac{z - t}{a} \cdot \left(y - x\right)\\
\mathbf{elif}\;a \leq 5.9 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-1, y, x\right)}{t}, z - a, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\end{array}
\end{array}
if a < -2.40000000000000026e-66Initial program 68.8%
Taylor expanded in a around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.2
Applied rewrites76.2%
if -2.40000000000000026e-66 < a < 5.8999999999999999e-46Initial program 60.0%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites84.5%
if 5.8999999999999999e-46 < a Initial program 70.7%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6481.3
Applied rewrites81.3%
Final simplification81.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y x) x)))
(if (<= t -6.5e+18)
t_1
(if (<= t 6.4e-118)
(fma (- x) (/ z a) x)
(if (<= t 4.2e+88) (fma (/ y a) z x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / x) * x;
double tmp;
if (t <= -6.5e+18) {
tmp = t_1;
} else if (t <= 6.4e-118) {
tmp = fma(-x, (z / a), x);
} else if (t <= 4.2e+88) {
tmp = fma((y / a), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y / x) * x) tmp = 0.0 if (t <= -6.5e+18) tmp = t_1; elseif (t <= 6.4e-118) tmp = fma(Float64(-x), Float64(z / a), x); elseif (t <= 4.2e+88) tmp = fma(Float64(y / a), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -6.5e+18], t$95$1, If[LessEqual[t, 6.4e-118], N[((-x) * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 4.2e+88], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{x} \cdot x\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.4 \cdot 10^{-118}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{z}{a}, x\right)\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.5e18 or 4.2e88 < t Initial program 39.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.9%
Taylor expanded in t around inf
Applied rewrites43.1%
if -6.5e18 < t < 6.40000000000000008e-118Initial program 85.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6477.0
Applied rewrites77.0%
Taylor expanded in y around 0
Applied rewrites62.0%
if 6.40000000000000008e-118 < t < 4.2e88Initial program 79.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6445.4
Applied rewrites45.4%
Taylor expanded in x around 0
Applied rewrites40.5%
Final simplification50.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.4e-95) (not (<= a 2.4e-61))) (fma (- z t) (/ y a) x) (* (/ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.4e-95) || !(a <= 2.4e-61)) {
tmp = fma((z - t), (y / a), x);
} else {
tmp = (y / x) * x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.4e-95) || !(a <= 2.4e-61)) tmp = fma(Float64(z - t), Float64(y / a), x); else tmp = Float64(Float64(y / x) * x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.4e-95], N[Not[LessEqual[a, 2.4e-61]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-95} \lor \neg \left(a \leq 2.4 \cdot 10^{-61}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} \cdot x\\
\end{array}
\end{array}
if a < -2.4e-95 or 2.4000000000000001e-61 < a Initial program 69.1%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6476.0
Applied rewrites76.0%
Taylor expanded in x around 0
Applied rewrites65.9%
if -2.4e-95 < a < 2.4000000000000001e-61Initial program 60.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites63.3%
Taylor expanded in t around inf
Applied rewrites37.9%
Final simplification54.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7.8e+20) (not (<= t 4.2e+88))) (* (/ y x) x) (fma (/ y a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7.8e+20) || !(t <= 4.2e+88)) {
tmp = (y / x) * x;
} else {
tmp = fma((y / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7.8e+20) || !(t <= 4.2e+88)) tmp = Float64(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, -7.8e+20], N[Not[LessEqual[t, 4.2e+88]], $MachinePrecision]], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.8 \cdot 10^{+20} \lor \neg \left(t \leq 4.2 \cdot 10^{+88}\right):\\
\;\;\;\;\frac{y}{x} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -7.8e20 or 4.2e88 < t Initial program 39.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.5%
Taylor expanded in t around inf
Applied rewrites43.4%
if -7.8e20 < t < 4.2e88Initial program 83.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6466.9
Applied rewrites66.9%
Taylor expanded in x around 0
Applied rewrites52.0%
Final simplification48.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.1e+115) (not (<= a 2.9e-18))) (fma x (/ t a) x) (* (/ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.1e+115) || !(a <= 2.9e-18)) {
tmp = fma(x, (t / a), x);
} else {
tmp = (y / x) * x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.1e+115) || !(a <= 2.9e-18)) tmp = fma(x, Float64(t / a), x); else tmp = Float64(Float64(y / x) * x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.1e+115], N[Not[LessEqual[a, 2.9e-18]], $MachinePrecision]], N[(x * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{+115} \lor \neg \left(a \leq 2.9 \cdot 10^{-18}\right):\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} \cdot x\\
\end{array}
\end{array}
if a < -1.1e115 or 2.9e-18 < a Initial program 66.9%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6453.3
Applied rewrites53.3%
Taylor expanded in a around inf
Applied rewrites52.6%
Taylor expanded in z around 0
Applied rewrites44.5%
if -1.1e115 < a < 2.9e-18Initial program 64.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.0%
Taylor expanded in t around inf
Applied rewrites34.4%
Final simplification38.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.3e-130) (not (<= t 4.9e+82))) (* (/ y x) x) (/ (* y z) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.3e-130) || !(t <= 4.9e+82)) {
tmp = (y / x) * x;
} else {
tmp = (y * z) / 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 ((t <= (-3.3d-130)) .or. (.not. (t <= 4.9d+82))) then
tmp = (y / x) * x
else
tmp = (y * z) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.3e-130) || !(t <= 4.9e+82)) {
tmp = (y / x) * x;
} else {
tmp = (y * z) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.3e-130) or not (t <= 4.9e+82): tmp = (y / x) * x else: tmp = (y * z) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.3e-130) || !(t <= 4.9e+82)) tmp = Float64(Float64(y / x) * x); else tmp = Float64(Float64(y * z) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.3e-130) || ~((t <= 4.9e+82))) tmp = (y / x) * x; else tmp = (y * z) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.3e-130], N[Not[LessEqual[t, 4.9e+82]], $MachinePrecision]], N[(N[(y / x), $MachinePrecision] * x), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{-130} \lor \neg \left(t \leq 4.9 \cdot 10^{+82}\right):\\
\;\;\;\;\frac{y}{x} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\end{array}
\end{array}
if t < -3.2999999999999998e-130 or 4.9000000000000001e82 < t Initial program 47.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites62.8%
Taylor expanded in t around inf
Applied rewrites36.8%
if -3.2999999999999998e-130 < t < 4.9000000000000001e82Initial program 85.7%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6469.2
Applied rewrites69.2%
Taylor expanded in x around 0
Applied rewrites22.0%
Final simplification29.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.95e-114) (not (<= t 530000000.0))) (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 <= -2.95e-114) || !(t <= 530000000.0)) {
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 <= -2.95e-114) || !(t <= 530000000.0)) 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, -2.95e-114], N[Not[LessEqual[t, 530000000.0]], $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 -2.95 \cdot 10^{-114} \lor \neg \left(t \leq 530000000\right):\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\end{array}
\end{array}
if t < -2.9500000000000001e-114 or 5.3e8 < t Initial program 49.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6476.4
Applied rewrites76.4%
Taylor expanded in t around inf
Applied rewrites28.5%
if -2.9500000000000001e-114 < t < 5.3e8Initial program 87.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6475.9
Applied rewrites75.9%
Taylor expanded in x around 0
Applied rewrites22.4%
Final simplification25.9%
(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 65.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
Taylor expanded in t around inf
Applied rewrites17.8%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 65.5%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6440.0
Applied rewrites40.0%
Taylor expanded in t around inf
Applied rewrites2.9%
Taylor expanded in x around 0
Applied rewrites2.9%
Final simplification2.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024363
(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))))