
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
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 = x / ((y - z) * (t - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
def code(x, y, z, t): return x / ((y - z) * (t - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(y - z) * Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x / ((y - z) * (t - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
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 = x / ((y - z) * (t - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
def code(x, y, z, t): return x / ((y - z) * (t - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(y - z) * Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x / ((y - z) * (t - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\end{array}
(FPCore (x y z t) :precision binary64 (/ (/ x (- t z)) (- y z)))
double code(double x, double y, double z, double t) {
return (x / (t - z)) / (y - z);
}
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 = (x / (t - z)) / (y - z)
end function
public static double code(double x, double y, double z, double t) {
return (x / (t - z)) / (y - z);
}
def code(x, y, z, t): return (x / (t - z)) / (y - z)
function code(x, y, z, t) return Float64(Float64(x / Float64(t - z)) / Float64(y - z)) end
function tmp = code(x, y, z, t) tmp = (x / (t - z)) / (y - z); end
code[x_, y_, z_, t_] := N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{x}{t - z}}{y - z}
\end{array}
Initial program 88.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) (- t z))) (t_2 (/ x (- t z))))
(if (<= t_1 (- INFINITY))
(/ t_2 y)
(if (<= t_1 5e+286) (/ x t_1) (/ t_2 (- z))))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double t_2 = x / (t - z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2 / y;
} else if (t_1 <= 5e+286) {
tmp = x / t_1;
} else {
tmp = t_2 / -z;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double t_2 = x / (t - z);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_2 / y;
} else if (t_1 <= 5e+286) {
tmp = x / t_1;
} else {
tmp = t_2 / -z;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * (t - z) t_2 = x / (t - z) tmp = 0 if t_1 <= -math.inf: tmp = t_2 / y elif t_1 <= 5e+286: tmp = x / t_1 else: tmp = t_2 / -z return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(t - z)) t_2 = Float64(x / Float64(t - z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t_2 / y); elseif (t_1 <= 5e+286) tmp = Float64(x / t_1); else tmp = Float64(t_2 / Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * (t - z); t_2 = x / (t - z); tmp = 0.0; if (t_1 <= -Inf) tmp = t_2 / y; elseif (t_1 <= 5e+286) tmp = x / t_1; else tmp = t_2 / -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(t$95$2 / y), $MachinePrecision], If[LessEqual[t$95$1, 5e+286], N[(x / t$95$1), $MachinePrecision], N[(t$95$2 / (-z)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
t_2 := \frac{x}{t - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{t\_2}{y}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;\frac{x}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_2}{-z}\\
\end{array}
\end{array}
if (*.f64 (-.f64 y z) (-.f64 t z)) < -inf.0Initial program 63.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f6495.5
Applied rewrites95.5%
if -inf.0 < (*.f64 (-.f64 y z) (-.f64 t z)) < 5.0000000000000004e286Initial program 95.6%
if 5.0000000000000004e286 < (*.f64 (-.f64 y z) (-.f64 t z)) Initial program 81.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6490.8
Applied rewrites90.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (* (+ z y) t))))
(if (<= t -1.02e-81)
t_1
(if (<= t 1.75e-22)
(/ x (* (- z y) z))
(if (or (<= t 6.9e+33) (not (<= t 1.06e+119)))
t_1
(/ x (* (- z) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x / ((z + y) * t);
double tmp;
if (t <= -1.02e-81) {
tmp = t_1;
} else if (t <= 1.75e-22) {
tmp = x / ((z - y) * z);
} else if ((t <= 6.9e+33) || !(t <= 1.06e+119)) {
tmp = t_1;
} else {
tmp = x / (-z * t);
}
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 = x / ((z + y) * t)
if (t <= (-1.02d-81)) then
tmp = t_1
else if (t <= 1.75d-22) then
tmp = x / ((z - y) * z)
else if ((t <= 6.9d+33) .or. (.not. (t <= 1.06d+119))) then
tmp = t_1
else
tmp = x / (-z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x / ((z + y) * t);
double tmp;
if (t <= -1.02e-81) {
tmp = t_1;
} else if (t <= 1.75e-22) {
tmp = x / ((z - y) * z);
} else if ((t <= 6.9e+33) || !(t <= 1.06e+119)) {
tmp = t_1;
} else {
tmp = x / (-z * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x / ((z + y) * t) tmp = 0 if t <= -1.02e-81: tmp = t_1 elif t <= 1.75e-22: tmp = x / ((z - y) * z) elif (t <= 6.9e+33) or not (t <= 1.06e+119): tmp = t_1 else: tmp = x / (-z * t) return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(Float64(z + y) * t)) tmp = 0.0 if (t <= -1.02e-81) tmp = t_1; elseif (t <= 1.75e-22) tmp = Float64(x / Float64(Float64(z - y) * z)); elseif ((t <= 6.9e+33) || !(t <= 1.06e+119)) tmp = t_1; else tmp = Float64(x / Float64(Float64(-z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / ((z + y) * t); tmp = 0.0; if (t <= -1.02e-81) tmp = t_1; elseif (t <= 1.75e-22) tmp = x / ((z - y) * z); elseif ((t <= 6.9e+33) || ~((t <= 1.06e+119))) tmp = t_1; else tmp = x / (-z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(N[(z + y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.02e-81], t$95$1, If[LessEqual[t, 1.75e-22], N[(x / N[(N[(z - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 6.9e+33], N[Not[LessEqual[t, 1.06e+119]], $MachinePrecision]], t$95$1, N[(x / N[((-z) * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\left(z + y\right) \cdot t}\\
\mathbf{if}\;t \leq -1.02 \cdot 10^{-81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-22}:\\
\;\;\;\;\frac{x}{\left(z - y\right) \cdot z}\\
\mathbf{elif}\;t \leq 6.9 \cdot 10^{+33} \lor \neg \left(t \leq 1.06 \cdot 10^{+119}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(-z\right) \cdot t}\\
\end{array}
\end{array}
if t < -1.01999999999999998e-81 or 1.75000000000000003e-22 < t < 6.8999999999999995e33 or 1.0599999999999999e119 < t Initial program 86.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6477.2
Applied rewrites77.2%
Applied rewrites63.7%
if -1.01999999999999998e-81 < t < 1.75000000000000003e-22Initial program 90.3%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f6477.5
Applied rewrites77.5%
Taylor expanded in y around 0
Applied rewrites77.5%
if 6.8999999999999995e33 < t < 1.0599999999999999e119Initial program 99.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6485.3
Applied rewrites85.3%
Taylor expanded in y around 0
Applied rewrites56.3%
Final simplification69.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (* z z))) (t_2 (/ x (* (- z) t))))
(if (<= z -3.4e+68)
t_1
(if (<= z -1.6e-137)
t_2
(if (<= z 2.15e-49) (/ x (* t y)) (if (<= z 0.55) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (z * z);
double t_2 = x / (-z * t);
double tmp;
if (z <= -3.4e+68) {
tmp = t_1;
} else if (z <= -1.6e-137) {
tmp = t_2;
} else if (z <= 2.15e-49) {
tmp = x / (t * y);
} else if (z <= 0.55) {
tmp = t_2;
} 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 * z)
t_2 = x / (-z * t)
if (z <= (-3.4d+68)) then
tmp = t_1
else if (z <= (-1.6d-137)) then
tmp = t_2
else if (z <= 2.15d-49) then
tmp = x / (t * y)
else if (z <= 0.55d0) then
tmp = t_2
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 * z);
double t_2 = x / (-z * t);
double tmp;
if (z <= -3.4e+68) {
tmp = t_1;
} else if (z <= -1.6e-137) {
tmp = t_2;
} else if (z <= 2.15e-49) {
tmp = x / (t * y);
} else if (z <= 0.55) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (z * z) t_2 = x / (-z * t) tmp = 0 if z <= -3.4e+68: tmp = t_1 elif z <= -1.6e-137: tmp = t_2 elif z <= 2.15e-49: tmp = x / (t * y) elif z <= 0.55: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(z * z)) t_2 = Float64(x / Float64(Float64(-z) * t)) tmp = 0.0 if (z <= -3.4e+68) tmp = t_1; elseif (z <= -1.6e-137) tmp = t_2; elseif (z <= 2.15e-49) tmp = Float64(x / Float64(t * y)); elseif (z <= 0.55) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (z * z); t_2 = x / (-z * t); tmp = 0.0; if (z <= -3.4e+68) tmp = t_1; elseif (z <= -1.6e-137) tmp = t_2; elseif (z <= 2.15e-49) tmp = x / (t * y); elseif (z <= 0.55) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[((-z) * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.4e+68], t$95$1, If[LessEqual[z, -1.6e-137], t$95$2, If[LessEqual[z, 2.15e-49], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.55], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot z}\\
t_2 := \frac{x}{\left(-z\right) \cdot t}\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-137}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-49}:\\
\;\;\;\;\frac{x}{t \cdot y}\\
\mathbf{elif}\;z \leq 0.55:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.40000000000000015e68 or 0.55000000000000004 < z Initial program 87.3%
Taylor expanded in z around inf
unpow2N/A
lower-*.f6476.9
Applied rewrites76.9%
if -3.40000000000000015e68 < z < -1.60000000000000011e-137 or 2.15000000000000008e-49 < z < 0.55000000000000004Initial program 92.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6448.1
Applied rewrites48.1%
Taylor expanded in y around 0
Applied rewrites34.1%
if -1.60000000000000011e-137 < z < 2.15000000000000008e-49Initial program 88.5%
Taylor expanded in z around 0
lower-*.f6458.7
Applied rewrites58.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) (- t z)))) (if (<= t_1 (- INFINITY)) (/ (/ x (- t z)) y) (/ x t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x / (t - z)) / y;
} else {
tmp = x / t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x / (t - z)) / y;
} else {
tmp = x / t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * (t - z) tmp = 0 if t_1 <= -math.inf: tmp = (x / (t - z)) / y else: tmp = x / t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(t - z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x / Float64(t - z)) / y); else tmp = Float64(x / t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * (t - z); tmp = 0.0; if (t_1 <= -Inf) tmp = (x / (t - z)) / y; else tmp = x / t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x / t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t\_1}\\
\end{array}
\end{array}
if (*.f64 (-.f64 y z) (-.f64 t z)) < -inf.0Initial program 63.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f6495.5
Applied rewrites95.5%
if -inf.0 < (*.f64 (-.f64 y z) (-.f64 t z)) Initial program 91.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) (- t z)))) (if (<= t_1 (- INFINITY)) (/ (/ x y) t) (/ x t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x / y) / t;
} else {
tmp = x / t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x / y) / t;
} else {
tmp = x / t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * (t - z) tmp = 0 if t_1 <= -math.inf: tmp = (x / y) / t else: tmp = x / t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(t - z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x / y) / t); else tmp = Float64(x / t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * (t - z); tmp = 0.0; if (t_1 <= -Inf) tmp = (x / y) / t; else tmp = x / t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x / y), $MachinePrecision] / t), $MachinePrecision], N[(x / t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{\frac{x}{y}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t\_1}\\
\end{array}
\end{array}
if (*.f64 (-.f64 y z) (-.f64 t z)) < -inf.0Initial program 63.0%
Taylor expanded in t around inf
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f6486.8
Applied rewrites86.8%
Taylor expanded in y around inf
Applied rewrites78.3%
if -inf.0 < (*.f64 (-.f64 y z) (-.f64 t z)) Initial program 91.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.7e-87) (not (<= z 3e-8))) (/ x (* (- z y) z)) (/ x (* (- t z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.7e-87) || !(z <= 3e-8)) {
tmp = x / ((z - y) * z);
} else {
tmp = x / ((t - z) * y);
}
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) :: tmp
if ((z <= (-3.7d-87)) .or. (.not. (z <= 3d-8))) then
tmp = x / ((z - y) * z)
else
tmp = x / ((t - z) * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.7e-87) || !(z <= 3e-8)) {
tmp = x / ((z - y) * z);
} else {
tmp = x / ((t - z) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.7e-87) or not (z <= 3e-8): tmp = x / ((z - y) * z) else: tmp = x / ((t - z) * y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.7e-87) || !(z <= 3e-8)) tmp = Float64(x / Float64(Float64(z - y) * z)); else tmp = Float64(x / Float64(Float64(t - z) * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.7e-87) || ~((z <= 3e-8))) tmp = x / ((z - y) * z); else tmp = x / ((t - z) * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.7e-87], N[Not[LessEqual[z, 3e-8]], $MachinePrecision]], N[(x / N[(N[(z - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-87} \lor \neg \left(z \leq 3 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x}{\left(z - y\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\
\end{array}
\end{array}
if z < -3.7000000000000002e-87 or 2.99999999999999973e-8 < z Initial program 87.3%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f6473.0
Applied rewrites73.0%
Taylor expanded in y around 0
Applied rewrites73.0%
if -3.7000000000000002e-87 < z < 2.99999999999999973e-8Initial program 91.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6476.9
Applied rewrites76.9%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (<= t -9e-218) (/ x (* (- t z) y)) (if (<= t 1.06e-55) (/ x (* (- z y) z)) (/ x (* (- y z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e-218) {
tmp = x / ((t - z) * y);
} else if (t <= 1.06e-55) {
tmp = x / ((z - y) * z);
} else {
tmp = x / ((y - z) * t);
}
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) :: tmp
if (t <= (-9d-218)) then
tmp = x / ((t - z) * y)
else if (t <= 1.06d-55) then
tmp = x / ((z - y) * z)
else
tmp = x / ((y - z) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e-218) {
tmp = x / ((t - z) * y);
} else if (t <= 1.06e-55) {
tmp = x / ((z - y) * z);
} else {
tmp = x / ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9e-218: tmp = x / ((t - z) * y) elif t <= 1.06e-55: tmp = x / ((z - y) * z) else: tmp = x / ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9e-218) tmp = Float64(x / Float64(Float64(t - z) * y)); elseif (t <= 1.06e-55) tmp = Float64(x / Float64(Float64(z - y) * z)); else tmp = Float64(x / Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -9e-218) tmp = x / ((t - z) * y); elseif (t <= 1.06e-55) tmp = x / ((z - y) * z); else tmp = x / ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9e-218], N[(x / N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.06e-55], N[(x / N[(N[(z - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-218}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\
\mathbf{elif}\;t \leq 1.06 \cdot 10^{-55}:\\
\;\;\;\;\frac{x}{\left(z - y\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if t < -8.99999999999999953e-218Initial program 89.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6456.6
Applied rewrites56.6%
if -8.99999999999999953e-218 < t < 1.06e-55Initial program 87.4%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f6476.3
Applied rewrites76.3%
Taylor expanded in y around 0
Applied rewrites76.3%
if 1.06e-55 < t Initial program 89.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.3
Applied rewrites82.3%
(FPCore (x y z t) :precision binary64 (if (<= t -1.02e-81) (/ x (* t y)) (if (<= t 6e+14) (/ x (* (- z y) z)) (/ x (* (- z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.02e-81) {
tmp = x / (t * y);
} else if (t <= 6e+14) {
tmp = x / ((z - y) * z);
} else {
tmp = x / (-z * t);
}
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) :: tmp
if (t <= (-1.02d-81)) then
tmp = x / (t * y)
else if (t <= 6d+14) then
tmp = x / ((z - y) * z)
else
tmp = x / (-z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.02e-81) {
tmp = x / (t * y);
} else if (t <= 6e+14) {
tmp = x / ((z - y) * z);
} else {
tmp = x / (-z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.02e-81: tmp = x / (t * y) elif t <= 6e+14: tmp = x / ((z - y) * z) else: tmp = x / (-z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.02e-81) tmp = Float64(x / Float64(t * y)); elseif (t <= 6e+14) tmp = Float64(x / Float64(Float64(z - y) * z)); else tmp = Float64(x / Float64(Float64(-z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.02e-81) tmp = x / (t * y); elseif (t <= 6e+14) tmp = x / ((z - y) * z); else tmp = x / (-z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.02e-81], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6e+14], N[(x / N[(N[(z - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x / N[((-z) * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.02 \cdot 10^{-81}:\\
\;\;\;\;\frac{x}{t \cdot y}\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{\left(z - y\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(-z\right) \cdot t}\\
\end{array}
\end{array}
if t < -1.01999999999999998e-81Initial program 87.3%
Taylor expanded in z around 0
lower-*.f6449.9
Applied rewrites49.9%
if -1.01999999999999998e-81 < t < 6e14Initial program 89.1%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f6475.3
Applied rewrites75.3%
Taylor expanded in y around 0
Applied rewrites75.3%
if 6e14 < t Initial program 90.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6485.3
Applied rewrites85.3%
Taylor expanded in y around 0
Applied rewrites56.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -42000000.0) (not (<= z 3e-8))) (/ x (* z z)) (/ x (* t y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -42000000.0) || !(z <= 3e-8)) {
tmp = x / (z * z);
} else {
tmp = x / (t * y);
}
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) :: tmp
if ((z <= (-42000000.0d0)) .or. (.not. (z <= 3d-8))) then
tmp = x / (z * z)
else
tmp = x / (t * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -42000000.0) || !(z <= 3e-8)) {
tmp = x / (z * z);
} else {
tmp = x / (t * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -42000000.0) or not (z <= 3e-8): tmp = x / (z * z) else: tmp = x / (t * y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -42000000.0) || !(z <= 3e-8)) tmp = Float64(x / Float64(z * z)); else tmp = Float64(x / Float64(t * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -42000000.0) || ~((z <= 3e-8))) tmp = x / (z * z); else tmp = x / (t * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -42000000.0], N[Not[LessEqual[z, 3e-8]], $MachinePrecision]], N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -42000000 \lor \neg \left(z \leq 3 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t \cdot y}\\
\end{array}
\end{array}
if z < -4.2e7 or 2.99999999999999973e-8 < z Initial program 87.4%
Taylor expanded in z around inf
unpow2N/A
lower-*.f6470.0
Applied rewrites70.0%
if -4.2e7 < z < 2.99999999999999973e-8Initial program 90.3%
Taylor expanded in z around 0
lower-*.f6449.7
Applied rewrites49.7%
Final simplification59.7%
(FPCore (x y z t) :precision binary64 (/ x (* t y)))
double code(double x, double y, double z, double t) {
return x / (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 = x / (t * y)
end function
public static double code(double x, double y, double z, double t) {
return x / (t * y);
}
def code(x, y, z, t): return x / (t * y)
function code(x, y, z, t) return Float64(x / Float64(t * y)) end
function tmp = code(x, y, z, t) tmp = x / (t * y); end
code[x_, y_, z_, t_] := N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t \cdot y}
\end{array}
Initial program 88.9%
Taylor expanded in z around 0
lower-*.f6435.2
Applied rewrites35.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) (- t z)))) (if (< (/ x t_1) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1.0 t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if ((x / t_1) < 0.0) {
tmp = (x / (y - z)) / (t - z);
} else {
tmp = x * (1.0 / 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 = (y - z) * (t - z)
if ((x / t_1) < 0.0d0) then
tmp = (x / (y - z)) / (t - z)
else
tmp = x * (1.0d0 / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if ((x / t_1) < 0.0) {
tmp = (x / (y - z)) / (t - z);
} else {
tmp = x * (1.0 / t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * (t - z) tmp = 0 if (x / t_1) < 0.0: tmp = (x / (y - z)) / (t - z) else: tmp = x * (1.0 / t_1) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(t - z)) tmp = 0.0 if (Float64(x / t_1) < 0.0) tmp = Float64(Float64(x / Float64(y - z)) / Float64(t - z)); else tmp = Float64(x * Float64(1.0 / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * (t - z); tmp = 0.0; if ((x / t_1) < 0.0) tmp = (x / (y - z)) / (t - z); else tmp = x * (1.0 / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[Less[N[(x / t$95$1), $MachinePrecision], 0.0], N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;\frac{x}{t\_1} < 0:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024320
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ x (* (- y z) (- t z))) 0) (/ (/ x (- y z)) (- t z)) (* x (/ 1 (* (- y z) (- t z))))))
(/ x (* (- y z) (- t z))))