
(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 12 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 85.6%
associate-/l/98.0%
Simplified98.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t z) (- y z))))
(if (<= t_1 (- INFINITY))
(/ (/ x (- t z)) y)
(if (<= t_1 5e+307) (/ x t_1) (/ (/ x z) (- z t))))))
double code(double x, double y, double z, double t) {
double t_1 = (t - z) * (y - z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x / (t - z)) / y;
} else if (t_1 <= 5e+307) {
tmp = x / t_1;
} else {
tmp = (x / z) / (z - t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (t - z) * (y - z);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x / (t - z)) / y;
} else if (t_1 <= 5e+307) {
tmp = x / t_1;
} else {
tmp = (x / z) / (z - t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (t - z) * (y - z) tmp = 0 if t_1 <= -math.inf: tmp = (x / (t - z)) / y elif t_1 <= 5e+307: tmp = x / t_1 else: tmp = (x / z) / (z - t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t - z) * Float64(y - z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x / Float64(t - z)) / y); elseif (t_1 <= 5e+307) tmp = Float64(x / t_1); else tmp = Float64(Float64(x / z) / Float64(z - t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t - z) * (y - z); tmp = 0.0; if (t_1 <= -Inf) tmp = (x / (t - z)) / y; elseif (t_1 <= 5e+307) tmp = x / t_1; else tmp = (x / z) / (z - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 5e+307], N[(x / t$95$1), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - z\right) \cdot \left(y - z\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{x}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{z - t}\\
\end{array}
\end{array}
if (*.f64 (-.f64 y z) (-.f64 t z)) < -inf.0Initial program 71.4%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in y around inf 96.7%
if -inf.0 < (*.f64 (-.f64 y z) (-.f64 t z)) < 5e307Initial program 98.5%
if 5e307 < (*.f64 (-.f64 y z) (-.f64 t z)) Initial program 65.8%
Taylor expanded in y around 0 58.1%
mul-1-neg58.1%
associate-/r*81.2%
distribute-neg-frac281.2%
sub-neg81.2%
+-commutative81.2%
distribute-neg-in81.2%
remove-double-neg81.2%
unsub-neg81.2%
Simplified81.2%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6e+59) (not (<= z 3.5e+85))) (/ (/ x z) z) (/ (/ x t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6e+59) || !(z <= 3.5e+85)) {
tmp = (x / z) / z;
} else {
tmp = (x / t) / (y - z);
}
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 <= (-6d+59)) .or. (.not. (z <= 3.5d+85))) then
tmp = (x / z) / z
else
tmp = (x / t) / (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6e+59) || !(z <= 3.5e+85)) {
tmp = (x / z) / z;
} else {
tmp = (x / t) / (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6e+59) or not (z <= 3.5e+85): tmp = (x / z) / z else: tmp = (x / t) / (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6e+59) || !(z <= 3.5e+85)) tmp = Float64(Float64(x / z) / z); else tmp = Float64(Float64(x / t) / Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6e+59) || ~((z <= 3.5e+85))) tmp = (x / z) / z; else tmp = (x / t) / (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6e+59], N[Not[LessEqual[z, 3.5e+85]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+59} \lor \neg \left(z \leq 3.5 \cdot 10^{+85}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -6.0000000000000001e59 or 3.50000000000000005e85 < z Initial program 74.0%
Taylor expanded in t around 0 71.0%
mul-1-neg71.0%
associate-/r*91.4%
distribute-neg-frac291.4%
neg-sub091.4%
sub-neg91.4%
+-commutative91.4%
associate--r+91.4%
neg-sub091.4%
remove-double-neg91.4%
Simplified91.4%
Taylor expanded in z around inf 83.2%
if -6.0000000000000001e59 < z < 3.50000000000000005e85Initial program 92.2%
associate-/l/96.9%
Simplified96.9%
Taylor expanded in t around inf 76.8%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4e+54) (not (<= z 1.55e+80))) (/ (/ x z) z) (/ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e+54) || !(z <= 1.55e+80)) {
tmp = (x / z) / z;
} else {
tmp = x / (t * (y - z));
}
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 <= (-4d+54)) .or. (.not. (z <= 1.55d+80))) then
tmp = (x / z) / z
else
tmp = x / (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e+54) || !(z <= 1.55e+80)) {
tmp = (x / z) / z;
} else {
tmp = x / (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4e+54) or not (z <= 1.55e+80): tmp = (x / z) / z else: tmp = x / (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4e+54) || !(z <= 1.55e+80)) tmp = Float64(Float64(x / z) / z); else tmp = Float64(x / Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4e+54) || ~((z <= 1.55e+80))) tmp = (x / z) / z; else tmp = x / (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4e+54], N[Not[LessEqual[z, 1.55e+80]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+54} \lor \neg \left(z \leq 1.55 \cdot 10^{+80}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if z < -4.0000000000000003e54 or 1.54999999999999994e80 < z Initial program 74.0%
Taylor expanded in t around 0 71.0%
mul-1-neg71.0%
associate-/r*91.4%
distribute-neg-frac291.4%
neg-sub091.4%
sub-neg91.4%
+-commutative91.4%
associate--r+91.4%
neg-sub091.4%
remove-double-neg91.4%
Simplified91.4%
Taylor expanded in z around inf 83.2%
if -4.0000000000000003e54 < z < 1.54999999999999994e80Initial program 92.2%
Taylor expanded in t around inf 72.7%
Final simplification76.5%
(FPCore (x y z t) :precision binary64 (if (<= y -0.098) (/ (/ x (- t z)) y) (if (<= y 7.8e-121) (/ (/ x z) (- z t)) (/ (/ x t) (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.098) {
tmp = (x / (t - z)) / y;
} else if (y <= 7.8e-121) {
tmp = (x / z) / (z - t);
} else {
tmp = (x / t) / (y - z);
}
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 (y <= (-0.098d0)) then
tmp = (x / (t - z)) / y
else if (y <= 7.8d-121) then
tmp = (x / z) / (z - t)
else
tmp = (x / t) / (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.098) {
tmp = (x / (t - z)) / y;
} else if (y <= 7.8e-121) {
tmp = (x / z) / (z - t);
} else {
tmp = (x / t) / (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -0.098: tmp = (x / (t - z)) / y elif y <= 7.8e-121: tmp = (x / z) / (z - t) else: tmp = (x / t) / (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -0.098) tmp = Float64(Float64(x / Float64(t - z)) / y); elseif (y <= 7.8e-121) tmp = Float64(Float64(x / z) / Float64(z - t)); else tmp = Float64(Float64(x / t) / Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -0.098) tmp = (x / (t - z)) / y; elseif (y <= 7.8e-121) tmp = (x / z) / (z - t); else tmp = (x / t) / (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.098], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 7.8e-121], N[(N[(x / z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.098:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-121}:\\
\;\;\;\;\frac{\frac{x}{z}}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if y < -0.098000000000000004Initial program 80.1%
associate-/l/98.4%
Simplified98.4%
Taylor expanded in y around inf 84.8%
if -0.098000000000000004 < y < 7.80000000000000001e-121Initial program 93.7%
Taylor expanded in y around 0 76.7%
mul-1-neg76.7%
associate-/r*78.3%
distribute-neg-frac278.3%
sub-neg78.3%
+-commutative78.3%
distribute-neg-in78.3%
remove-double-neg78.3%
unsub-neg78.3%
Simplified78.3%
if 7.80000000000000001e-121 < y Initial program 81.9%
associate-/l/99.8%
Simplified99.8%
Taylor expanded in t around inf 61.1%
(FPCore (x y z t) :precision binary64 (if (<= y -0.2) (/ (/ x y) (- t z)) (if (<= y 8e-118) (/ (/ x z) (- z t)) (/ (/ x t) (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.2) {
tmp = (x / y) / (t - z);
} else if (y <= 8e-118) {
tmp = (x / z) / (z - t);
} else {
tmp = (x / t) / (y - z);
}
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 (y <= (-0.2d0)) then
tmp = (x / y) / (t - z)
else if (y <= 8d-118) then
tmp = (x / z) / (z - t)
else
tmp = (x / t) / (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.2) {
tmp = (x / y) / (t - z);
} else if (y <= 8e-118) {
tmp = (x / z) / (z - t);
} else {
tmp = (x / t) / (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -0.2: tmp = (x / y) / (t - z) elif y <= 8e-118: tmp = (x / z) / (z - t) else: tmp = (x / t) / (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -0.2) tmp = Float64(Float64(x / y) / Float64(t - z)); elseif (y <= 8e-118) tmp = Float64(Float64(x / z) / Float64(z - t)); else tmp = Float64(Float64(x / t) / Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -0.2) tmp = (x / y) / (t - z); elseif (y <= 8e-118) tmp = (x / z) / (z - t); else tmp = (x / t) / (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.2], N[(N[(x / y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e-118], N[(N[(x / z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.2:\\
\;\;\;\;\frac{\frac{x}{y}}{t - z}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-118}:\\
\;\;\;\;\frac{\frac{x}{z}}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if y < -0.20000000000000001Initial program 80.1%
Taylor expanded in y around inf 76.5%
associate-/r*80.9%
Simplified80.9%
if -0.20000000000000001 < y < 7.99999999999999988e-118Initial program 93.8%
Taylor expanded in y around 0 75.9%
mul-1-neg75.9%
associate-/r*77.4%
distribute-neg-frac277.4%
sub-neg77.4%
+-commutative77.4%
distribute-neg-in77.4%
remove-double-neg77.4%
unsub-neg77.4%
Simplified77.4%
if 7.99999999999999988e-118 < y Initial program 81.7%
associate-/l/99.8%
Simplified99.8%
Taylor expanded in t around inf 60.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.4e+56) (not (<= z 2.55e+64))) (/ (/ x z) z) (/ (/ x t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.4e+56) || !(z <= 2.55e+64)) {
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 <= (-3.4d+56)) .or. (.not. (z <= 2.55d+64))) 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 <= -3.4e+56) || !(z <= 2.55e+64)) {
tmp = (x / z) / z;
} else {
tmp = (x / t) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.4e+56) or not (z <= 2.55e+64): tmp = (x / z) / z else: tmp = (x / t) / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.4e+56) || !(z <= 2.55e+64)) tmp = Float64(Float64(x / z) / z); else tmp = Float64(Float64(x / t) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.4e+56) || ~((z <= 2.55e+64))) tmp = (x / z) / z; else tmp = (x / t) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.4e+56], N[Not[LessEqual[z, 2.55e+64]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+56} \lor \neg \left(z \leq 2.55 \cdot 10^{+64}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{y}\\
\end{array}
\end{array}
if z < -3.40000000000000001e56 or 2.55000000000000012e64 < z Initial program 74.7%
Taylor expanded in t around 0 70.8%
mul-1-neg70.8%
associate-/r*90.0%
distribute-neg-frac290.0%
neg-sub090.0%
sub-neg90.0%
+-commutative90.0%
associate--r+90.0%
neg-sub090.0%
remove-double-neg90.0%
Simplified90.0%
Taylor expanded in z around inf 80.4%
if -3.40000000000000001e56 < z < 2.55000000000000012e64Initial program 92.5%
associate-/l/96.8%
Simplified96.8%
Taylor expanded in t around inf 78.3%
Taylor expanded in y around inf 62.3%
Final simplification69.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.8e+121) (not (<= z 1e+124))) (/ (/ x z) y) (/ (/ x t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.8e+121) || !(z <= 1e+124)) {
tmp = (x / z) / y;
} 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 <= (-2.8d+121)) .or. (.not. (z <= 1d+124))) then
tmp = (x / z) / y
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 <= -2.8e+121) || !(z <= 1e+124)) {
tmp = (x / z) / y;
} else {
tmp = (x / t) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.8e+121) or not (z <= 1e+124): tmp = (x / z) / y else: tmp = (x / t) / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.8e+121) || !(z <= 1e+124)) tmp = Float64(Float64(x / z) / y); else tmp = Float64(Float64(x / t) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.8e+121) || ~((z <= 1e+124))) tmp = (x / z) / y; else tmp = (x / t) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.8e+121], N[Not[LessEqual[z, 1e+124]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+121} \lor \neg \left(z \leq 10^{+124}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{y}\\
\end{array}
\end{array}
if z < -2.80000000000000006e121 or 9.99999999999999948e123 < z Initial program 74.1%
Taylor expanded in y around inf 37.5%
associate-/r*37.9%
Simplified37.9%
Taylor expanded in t around 0 35.4%
associate-*r/35.4%
neg-mul-135.4%
*-commutative35.4%
Simplified35.4%
neg-sub035.4%
sub-neg35.4%
add-sqr-sqrt20.1%
sqrt-unprod39.2%
sqr-neg39.2%
sqrt-unprod15.5%
add-sqr-sqrt35.6%
Applied egg-rr35.6%
+-lft-identity35.6%
Simplified35.6%
Taylor expanded in x around 0 35.6%
associate-/l/41.4%
Simplified41.4%
if -2.80000000000000006e121 < z < 9.99999999999999948e123Initial program 90.4%
associate-/l/97.2%
Simplified97.2%
Taylor expanded in t around inf 73.8%
Taylor expanded in y around inf 58.3%
Final simplification53.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.1e+118) (not (<= z 2.25e+105))) (/ x (* z y)) (/ x (* t y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.1e+118) || !(z <= 2.25e+105)) {
tmp = x / (z * y);
} 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 <= (-2.1d+118)) .or. (.not. (z <= 2.25d+105))) then
tmp = x / (z * y)
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 <= -2.1e+118) || !(z <= 2.25e+105)) {
tmp = x / (z * y);
} else {
tmp = x / (t * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.1e+118) or not (z <= 2.25e+105): tmp = x / (z * y) else: tmp = x / (t * y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.1e+118) || !(z <= 2.25e+105)) tmp = Float64(x / Float64(z * y)); else tmp = Float64(x / Float64(t * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.1e+118) || ~((z <= 2.25e+105))) tmp = x / (z * y); else tmp = x / (t * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.1e+118], N[Not[LessEqual[z, 2.25e+105]], $MachinePrecision]], N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+118} \lor \neg \left(z \leq 2.25 \cdot 10^{+105}\right):\\
\;\;\;\;\frac{x}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t \cdot y}\\
\end{array}
\end{array}
if z < -2.1e118 or 2.2500000000000001e105 < z Initial program 75.1%
Taylor expanded in y around inf 37.5%
associate-/r*38.0%
Simplified38.0%
Taylor expanded in t around 0 34.3%
associate-*r/34.3%
neg-mul-134.3%
*-commutative34.3%
Simplified34.3%
neg-sub034.3%
sub-neg34.3%
add-sqr-sqrt19.3%
sqrt-unprod38.0%
sqr-neg38.0%
sqrt-unprod15.1%
add-sqr-sqrt34.5%
Applied egg-rr34.5%
+-lft-identity34.5%
Simplified34.5%
if -2.1e118 < z < 2.2500000000000001e105Initial program 90.2%
Taylor expanded in z around 0 52.7%
Final simplification47.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1e-122) (/ x (* z (- z y))) (if (<= z 2.45e+64) (/ (/ x t) y) (/ (/ x z) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e-122) {
tmp = x / (z * (z - y));
} else if (z <= 2.45e+64) {
tmp = (x / t) / y;
} else {
tmp = (x / z) / z;
}
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 <= (-1d-122)) then
tmp = x / (z * (z - y))
else if (z <= 2.45d+64) then
tmp = (x / t) / y
else
tmp = (x / z) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e-122) {
tmp = x / (z * (z - y));
} else if (z <= 2.45e+64) {
tmp = (x / t) / y;
} else {
tmp = (x / z) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1e-122: tmp = x / (z * (z - y)) elif z <= 2.45e+64: tmp = (x / t) / y else: tmp = (x / z) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1e-122) tmp = Float64(x / Float64(z * Float64(z - y))); elseif (z <= 2.45e+64) tmp = Float64(Float64(x / t) / y); else tmp = Float64(Float64(x / z) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1e-122) tmp = x / (z * (z - y)); elseif (z <= 2.45e+64) tmp = (x / t) / y; else tmp = (x / z) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1e-122], N[(x / N[(z * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.45e+64], N[(N[(x / t), $MachinePrecision] / y), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-122}:\\
\;\;\;\;\frac{x}{z \cdot \left(z - y\right)}\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+64}:\\
\;\;\;\;\frac{\frac{x}{t}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{z}\\
\end{array}
\end{array}
if z < -1.00000000000000006e-122Initial program 85.6%
Taylor expanded in t around 0 58.2%
mul-1-neg58.2%
distribute-rgt-neg-in58.2%
neg-sub058.2%
sub-neg58.2%
+-commutative58.2%
associate--r+58.2%
neg-sub058.2%
remove-double-neg58.2%
Simplified58.2%
if -1.00000000000000006e-122 < z < 2.4500000000000001e64Initial program 92.6%
associate-/l/95.8%
Simplified95.8%
Taylor expanded in t around inf 81.1%
Taylor expanded in y around inf 70.5%
if 2.4500000000000001e64 < z Initial program 71.9%
Taylor expanded in t around 0 65.5%
mul-1-neg65.5%
associate-/r*88.8%
distribute-neg-frac288.8%
neg-sub088.8%
sub-neg88.8%
+-commutative88.8%
associate--r+88.8%
neg-sub088.8%
remove-double-neg88.8%
Simplified88.8%
Taylor expanded in z around inf 80.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.75e+112) (/ x (* z y)) (/ (/ x t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.75e+112) {
tmp = x / (z * y);
} 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 <= (-1.75d+112)) then
tmp = x / (z * y)
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 <= -1.75e+112) {
tmp = x / (z * y);
} else {
tmp = (x / t) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.75e+112: tmp = x / (z * y) else: tmp = (x / t) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.75e+112) tmp = Float64(x / Float64(z * y)); else tmp = Float64(Float64(x / t) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.75e+112) tmp = x / (z * y); else tmp = (x / t) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.75e+112], N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+112}:\\
\;\;\;\;\frac{x}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{y}\\
\end{array}
\end{array}
if z < -1.74999999999999998e112Initial program 82.4%
Taylor expanded in y around inf 43.5%
associate-/r*40.7%
Simplified40.7%
Taylor expanded in t around 0 41.7%
associate-*r/41.7%
neg-mul-141.7%
*-commutative41.7%
Simplified41.7%
neg-sub041.7%
sub-neg41.7%
add-sqr-sqrt23.0%
sqrt-unprod48.3%
sqr-neg48.3%
sqrt-unprod18.8%
add-sqr-sqrt41.6%
Applied egg-rr41.6%
+-lft-identity41.6%
Simplified41.6%
if -1.74999999999999998e112 < z Initial program 86.1%
associate-/l/97.7%
Simplified97.7%
Taylor expanded in t around inf 65.9%
Taylor expanded in y around inf 51.1%
(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 85.6%
Taylor expanded in z around 0 42.9%
(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 2024135
(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))))