
(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 19 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 -2e-236) (not (<= t_1 0.0)))
(+ x (* (- y x) (/ (- z t) (- a t))))
(fma (/ (* (- y x) (- z a)) t) -1.0 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 <= -2e-236) || !(t_1 <= 0.0)) {
tmp = x + ((y - x) * ((z - t) / (a - t)));
} else {
tmp = fma((((y - x) * (z - a)) / t), -1.0, 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 <= -2e-236) || !(t_1 <= 0.0)) tmp = Float64(x + Float64(Float64(y - x) * Float64(Float64(z - t) / Float64(a - t)))); else tmp = fma(Float64(Float64(Float64(y - x) * Float64(z - a)) / t), -1.0, 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, -2e-236], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(x + N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * -1.0 + 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 -2 \cdot 10^{-236} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(y - x\right) \cdot \left(z - a\right)}{t}, -1, y\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -2.0000000000000001e-236 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 78.6%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.8
Applied rewrites91.8%
if -2.0000000000000001e-236 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 5.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Final simplification92.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_1 -4e+259)
(/ (* x z) t)
(if (or (<= t_1 -1e-194) (not (<= t_1 1e-183))) (+ x y) 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 <= -4e+259) {
tmp = (x * z) / t;
} else if ((t_1 <= -1e-194) || !(t_1 <= 1e-183)) {
tmp = x + y;
} else {
tmp = y;
}
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) * (z - t)) / (a - t))
if (t_1 <= (-4d+259)) then
tmp = (x * z) / t
else if ((t_1 <= (-1d-194)) .or. (.not. (t_1 <= 1d-183))) then
tmp = x + y
else
tmp = y
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) * (z - t)) / (a - t));
double tmp;
if (t_1 <= -4e+259) {
tmp = (x * z) / t;
} else if ((t_1 <= -1e-194) || !(t_1 <= 1e-183)) {
tmp = x + y;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) * (z - t)) / (a - t)) tmp = 0 if t_1 <= -4e+259: tmp = (x * z) / t elif (t_1 <= -1e-194) or not (t_1 <= 1e-183): tmp = x + y else: tmp = 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 <= -4e+259) tmp = Float64(Float64(x * z) / t); elseif ((t_1 <= -1e-194) || !(t_1 <= 1e-183)) tmp = Float64(x + y); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) * (z - t)) / (a - t)); tmp = 0.0; if (t_1 <= -4e+259) tmp = (x * z) / t; elseif ((t_1 <= -1e-194) || ~((t_1 <= 1e-183))) tmp = x + y; else tmp = y; end tmp_2 = 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[LessEqual[t$95$1, -4e+259], N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[t$95$1, -1e-194], N[Not[LessEqual[t$95$1, 1e-183]], $MachinePrecision]], N[(x + y), $MachinePrecision], y]]]
\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 -4 \cdot 10^{+259}:\\
\;\;\;\;\frac{x \cdot z}{t}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-194} \lor \neg \left(t\_1 \leq 10^{-183}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -4e259Initial program 50.8%
Taylor expanded in a around inf
Applied rewrites6.7%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f6430.7
Applied rewrites30.7%
if -4e259 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -1.00000000000000002e-194 or 1.00000000000000001e-183 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 85.8%
Taylor expanded in t around inf
lift--.f6425.0
Applied rewrites25.0%
Taylor expanded in x around 0
Applied rewrites41.0%
if -1.00000000000000002e-194 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 1.00000000000000001e-183Initial program 32.9%
Taylor expanded in t around inf
Applied rewrites50.1%
Final simplification39.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (or (<= t_1 -2e-236) (not (<= t_1 0.0)))
(fma (- y x) (/ (- z t) (- a t)) x)
(fma (/ (* (- y x) (- z a)) t) -1.0 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 <= -2e-236) || !(t_1 <= 0.0)) {
tmp = fma((y - x), ((z - t) / (a - t)), x);
} else {
tmp = fma((((y - x) * (z - a)) / t), -1.0, 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 <= -2e-236) || !(t_1 <= 0.0)) tmp = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x); else tmp = fma(Float64(Float64(Float64(y - x) * Float64(z - a)) / t), -1.0, 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, -2e-236], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * -1.0 + 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 -2 \cdot 10^{-236} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(y - x\right) \cdot \left(z - a\right)}{t}, -1, y\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -2.0000000000000001e-236 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 78.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.8
Applied rewrites91.8%
if -2.0000000000000001e-236 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 5.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Final simplification92.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (or (<= t_1 -2e-236) (not (<= t_1 0.0)))
(fma (- y x) (/ (- z t) (- a t)) x)
(fma (/ (* (- y x) z) t) -1.0 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 <= -2e-236) || !(t_1 <= 0.0)) {
tmp = fma((y - x), ((z - t) / (a - t)), x);
} else {
tmp = fma((((y - x) * z) / t), -1.0, 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 <= -2e-236) || !(t_1 <= 0.0)) tmp = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x); else tmp = fma(Float64(Float64(Float64(y - x) * z) / t), -1.0, 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, -2e-236], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision] * -1.0 + 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 -2 \cdot 10^{-236} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(y - x\right) \cdot z}{t}, -1, y\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -2.0000000000000001e-236 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 78.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.8
Applied rewrites91.8%
if -2.0000000000000001e-236 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 5.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites82.3%
Final simplification91.2%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.28e+92)
(+ x (* (- y x) (/ z a)))
(if (<= a -2.2e-209)
(* y (/ (- z t) (- a t)))
(if (<= a 1.35e+90)
(fma (- z) (/ (- y x) t) y)
(fma (- y x) (/ z a) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.28e+92) {
tmp = x + ((y - x) * (z / a));
} else if (a <= -2.2e-209) {
tmp = y * ((z - t) / (a - t));
} else if (a <= 1.35e+90) {
tmp = fma(-z, ((y - x) / t), y);
} else {
tmp = fma((y - x), (z / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.28e+92) tmp = Float64(x + Float64(Float64(y - x) * Float64(z / a))); elseif (a <= -2.2e-209) tmp = Float64(y * Float64(Float64(z - t) / Float64(a - t))); elseif (a <= 1.35e+90) tmp = fma(Float64(-z), Float64(Float64(y - x) / t), y); else tmp = fma(Float64(y - x), Float64(z / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.28e+92], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -2.2e-209], N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.35e+90], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.28 \cdot 10^{+92}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{a}\\
\mathbf{elif}\;a \leq -2.2 \cdot 10^{-209}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t}\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{y - x}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\end{array}
\end{array}
if a < -1.27999999999999996e92Initial program 73.0%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6489.8
Applied rewrites89.8%
Taylor expanded in t around 0
lower-/.f6472.7
Applied rewrites72.7%
if -1.27999999999999996e92 < a < -2.2000000000000001e-209Initial program 80.8%
Taylor expanded in a around inf
Applied rewrites9.5%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6467.7
Applied rewrites67.7%
if -2.2000000000000001e-209 < a < 1.35e90Initial program 72.7%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites76.1%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6479.8
Applied rewrites79.8%
if 1.35e90 < a Initial program 68.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6491.2
Applied rewrites91.2%
Taylor expanded in t around 0
lower-/.f6466.9
Applied rewrites66.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ z a) x)))
(if (<= a -1.28e+92)
t_1
(if (<= a -2.2e-209)
(* y (/ (- z t) (- a t)))
(if (<= a 1.35e+90) (fma (- z) (/ (- y x) t) y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), (z / a), x);
double tmp;
if (a <= -1.28e+92) {
tmp = t_1;
} else if (a <= -2.2e-209) {
tmp = y * ((z - t) / (a - t));
} else if (a <= 1.35e+90) {
tmp = fma(-z, ((y - x) / t), y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(z / a), x) tmp = 0.0 if (a <= -1.28e+92) tmp = t_1; elseif (a <= -2.2e-209) tmp = Float64(y * Float64(Float64(z - t) / Float64(a - t))); elseif (a <= 1.35e+90) tmp = fma(Float64(-z), Float64(Float64(y - x) / t), y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.28e+92], t$95$1, If[LessEqual[a, -2.2e-209], N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.35e+90], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -1.28 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -2.2 \cdot 10^{-209}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t}\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{y - x}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.27999999999999996e92 or 1.35e90 < a Initial program 70.4%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6490.5
Applied rewrites90.5%
Taylor expanded in t around 0
lower-/.f6469.5
Applied rewrites69.5%
if -1.27999999999999996e92 < a < -2.2000000000000001e-209Initial program 80.8%
Taylor expanded in a around inf
Applied rewrites9.5%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6467.7
Applied rewrites67.7%
if -2.2000000000000001e-209 < a < 1.35e90Initial program 72.7%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites76.1%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6479.8
Applied rewrites79.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y x) t)) (t_2 (fma t_1 a y)))
(if (<= t -4.2e+37)
t_2
(if (<= t 1.18e+24)
(fma (- y x) (/ z a) x)
(if (<= t 2.5e+199) (* (- z) t_1) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - x) / t;
double t_2 = fma(t_1, a, y);
double tmp;
if (t <= -4.2e+37) {
tmp = t_2;
} else if (t <= 1.18e+24) {
tmp = fma((y - x), (z / a), x);
} else if (t <= 2.5e+199) {
tmp = -z * t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - x) / t) t_2 = fma(t_1, a, y) tmp = 0.0 if (t <= -4.2e+37) tmp = t_2; elseif (t <= 1.18e+24) tmp = fma(Float64(y - x), Float64(z / a), x); elseif (t <= 2.5e+199) tmp = Float64(Float64(-z) * t_1); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * a + y), $MachinePrecision]}, If[LessEqual[t, -4.2e+37], t$95$2, If[LessEqual[t, 1.18e+24], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 2.5e+199], N[((-z) * t$95$1), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - x}{t}\\
t_2 := \mathsf{fma}\left(t\_1, a, y\right)\\
\mathbf{if}\;t \leq -4.2 \cdot 10^{+37}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 1.18 \cdot 10^{+24}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+199}:\\
\;\;\;\;\left(-z\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -4.2000000000000002e37 or 2.4999999999999999e199 < t Initial program 49.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites65.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6463.9
Applied rewrites63.9%
if -4.2000000000000002e37 < t < 1.17999999999999997e24Initial program 93.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.8
Applied rewrites96.8%
Taylor expanded in t around 0
lower-/.f6469.0
Applied rewrites69.0%
if 1.17999999999999997e24 < t < 2.4999999999999999e199Initial program 45.1%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites56.4%
Taylor expanded in z around inf
associate-/l*N/A
sub-divN/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6460.5
Applied rewrites60.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- y x) t) a y)))
(if (<= t -4.2e+37)
t_1
(if (<= t 3.7e+39)
(fma (- y x) (/ z a) x)
(if (<= t 2.5e+199) (* (/ (- z a) t) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((y - x) / t), a, y);
double tmp;
if (t <= -4.2e+37) {
tmp = t_1;
} else if (t <= 3.7e+39) {
tmp = fma((y - x), (z / a), x);
} else if (t <= 2.5e+199) {
tmp = ((z - a) / t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(y - x) / t), a, y) tmp = 0.0 if (t <= -4.2e+37) tmp = t_1; elseif (t <= 3.7e+39) tmp = fma(Float64(y - x), Float64(z / a), x); elseif (t <= 2.5e+199) tmp = Float64(Float64(Float64(z - a) / t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * a + y), $MachinePrecision]}, If[LessEqual[t, -4.2e+37], t$95$1, If[LessEqual[t, 3.7e+39], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 2.5e+199], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - x}{t}, a, y\right)\\
\mathbf{if}\;t \leq -4.2 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+199}:\\
\;\;\;\;\frac{z - a}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.2000000000000002e37 or 2.4999999999999999e199 < t Initial program 49.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites65.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6463.9
Applied rewrites63.9%
if -4.2000000000000002e37 < t < 3.70000000000000012e39Initial program 93.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.8
Applied rewrites96.8%
Taylor expanded in t around 0
lower-/.f6468.3
Applied rewrites68.3%
if 3.70000000000000012e39 < t < 2.4999999999999999e199Initial program 37.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites50.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6449.2
Applied rewrites49.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- y x) t) a y)))
(if (<= t -4.2e+37)
t_1
(if (<= t 3.7e+39)
(fma z (/ (- y x) a) x)
(if (<= t 2.5e+199) (* (/ (- z a) t) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((y - x) / t), a, y);
double tmp;
if (t <= -4.2e+37) {
tmp = t_1;
} else if (t <= 3.7e+39) {
tmp = fma(z, ((y - x) / a), x);
} else if (t <= 2.5e+199) {
tmp = ((z - a) / t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(y - x) / t), a, y) tmp = 0.0 if (t <= -4.2e+37) tmp = t_1; elseif (t <= 3.7e+39) tmp = fma(z, Float64(Float64(y - x) / a), x); elseif (t <= 2.5e+199) tmp = Float64(Float64(Float64(z - a) / t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * a + y), $MachinePrecision]}, If[LessEqual[t, -4.2e+37], t$95$1, If[LessEqual[t, 3.7e+39], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 2.5e+199], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - x}{t}, a, y\right)\\
\mathbf{if}\;t \leq -4.2 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+199}:\\
\;\;\;\;\frac{z - a}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.2000000000000002e37 or 2.4999999999999999e199 < t Initial program 49.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites65.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6463.9
Applied rewrites63.9%
if -4.2000000000000002e37 < t < 3.70000000000000012e39Initial program 93.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6466.4
Applied rewrites66.4%
if 3.70000000000000012e39 < t < 2.4999999999999999e199Initial program 37.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites50.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6449.2
Applied rewrites49.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- y x) t) a y)))
(if (<= t -5.5e+36)
t_1
(if (<= t 2.35e+39)
(fma y (/ z a) x)
(if (<= t 2.5e+199) (* (/ (- z a) t) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((y - x) / t), a, y);
double tmp;
if (t <= -5.5e+36) {
tmp = t_1;
} else if (t <= 2.35e+39) {
tmp = fma(y, (z / a), x);
} else if (t <= 2.5e+199) {
tmp = ((z - a) / t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(y - x) / t), a, y) tmp = 0.0 if (t <= -5.5e+36) tmp = t_1; elseif (t <= 2.35e+39) tmp = fma(y, Float64(z / a), x); elseif (t <= 2.5e+199) tmp = Float64(Float64(Float64(z - a) / t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * a + y), $MachinePrecision]}, If[LessEqual[t, -5.5e+36], t$95$1, If[LessEqual[t, 2.35e+39], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 2.5e+199], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - x}{t}, a, y\right)\\
\mathbf{if}\;t \leq -5.5 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.35 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+199}:\\
\;\;\;\;\frac{z - a}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.5000000000000002e36 or 2.4999999999999999e199 < t Initial program 49.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites65.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6463.9
Applied rewrites63.9%
if -5.5000000000000002e36 < t < 2.35e39Initial program 93.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.8
Applied rewrites96.8%
Taylor expanded in t around 0
lower-/.f6468.3
Applied rewrites68.3%
Taylor expanded in x around 0
Applied rewrites54.5%
if 2.35e39 < t < 2.4999999999999999e199Initial program 37.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites50.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6449.2
Applied rewrites49.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.5e+36) (not (<= t 4.8e+23))) (fma (- z) (/ (- y x) t) y) (+ x (* (- y x) (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.5e+36) || !(t <= 4.8e+23)) {
tmp = fma(-z, ((y - x) / t), y);
} else {
tmp = x + ((y - x) * (z / (a - t)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.5e+36) || !(t <= 4.8e+23)) tmp = fma(Float64(-z), Float64(Float64(y - x) / t), y); else tmp = Float64(x + Float64(Float64(y - x) * Float64(z / Float64(a - t)))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.5e+36], N[Not[LessEqual[t, 4.8e+23]], $MachinePrecision]], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{+36} \lor \neg \left(t \leq 4.8 \cdot 10^{+23}\right):\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{y - x}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -5.5000000000000002e36 or 4.8e23 < t Initial program 48.4%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites63.2%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6470.8
Applied rewrites70.8%
if -5.5000000000000002e36 < t < 4.8e23Initial program 93.3%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.8
Applied rewrites96.8%
Taylor expanded in z around inf
Applied rewrites85.3%
Final simplification79.0%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.2e+37)
y
(if (<= t 2.35e+39)
(fma y (/ z a) x)
(if (<= t 2.7e+199) (* (/ (- z a) t) x) y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.2e+37) {
tmp = y;
} else if (t <= 2.35e+39) {
tmp = fma(y, (z / a), x);
} else if (t <= 2.7e+199) {
tmp = ((z - a) / t) * x;
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.2e+37) tmp = y; elseif (t <= 2.35e+39) tmp = fma(y, Float64(z / a), x); elseif (t <= 2.7e+199) tmp = Float64(Float64(Float64(z - a) / t) * x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.2e+37], y, If[LessEqual[t, 2.35e+39], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 2.7e+199], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], y]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+37}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 2.35 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+199}:\\
\;\;\;\;\frac{z - a}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -4.2000000000000002e37 or 2.6999999999999999e199 < t Initial program 49.3%
Taylor expanded in t around inf
Applied rewrites55.3%
if -4.2000000000000002e37 < t < 2.35e39Initial program 93.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.8
Applied rewrites96.8%
Taylor expanded in t around 0
lower-/.f6468.3
Applied rewrites68.3%
Taylor expanded in x around 0
Applied rewrites54.5%
if 2.35e39 < t < 2.6999999999999999e199Initial program 37.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites50.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6449.2
Applied rewrites49.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.5e+36) (not (<= t 4.8e+23))) (fma (- z) (/ (- y x) t) y) (fma (- y x) (/ z (- a t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.5e+36) || !(t <= 4.8e+23)) {
tmp = fma(-z, ((y - x) / t), y);
} else {
tmp = fma((y - x), (z / (a - t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.5e+36) || !(t <= 4.8e+23)) tmp = fma(Float64(-z), Float64(Float64(y - x) / t), y); else tmp = fma(Float64(y - x), Float64(z / Float64(a - t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.5e+36], N[Not[LessEqual[t, 4.8e+23]], $MachinePrecision]], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{+36} \lor \neg \left(t \leq 4.8 \cdot 10^{+23}\right):\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{y - x}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a - t}, x\right)\\
\end{array}
\end{array}
if t < -5.5000000000000002e36 or 4.8e23 < t Initial program 48.4%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites63.2%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6470.8
Applied rewrites70.8%
if -5.5000000000000002e36 < t < 4.8e23Initial program 93.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.8
Applied rewrites96.8%
Taylor expanded in z around inf
Applied rewrites85.2%
Final simplification79.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.32e-43) (not (<= a 1.62e+72))) (fma (- y x) (/ (- z t) a) x) (fma (- z) (/ (- y x) t) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.32e-43) || !(a <= 1.62e+72)) {
tmp = fma((y - x), ((z - t) / a), x);
} else {
tmp = fma(-z, ((y - x) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.32e-43) || !(a <= 1.62e+72)) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); else tmp = fma(Float64(-z), Float64(Float64(y - x) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.32e-43], N[Not[LessEqual[a, 1.62e+72]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.32 \cdot 10^{-43} \lor \neg \left(a \leq 1.62 \cdot 10^{+72}\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{y - x}{t}, y\right)\\
\end{array}
\end{array}
if a < -1.32000000000000002e-43 or 1.62000000000000008e72 < a Initial program 75.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6476.3
Applied rewrites76.3%
if -1.32000000000000002e-43 < a < 1.62000000000000008e72Initial program 72.3%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites74.4%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6475.8
Applied rewrites75.8%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.35e-43) (not (<= a 1.35e+90))) (fma (- y x) (/ z a) x) (fma (- z) (/ (- y x) t) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.35e-43) || !(a <= 1.35e+90)) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = fma(-z, ((y - x) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.35e-43) || !(a <= 1.35e+90)) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = fma(Float64(-z), Float64(Float64(y - x) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.35e-43], N[Not[LessEqual[a, 1.35e+90]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.35 \cdot 10^{-43} \lor \neg \left(a \leq 1.35 \cdot 10^{+90}\right):\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{y - x}{t}, y\right)\\
\end{array}
\end{array}
if a < -3.3499999999999999e-43 or 1.35e90 < a Initial program 75.7%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6490.8
Applied rewrites90.8%
Taylor expanded in t around 0
lower-/.f6465.1
Applied rewrites65.1%
if -3.3499999999999999e-43 < a < 1.35e90Initial program 72.5%
Taylor expanded in t around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites72.9%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6475.1
Applied rewrites75.1%
Final simplification70.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -4.2e+37) y (if (<= t 7.5e+23) (fma y (/ z a) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.2e+37) {
tmp = y;
} else if (t <= 7.5e+23) {
tmp = fma(y, (z / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.2e+37) tmp = y; elseif (t <= 7.5e+23) tmp = fma(y, Float64(z / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.2e+37], y, If[LessEqual[t, 7.5e+23], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+37}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -4.2000000000000002e37 or 7.49999999999999987e23 < t Initial program 48.4%
Taylor expanded in t around inf
Applied rewrites47.5%
if -4.2000000000000002e37 < t < 7.49999999999999987e23Initial program 93.3%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.8
Applied rewrites96.8%
Taylor expanded in t around 0
lower-/.f6469.0
Applied rewrites69.0%
Taylor expanded in x around 0
Applied rewrites54.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e+63) (not (<= z 7.5e+72))) (/ (* y z) a) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+63) || !(z <= 7.5e+72)) {
tmp = (y * z) / a;
} else {
tmp = x + y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.35d+63)) .or. (.not. (z <= 7.5d+72))) then
tmp = (y * z) / a
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+63) || !(z <= 7.5e+72)) {
tmp = (y * z) / a;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.35e+63) or not (z <= 7.5e+72): tmp = (y * z) / a else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e+63) || !(z <= 7.5e+72)) tmp = Float64(Float64(y * z) / a); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.35e+63) || ~((z <= 7.5e+72))) tmp = (y * z) / a; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.35e+63], N[Not[LessEqual[z, 7.5e+72]], $MachinePrecision]], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+63} \lor \neg \left(z \leq 7.5 \cdot 10^{+72}\right):\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.35000000000000009e63 or 7.50000000000000027e72 < z Initial program 75.9%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6450.6
Applied rewrites50.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6427.9
Applied rewrites27.9%
if -1.35000000000000009e63 < z < 7.50000000000000027e72Initial program 72.5%
Taylor expanded in t around inf
lift--.f6429.8
Applied rewrites29.8%
Taylor expanded in x around 0
Applied rewrites47.8%
Final simplification39.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.8e+91) x (if (<= a 3.15e+91) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.8e+91) {
tmp = x;
} else if (a <= 3.15e+91) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-3.8d+91)) then
tmp = x
else if (a <= 3.15d+91) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.8e+91) {
tmp = x;
} else if (a <= 3.15e+91) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.8e+91: tmp = x elif a <= 3.15e+91: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.8e+91) tmp = x; elseif (a <= 3.15e+91) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.8e+91) tmp = x; elseif (a <= 3.15e+91) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.8e+91], x, If[LessEqual[a, 3.15e+91], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{+91}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.15 \cdot 10^{+91}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.7999999999999998e91 or 3.15e91 < a Initial program 70.7%
Taylor expanded in a around inf
Applied rewrites45.5%
if -3.7999999999999998e91 < a < 3.15e91Initial program 75.7%
Taylor expanded in t around inf
Applied rewrites34.1%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 74.0%
Taylor expanded in a around inf
Applied rewrites20.0%
(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 2025051
(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))))