
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -2e-299)
(fma (/ (- z y) (- z a)) (- t x) x)
(if (<= t_1 2e-298)
(fma (/ (- t x) z) (- a y) t)
(fma (/ (- x t) (- z a)) (- y z) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -2e-299) {
tmp = fma(((z - y) / (z - a)), (t - x), x);
} else if (t_1 <= 2e-298) {
tmp = fma(((t - x) / z), (a - y), t);
} else {
tmp = fma(((x - t) / (z - a)), (y - z), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= -2e-299) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x); elseif (t_1 <= 2e-298) tmp = fma(Float64(Float64(t - x) / z), Float64(a - y), t); else tmp = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-299], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2e-298], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(a - y), $MachinePrecision] + t), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-299}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-298}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a - y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.99999999999999998e-299Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.2%
if -1.99999999999999998e-299 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.99999999999999982e-298Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negateN/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-out--N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites51.8%
if 1.99999999999999982e-298 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites80.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x t) (- z a)) (- y z) x))
(t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -2e-299)
t_1
(if (<= t_2 2e-298) (fma (/ (- t x) z) (- a y) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - t) / (z - a)), (y - z), x);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -2e-299) {
tmp = t_1;
} else if (t_2 <= 2e-298) {
tmp = fma(((t - x) / z), (a - y), t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -2e-299) tmp = t_1; elseif (t_2 <= 2e-298) tmp = fma(Float64(Float64(t - x) / z), Float64(a - y), t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-299], t$95$1, If[LessEqual[t$95$2, 2e-298], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(a - y), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-299}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-298}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a - y, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.99999999999999998e-299 or 1.99999999999999982e-298 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites80.4%
if -1.99999999999999998e-299 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.99999999999999982e-298Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negateN/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-out--N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites51.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.8e+180)
(fma (- x t) (/ (- y a) z) t)
(if (<= z -2.9e-120)
(fma (/ (- z y) (- z a)) t x)
(if (<= z 2.5e-30)
(+ x (/ (* y (- t x)) (- a z)))
(fma (/ (- t x) z) (- a y) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.8e+180) {
tmp = fma((x - t), ((y - a) / z), t);
} else if (z <= -2.9e-120) {
tmp = fma(((z - y) / (z - a)), t, x);
} else if (z <= 2.5e-30) {
tmp = x + ((y * (t - x)) / (a - z));
} else {
tmp = fma(((t - x) / z), (a - y), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.8e+180) tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); elseif (z <= -2.9e-120) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), t, x); elseif (z <= 2.5e-30) tmp = Float64(x + Float64(Float64(y * Float64(t - x)) / Float64(a - z))); else tmp = fma(Float64(Float64(t - x) / z), Float64(a - y), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.8e+180], N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, -2.9e-120], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 2.5e-30], N[(x + N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(a - y), $MachinePrecision] + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+180}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-120}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t, x\right)\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-30}:\\
\;\;\;\;x + \frac{y \cdot \left(t - x\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a - y, t\right)\\
\end{array}
\end{array}
if z < -4.7999999999999997e180Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites52.9%
if -4.7999999999999997e180 < z < -2.9e-120Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.2%
Taylor expanded in x around 0
Applied rewrites67.7%
if -2.9e-120 < z < 2.49999999999999986e-30Initial program 80.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6455.5
Applied rewrites55.5%
if 2.49999999999999986e-30 < z Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negateN/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-out--N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites51.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) (- z a)) t x)))
(if (<= a -9e-19)
t_1
(if (<= a 4.5e+70) (fma (- x t) (/ (- y a) z) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / (z - a)), t, x);
double tmp;
if (a <= -9e-19) {
tmp = t_1;
} else if (a <= 4.5e+70) {
tmp = fma((x - t), ((y - a) / z), t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / Float64(z - a)), t, x) tmp = 0.0 if (a <= -9e-19) tmp = t_1; elseif (a <= 4.5e+70) tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[a, -9e-19], t$95$1, If[LessEqual[a, 4.5e+70], N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{z - a}, t, x\right)\\
\mathbf{if}\;a \leq -9 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -9.00000000000000026e-19 or 4.4999999999999999e70 < a Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.2%
Taylor expanded in x around 0
Applied rewrites67.7%
if -9.00000000000000026e-19 < a < 4.4999999999999999e70Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites52.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e-55) (fma (- x t) (/ (- y a) z) t) (if (<= z 5.3e-30) (fma (/ y a) (- t x) x) (fma (/ (- t x) z) (- a y) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e-55) {
tmp = fma((x - t), ((y - a) / z), t);
} else if (z <= 5.3e-30) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = fma(((t - x) / z), (a - y), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e-55) tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); elseif (z <= 5.3e-30) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = fma(Float64(Float64(t - x) / z), Float64(a - y), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e-55], N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[z, 5.3e-30], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(a - y), $MachinePrecision] + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-55}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z}, a - y, t\right)\\
\end{array}
\end{array}
if z < -2.39999999999999991e-55Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites52.9%
if -2.39999999999999991e-55 < z < 5.29999999999999974e-30Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.2%
Taylor expanded in z around 0
lower-/.f6449.1
Applied rewrites49.1%
if 5.29999999999999974e-30 < z Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negateN/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-out--N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites51.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- x t) (/ (- y a) z) t))) (if (<= z -2.4e-55) t_1 (if (<= z 1.4e-30) (fma (/ y a) (- t x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x - t), ((y - a) / z), t);
double tmp;
if (z <= -2.4e-55) {
tmp = t_1;
} else if (z <= 1.4e-30) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x - t), Float64(Float64(y - a) / z), t) tmp = 0.0 if (z <= -2.4e-55) tmp = t_1; elseif (z <= 1.4e-30) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -2.4e-55], t$95$1, If[LessEqual[z, 1.4e-30], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.39999999999999991e-55 or 1.39999999999999994e-30 < z Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites52.9%
if -2.39999999999999991e-55 < z < 1.39999999999999994e-30Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.2%
Taylor expanded in z around 0
lower-/.f6449.1
Applied rewrites49.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- x t) (/ y z) t))) (if (<= z -2.4e-55) t_1 (if (<= z 5.3e-30) (fma (/ y a) (- t x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x - t), (y / z), t);
double tmp;
if (z <= -2.4e-55) {
tmp = t_1;
} else if (z <= 5.3e-30) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x - t), Float64(y / z), t) tmp = 0.0 if (z <= -2.4e-55) tmp = t_1; elseif (z <= 5.3e-30) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -2.4e-55], t$95$1, If[LessEqual[z, 5.3e-30], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.39999999999999991e-55 or 5.29999999999999974e-30 < z Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites52.9%
Taylor expanded in y around inf
lower-/.f6448.8
Applied rewrites48.8%
if -2.39999999999999991e-55 < z < 5.29999999999999974e-30Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.2%
Taylor expanded in z around 0
lower-/.f6449.1
Applied rewrites49.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.3e+65) (+ x t) (if (<= a 8.5e+83) (fma (- x t) (/ y z) t) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.3e+65) {
tmp = x + t;
} else if (a <= 8.5e+83) {
tmp = fma((x - t), (y / z), t);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.3e+65) tmp = Float64(x + t); elseif (a <= 8.5e+83) tmp = fma(Float64(x - t), Float64(y / z), t); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.3e+65], N[(x + t), $MachinePrecision], If[LessEqual[a, 8.5e+83], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.3 \cdot 10^{+65}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;a \leq 8.5 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if a < -3.30000000000000023e65 or 8.4999999999999995e83 < a Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.4
Applied rewrites19.4%
Taylor expanded in x around 0
Applied rewrites34.6%
if -3.30000000000000023e65 < a < 8.4999999999999995e83Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites52.9%
Taylor expanded in y around inf
lower-/.f6448.8
Applied rewrites48.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 (- INFINITY))
(/ (* t (- z y)) z)
(if (<= t_1 -2e-299)
(+ x t)
(if (<= t_1 0.0)
(/ (* x (- y a)) z)
(if (<= t_1 1e+308) (+ x t) (/ (* y (- x t)) z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t * (z - y)) / z;
} else if (t_1 <= -2e-299) {
tmp = x + t;
} else if (t_1 <= 0.0) {
tmp = (x * (y - a)) / z;
} else if (t_1 <= 1e+308) {
tmp = x + t;
} else {
tmp = (y * (x - t)) / z;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (t * (z - y)) / z;
} else if (t_1 <= -2e-299) {
tmp = x + t;
} else if (t_1 <= 0.0) {
tmp = (x * (y - a)) / z;
} else if (t_1 <= 1e+308) {
tmp = x + t;
} else {
tmp = (y * (x - t)) / z;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_1 <= -math.inf: tmp = (t * (z - y)) / z elif t_1 <= -2e-299: tmp = x + t elif t_1 <= 0.0: tmp = (x * (y - a)) / z elif t_1 <= 1e+308: tmp = x + t else: tmp = (y * (x - t)) / z return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t * Float64(z - y)) / z); elseif (t_1 <= -2e-299) tmp = Float64(x + t); elseif (t_1 <= 0.0) tmp = Float64(Float64(x * Float64(y - a)) / z); elseif (t_1 <= 1e+308) tmp = Float64(x + t); else tmp = Float64(Float64(y * Float64(x - t)) / z); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_1 <= -Inf) tmp = (t * (z - y)) / z; elseif (t_1 <= -2e-299) tmp = x + t; elseif (t_1 <= 0.0) tmp = (x * (y - a)) / z; elseif (t_1 <= 1e+308) tmp = x + t; else tmp = (y * (x - t)) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, -2e-299], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(x * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 1e+308], N[(x + t), $MachinePrecision], N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{t \cdot \left(z - y\right)}{z}\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-299}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{x \cdot \left(y - a\right)}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+308}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.2%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.6
Applied rewrites39.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6427.1
Applied rewrites27.1%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.99999999999999998e-299 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e308Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.4
Applied rewrites19.4%
Taylor expanded in x around 0
Applied rewrites34.6%
if -1.99999999999999998e-299 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6419.5
Applied rewrites19.5%
if 1e308 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites52.9%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6423.4
Applied rewrites23.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- x t)) z)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-299)
(+ x t)
(if (<= t_2 0.0)
(/ (* x (- y a)) z)
(if (<= t_2 1e+308) (+ x t) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (x - t)) / z;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e-299) {
tmp = x + t;
} else if (t_2 <= 0.0) {
tmp = (x * (y - a)) / z;
} else if (t_2 <= 1e+308) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (x - t)) / z;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -2e-299) {
tmp = x + t;
} else if (t_2 <= 0.0) {
tmp = (x * (y - a)) / z;
} else if (t_2 <= 1e+308) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (x - t)) / z t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -2e-299: tmp = x + t elif t_2 <= 0.0: tmp = (x * (y - a)) / z elif t_2 <= 1e+308: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(x - t)) / z) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-299) tmp = Float64(x + t); elseif (t_2 <= 0.0) tmp = Float64(Float64(x * Float64(y - a)) / z); elseif (t_2 <= 1e+308) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (x - t)) / z; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -2e-299) tmp = x + t; elseif (t_2 <= 0.0) tmp = (x * (y - a)) / z; elseif (t_2 <= 1e+308) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-299], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(x * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$2, 1e+308], N[(x + t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(x - t\right)}{z}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-299}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{x \cdot \left(y - a\right)}{z}\\
\mathbf{elif}\;t\_2 \leq 10^{+308}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0 or 1e308 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites52.9%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6423.4
Applied rewrites23.4%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.99999999999999998e-299 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e308Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.4
Applied rewrites19.4%
Taylor expanded in x around 0
Applied rewrites34.6%
if -1.99999999999999998e-299 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6419.5
Applied rewrites19.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))) (t_2 (/ (* x (- y a)) z)))
(if (<= t_1 -2e-299)
(+ x t)
(if (<= t_1 0.0) t_2 (if (<= t_1 1e+308) (+ x t) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double t_2 = (x * (y - a)) / z;
double tmp;
if (t_1 <= -2e-299) {
tmp = x + t;
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 1e+308) {
tmp = x + t;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = x + ((y - z) * ((t - x) / (a - z)))
t_2 = (x * (y - a)) / z
if (t_1 <= (-2d-299)) then
tmp = x + t
else if (t_1 <= 0.0d0) then
tmp = t_2
else if (t_1 <= 1d+308) then
tmp = x + t
else
tmp = t_2
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 - z) * ((t - x) / (a - z)));
double t_2 = (x * (y - a)) / z;
double tmp;
if (t_1 <= -2e-299) {
tmp = x + t;
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 1e+308) {
tmp = x + t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) t_2 = (x * (y - a)) / z tmp = 0 if t_1 <= -2e-299: tmp = x + t elif t_1 <= 0.0: tmp = t_2 elif t_1 <= 1e+308: tmp = x + t else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) t_2 = Float64(Float64(x * Float64(y - a)) / z) tmp = 0.0 if (t_1 <= -2e-299) tmp = Float64(x + t); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 1e+308) tmp = Float64(x + t); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); t_2 = (x * (y - a)) / z; tmp = 0.0; if (t_1 <= -2e-299) tmp = x + t; elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 1e+308) tmp = x + t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-299], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 1e+308], N[(x + t), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
t_2 := \frac{x \cdot \left(y - a\right)}{z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-299}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+308}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.99999999999999998e-299 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e308Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.4
Applied rewrites19.4%
Taylor expanded in x around 0
Applied rewrites34.6%
if -1.99999999999999998e-299 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0 or 1e308 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.7
Applied rewrites45.7%
Taylor expanded in x around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6419.5
Applied rewrites19.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -1e-115)
(+ x t)
(if (<= t_1 5e-239) (/ 1.0 (/ 1.0 t)) (+ x t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -1e-115) {
tmp = x + t;
} else if (t_1 <= 5e-239) {
tmp = 1.0 / (1.0 / t);
} else {
tmp = x + t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + ((y - z) * ((t - x) / (a - z)))
if (t_1 <= (-1d-115)) then
tmp = x + t
else if (t_1 <= 5d-239) then
tmp = 1.0d0 / (1.0d0 / t)
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -1e-115) {
tmp = x + t;
} else if (t_1 <= 5e-239) {
tmp = 1.0 / (1.0 / t);
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_1 <= -1e-115: tmp = x + t elif t_1 <= 5e-239: tmp = 1.0 / (1.0 / t) else: tmp = x + t return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= -1e-115) tmp = Float64(x + t); elseif (t_1 <= 5e-239) tmp = Float64(1.0 / Float64(1.0 / t)); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_1 <= -1e-115) tmp = x + t; elseif (t_1 <= 5e-239) tmp = 1.0 / (1.0 / t); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-115], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 5e-239], N[(1.0 / N[(1.0 / t), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-115}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-239}:\\
\;\;\;\;\frac{1}{\frac{1}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.0000000000000001e-115 or 5e-239 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.4
Applied rewrites19.4%
Taylor expanded in x around 0
Applied rewrites34.6%
if -1.0000000000000001e-115 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 5e-239Initial program 80.4%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
add-to-fractionN/A
div-addN/A
mult-flipN/A
fp-cancel-sign-sub-invN/A
mult-flipN/A
div-subN/A
add-flipN/A
+-commutativeN/A
div-addN/A
Applied rewrites84.2%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.6
Applied rewrites39.6%
lift-/.f64N/A
div-flipN/A
lower-special-/.f64N/A
lower-special-/.f6439.6
Applied rewrites39.6%
Taylor expanded in z around inf
lower-/.f6425.2
Applied rewrites25.2%
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
return x + t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + t
end function
public static double code(double x, double y, double z, double t, double a) {
return x + t;
}
def code(x, y, z, t, a): return x + t
function code(x, y, z, t, a) return Float64(x + t) end
function tmp = code(x, y, z, t, a) tmp = x + t; end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}
\\
x + t
\end{array}
Initial program 80.4%
Taylor expanded in z around inf
lower--.f6419.4
Applied rewrites19.4%
Taylor expanded in x around 0
Applied rewrites34.6%
herbie shell --seed 2025154
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))