
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
(FPCore (x y z t) :precision binary64 (fma x (/ -1.0 (* (- z y) (- t y))) 1.0))
double code(double x, double y, double z, double t) {
return fma(x, (-1.0 / ((z - y) * (t - y))), 1.0);
}
function code(x, y, z, t) return fma(x, Float64(-1.0 / Float64(Float64(z - y) * Float64(t - y))), 1.0) end
code[x_, y_, z_, t_] := N[(x * N[(-1.0 / N[(N[(z - y), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \frac{-1}{\left(z - y\right) \cdot \left(t - y\right)}, 1\right)
\end{array}
Initial program 99.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
div-invN/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
remove-double-negN/A
lower-/.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- 1.0 (/ x (* z t)))) (t_2 (- 1.0 (/ x (* (- z y) (- t y)))))) (if (<= t_2 -5000000000.0) t_1 (if (<= t_2 2.0) 1.0 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (z * t));
double t_2 = 1.0 - (x / ((z - y) * (t - y)));
double tmp;
if (t_2 <= -5000000000.0) {
tmp = t_1;
} else if (t_2 <= 2.0) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 1.0d0 - (x / (z * t))
t_2 = 1.0d0 - (x / ((z - y) * (t - y)))
if (t_2 <= (-5000000000.0d0)) then
tmp = t_1
else if (t_2 <= 2.0d0) then
tmp = 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (z * t));
double t_2 = 1.0 - (x / ((z - y) * (t - y)));
double tmp;
if (t_2 <= -5000000000.0) {
tmp = t_1;
} else if (t_2 <= 2.0) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / (z * t)) t_2 = 1.0 - (x / ((z - y) * (t - y))) tmp = 0 if t_2 <= -5000000000.0: tmp = t_1 elif t_2 <= 2.0: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(z * t))) t_2 = Float64(1.0 - Float64(x / Float64(Float64(z - y) * Float64(t - y)))) tmp = 0.0 if (t_2 <= -5000000000.0) tmp = t_1; elseif (t_2 <= 2.0) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / (z * t)); t_2 = 1.0 - (x / ((z - y) * (t - y))); tmp = 0.0; if (t_2 <= -5000000000.0) tmp = t_1; elseif (t_2 <= 2.0) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(z - y), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5000000000.0], t$95$1, If[LessEqual[t$95$2, 2.0], 1.0, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{x}{z \cdot t}\\
t_2 := 1 - \frac{x}{\left(z - y\right) \cdot \left(t - y\right)}\\
\mathbf{if}\;t\_2 \leq -5000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -5e9 or 2 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 98.4%
Taylor expanded in y around 0
lower-*.f6445.2
Applied rewrites45.2%
if -5e9 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 2Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.5%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ (/ x (* t y)) 1.0)) (t_2 (- 1.0 (/ x (* (- z y) (- t y)))))) (if (<= t_2 0.9995) t_1 (if (<= t_2 1e+48) 1.0 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / (t * y)) + 1.0;
double t_2 = 1.0 - (x / ((z - y) * (t - y)));
double tmp;
if (t_2 <= 0.9995) {
tmp = t_1;
} else if (t_2 <= 1e+48) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x / (t * y)) + 1.0d0
t_2 = 1.0d0 - (x / ((z - y) * (t - y)))
if (t_2 <= 0.9995d0) then
tmp = t_1
else if (t_2 <= 1d+48) then
tmp = 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / (t * y)) + 1.0;
double t_2 = 1.0 - (x / ((z - y) * (t - y)));
double tmp;
if (t_2 <= 0.9995) {
tmp = t_1;
} else if (t_2 <= 1e+48) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / (t * y)) + 1.0 t_2 = 1.0 - (x / ((z - y) * (t - y))) tmp = 0 if t_2 <= 0.9995: tmp = t_1 elif t_2 <= 1e+48: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(t * y)) + 1.0) t_2 = Float64(1.0 - Float64(x / Float64(Float64(z - y) * Float64(t - y)))) tmp = 0.0 if (t_2 <= 0.9995) tmp = t_1; elseif (t_2 <= 1e+48) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / (t * y)) + 1.0; t_2 = 1.0 - (x / ((z - y) * (t - y))); tmp = 0.0; if (t_2 <= 0.9995) tmp = t_1; elseif (t_2 <= 1e+48) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(z - y), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.9995], t$95$1, If[LessEqual[t$95$2, 1e+48], 1.0, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t \cdot y} + 1\\
t_2 := 1 - \frac{x}{\left(z - y\right) \cdot \left(t - y\right)}\\
\mathbf{if}\;t\_2 \leq 0.9995:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+48}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 0.99950000000000006 or 1.00000000000000004e48 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 98.3%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6457.0
Applied rewrites57.0%
Taylor expanded in y around inf
Applied rewrites26.8%
if 0.99950000000000006 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 1.00000000000000004e48Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites96.9%
Final simplification77.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ (/ x (* z y)) 1.0)) (t_2 (- 1.0 (/ x (* (- z y) (- t y)))))) (if (<= t_2 -2e+20) t_1 (if (<= t_2 5e+48) 1.0 t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / (z * y)) + 1.0;
double t_2 = 1.0 - (x / ((z - y) * (t - y)));
double tmp;
if (t_2 <= -2e+20) {
tmp = t_1;
} else if (t_2 <= 5e+48) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x / (z * y)) + 1.0d0
t_2 = 1.0d0 - (x / ((z - y) * (t - y)))
if (t_2 <= (-2d+20)) then
tmp = t_1
else if (t_2 <= 5d+48) then
tmp = 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / (z * y)) + 1.0;
double t_2 = 1.0 - (x / ((z - y) * (t - y)));
double tmp;
if (t_2 <= -2e+20) {
tmp = t_1;
} else if (t_2 <= 5e+48) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / (z * y)) + 1.0 t_2 = 1.0 - (x / ((z - y) * (t - y))) tmp = 0 if t_2 <= -2e+20: tmp = t_1 elif t_2 <= 5e+48: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(z * y)) + 1.0) t_2 = Float64(1.0 - Float64(x / Float64(Float64(z - y) * Float64(t - y)))) tmp = 0.0 if (t_2 <= -2e+20) tmp = t_1; elseif (t_2 <= 5e+48) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / (z * y)) + 1.0; t_2 = 1.0 - (x / ((z - y) * (t - y))); tmp = 0.0; if (t_2 <= -2e+20) tmp = t_1; elseif (t_2 <= 5e+48) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(z - y), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+20], t$95$1, If[LessEqual[t$95$2, 5e+48], 1.0, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot y} + 1\\
t_2 := 1 - \frac{x}{\left(z - y\right) \cdot \left(t - y\right)}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+48}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -2e20 or 4.99999999999999973e48 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) Initial program 98.2%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6464.6
Applied rewrites64.6%
Taylor expanded in y around inf
Applied rewrites32.4%
if -2e20 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 4.99999999999999973e48Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites95.1%
Final simplification78.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ x (* (- y z) y)))))
(if (<= y -3.05e-31)
t_1
(if (<= y 7.5e-39) (+ (/ x (* (- y z) t)) 1.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * y));
double tmp;
if (y <= -3.05e-31) {
tmp = t_1;
} else if (y <= 7.5e-39) {
tmp = (x / ((y - z) * t)) + 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - (x / ((y - z) * y))
if (y <= (-3.05d-31)) then
tmp = t_1
else if (y <= 7.5d-39) then
tmp = (x / ((y - z) * t)) + 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / ((y - z) * y));
double tmp;
if (y <= -3.05e-31) {
tmp = t_1;
} else if (y <= 7.5e-39) {
tmp = (x / ((y - z) * t)) + 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / ((y - z) * y)) tmp = 0 if y <= -3.05e-31: tmp = t_1 elif y <= 7.5e-39: tmp = (x / ((y - z) * t)) + 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * y))) tmp = 0.0 if (y <= -3.05e-31) tmp = t_1; elseif (y <= 7.5e-39) tmp = Float64(Float64(x / Float64(Float64(y - z) * t)) + 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / ((y - z) * y)); tmp = 0.0; if (y <= -3.05e-31) tmp = t_1; elseif (y <= 7.5e-39) tmp = (x / ((y - z) * t)) + 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.05e-31], t$95$1, If[LessEqual[y, 7.5e-39], N[(N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{x}{\left(y - z\right) \cdot y}\\
\mathbf{if}\;y \leq -3.05 \cdot 10^{-31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot t} + 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.0499999999999999e-31 or 7.49999999999999971e-39 < y Initial program 99.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6495.8
Applied rewrites95.8%
if -3.0499999999999999e-31 < y < 7.49999999999999971e-39Initial program 99.1%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.3
Applied rewrites82.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ x (* y y)))))
(if (<= y -5.8e-31)
t_1
(if (<= y 1.75e+20) (+ (/ x (* (- y z) t)) 1.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (y * y));
double tmp;
if (y <= -5.8e-31) {
tmp = t_1;
} else if (y <= 1.75e+20) {
tmp = (x / ((y - z) * t)) + 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - (x / (y * y))
if (y <= (-5.8d-31)) then
tmp = t_1
else if (y <= 1.75d+20) then
tmp = (x / ((y - z) * t)) + 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (y * y));
double tmp;
if (y <= -5.8e-31) {
tmp = t_1;
} else if (y <= 1.75e+20) {
tmp = (x / ((y - z) * t)) + 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / (y * y)) tmp = 0 if y <= -5.8e-31: tmp = t_1 elif y <= 1.75e+20: tmp = (x / ((y - z) * t)) + 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(y * y))) tmp = 0.0 if (y <= -5.8e-31) tmp = t_1; elseif (y <= 1.75e+20) tmp = Float64(Float64(x / Float64(Float64(y - z) * t)) + 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / (y * y)); tmp = 0.0; if (y <= -5.8e-31) tmp = t_1; elseif (y <= 1.75e+20) tmp = (x / ((y - z) * t)) + 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.8e-31], t$95$1, If[LessEqual[y, 1.75e+20], N[(N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{x}{y \cdot y}\\
\mathbf{if}\;y \leq -5.8 \cdot 10^{-31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+20}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot t} + 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.8000000000000001e-31 or 1.75e20 < y Initial program 99.9%
Taylor expanded in y around inf
unpow2N/A
lower-*.f6492.0
Applied rewrites92.0%
if -5.8000000000000001e-31 < y < 1.75e20Initial program 99.1%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.1
Applied rewrites82.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ x (* y y)))))
(if (<= y -7.4e-31)
t_1
(if (<= y 1.75e+20) (+ (/ x (* z (- y t))) 1.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (y * y));
double tmp;
if (y <= -7.4e-31) {
tmp = t_1;
} else if (y <= 1.75e+20) {
tmp = (x / (z * (y - t))) + 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - (x / (y * y))
if (y <= (-7.4d-31)) then
tmp = t_1
else if (y <= 1.75d+20) then
tmp = (x / (z * (y - t))) + 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (y * y));
double tmp;
if (y <= -7.4e-31) {
tmp = t_1;
} else if (y <= 1.75e+20) {
tmp = (x / (z * (y - t))) + 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / (y * y)) tmp = 0 if y <= -7.4e-31: tmp = t_1 elif y <= 1.75e+20: tmp = (x / (z * (y - t))) + 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(y * y))) tmp = 0.0 if (y <= -7.4e-31) tmp = t_1; elseif (y <= 1.75e+20) tmp = Float64(Float64(x / Float64(z * Float64(y - t))) + 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / (y * y)); tmp = 0.0; if (y <= -7.4e-31) tmp = t_1; elseif (y <= 1.75e+20) tmp = (x / (z * (y - t))) + 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.4e-31], t$95$1, If[LessEqual[y, 1.75e+20], N[(N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{x}{y \cdot y}\\
\mathbf{if}\;y \leq -7.4 \cdot 10^{-31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+20}:\\
\;\;\;\;\frac{x}{z \cdot \left(y - t\right)} + 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.3999999999999996e-31 or 1.75e20 < y Initial program 99.9%
Taylor expanded in y around inf
unpow2N/A
lower-*.f6492.0
Applied rewrites92.0%
if -7.3999999999999996e-31 < y < 1.75e20Initial program 99.1%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6488.9
Applied rewrites88.9%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- 1.0 (/ x (* y y))))) (if (<= y -3.05e-31) t_1 (if (<= y 1.1e+19) (- 1.0 (/ x (* z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (y * y));
double tmp;
if (y <= -3.05e-31) {
tmp = t_1;
} else if (y <= 1.1e+19) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - (x / (y * y))
if (y <= (-3.05d-31)) then
tmp = t_1
else if (y <= 1.1d+19) then
tmp = 1.0d0 - (x / (z * t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - (x / (y * y));
double tmp;
if (y <= -3.05e-31) {
tmp = t_1;
} else if (y <= 1.1e+19) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - (x / (y * y)) tmp = 0 if y <= -3.05e-31: tmp = t_1 elif y <= 1.1e+19: tmp = 1.0 - (x / (z * t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(x / Float64(y * y))) tmp = 0.0 if (y <= -3.05e-31) tmp = t_1; elseif (y <= 1.1e+19) tmp = Float64(1.0 - Float64(x / Float64(z * t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - (x / (y * y)); tmp = 0.0; if (y <= -3.05e-31) tmp = t_1; elseif (y <= 1.1e+19) tmp = 1.0 - (x / (z * t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.05e-31], t$95$1, If[LessEqual[y, 1.1e+19], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{x}{y \cdot y}\\
\mathbf{if}\;y \leq -3.05 \cdot 10^{-31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+19}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.0499999999999999e-31 or 1.1e19 < y Initial program 99.9%
Taylor expanded in y around inf
unpow2N/A
lower-*.f6492.0
Applied rewrites92.0%
if -3.0499999999999999e-31 < y < 1.1e19Initial program 99.1%
Taylor expanded in y around 0
lower-*.f6474.2
Applied rewrites74.2%
Final simplification83.2%
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- z y) (- t y)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((z - y) * (t - y)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - (x / ((z - y) * (t - y)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((z - y) * (t - y)));
}
def code(x, y, z, t): return 1.0 - (x / ((z - y) * (t - y)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(z - y) * Float64(t - y)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((z - y) * (t - y))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(z - y), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(z - y\right) \cdot \left(t - y\right)}
\end{array}
Initial program 99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.5%
Taylor expanded in x around 0
Applied rewrites70.5%
herbie shell --seed 2024298
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
:precision binary64
(- 1.0 (/ x (* (- y z) (- y t)))))