
(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 14 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}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ (/ x (- y z)) (- t z)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (x / (y - z)) / (t - z);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (x / (y - z)) / (t - z);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (x / (y - z)) / (t - z)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(x / Float64(y - z)) / Float64(t - z)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (x / (y - z)) / (t - z);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{\frac{x}{y - z}}{t - z}
\end{array}
Initial program 84.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6496.9
Applied rewrites96.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -3.8e+107) (/ (/ x (- z)) (- t z)) (if (<= z 3.4e+78) (/ x (* (- y z) (- t z))) (/ (/ x (- y z)) (- z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.8e+107) {
tmp = (x / -z) / (t - z);
} else if (z <= 3.4e+78) {
tmp = x / ((y - z) * (t - z));
} else {
tmp = (x / (y - z)) / -z;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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.8d+107)) then
tmp = (x / -z) / (t - z)
else if (z <= 3.4d+78) then
tmp = x / ((y - z) * (t - z))
else
tmp = (x / (y - z)) / -z
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.8e+107) {
tmp = (x / -z) / (t - z);
} else if (z <= 3.4e+78) {
tmp = x / ((y - z) * (t - z));
} else {
tmp = (x / (y - z)) / -z;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -3.8e+107: tmp = (x / -z) / (t - z) elif z <= 3.4e+78: tmp = x / ((y - z) * (t - z)) else: tmp = (x / (y - z)) / -z return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -3.8e+107) tmp = Float64(Float64(x / Float64(-z)) / Float64(t - z)); elseif (z <= 3.4e+78) tmp = Float64(x / Float64(Float64(y - z) * Float64(t - z))); else tmp = Float64(Float64(x / Float64(y - z)) / Float64(-z)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -3.8e+107)
tmp = (x / -z) / (t - z);
elseif (z <= 3.4e+78)
tmp = x / ((y - z) * (t - z));
else
tmp = (x / (y - z)) / -z;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -3.8e+107], N[(N[(x / (-z)), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.4e+78], N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+107}:\\
\;\;\;\;\frac{\frac{x}{-z}}{t - z}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+78}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y - z}}{-z}\\
\end{array}
\end{array}
if z < -3.7999999999999998e107Initial program 73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6487.0
Applied rewrites87.0%
if -3.7999999999999998e107 < z < 3.40000000000000007e78Initial program 91.2%
if 3.40000000000000007e78 < z Initial program 69.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6489.2
Applied rewrites89.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (* z (- z t)))))
(if (<= z -4e-24)
t_1
(if (<= z 1.8e-22)
(/ x (* (- y z) t))
(if (<= z 0.00034) (/ x (* y (- z))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = x / (z * (z - t));
double tmp;
if (z <= -4e-24) {
tmp = t_1;
} else if (z <= 1.8e-22) {
tmp = x / ((y - z) * t);
} else if (z <= 0.00034) {
tmp = x / (y * -z);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 * (z - t))
if (z <= (-4d-24)) then
tmp = t_1
else if (z <= 1.8d-22) then
tmp = x / ((y - z) * t)
else if (z <= 0.00034d0) then
tmp = x / (y * -z)
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = x / (z * (z - t));
double tmp;
if (z <= -4e-24) {
tmp = t_1;
} else if (z <= 1.8e-22) {
tmp = x / ((y - z) * t);
} else if (z <= 0.00034) {
tmp = x / (y * -z);
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = x / (z * (z - t)) tmp = 0 if z <= -4e-24: tmp = t_1 elif z <= 1.8e-22: tmp = x / ((y - z) * t) elif z <= 0.00034: tmp = x / (y * -z) else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(x / Float64(z * Float64(z - t))) tmp = 0.0 if (z <= -4e-24) tmp = t_1; elseif (z <= 1.8e-22) tmp = Float64(x / Float64(Float64(y - z) * t)); elseif (z <= 0.00034) tmp = Float64(x / Float64(y * Float64(-z))); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = x / (z * (z - t));
tmp = 0.0;
if (z <= -4e-24)
tmp = t_1;
elseif (z <= 1.8e-22)
tmp = x / ((y - z) * t);
elseif (z <= 0.00034)
tmp = x / (y * -z);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e-24], t$95$1, If[LessEqual[z, 1.8e-22], N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00034], N[(x / N[(y * (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot \left(z - t\right)}\\
\mathbf{if}\;z \leq -4 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-22}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\
\mathbf{elif}\;z \leq 0.00034:\\
\;\;\;\;\frac{x}{y \cdot \left(-z\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.99999999999999969e-24 or 3.4e-4 < z Initial program 76.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
lower--.f6470.9
Applied rewrites70.9%
if -3.99999999999999969e-24 < z < 1.7999999999999999e-22Initial program 91.6%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f6475.8
Applied rewrites75.8%
if 1.7999999999999999e-22 < z < 3.4e-4Initial program 94.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.0
Applied rewrites71.0%
Taylor expanded in t around 0
Applied rewrites63.2%
Final simplification73.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -3.8e+107) (/ (/ x (- z)) (- t z)) (if (<= z 1.4e+89) (/ x (* (- y z) (- t z))) (/ (/ x z) (- z y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.8e+107) {
tmp = (x / -z) / (t - z);
} else if (z <= 1.4e+89) {
tmp = x / ((y - z) * (t - z));
} else {
tmp = (x / z) / (z - y);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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.8d+107)) then
tmp = (x / -z) / (t - z)
else if (z <= 1.4d+89) then
tmp = x / ((y - z) * (t - z))
else
tmp = (x / z) / (z - y)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.8e+107) {
tmp = (x / -z) / (t - z);
} else if (z <= 1.4e+89) {
tmp = x / ((y - z) * (t - z));
} else {
tmp = (x / z) / (z - y);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -3.8e+107: tmp = (x / -z) / (t - z) elif z <= 1.4e+89: tmp = x / ((y - z) * (t - z)) else: tmp = (x / z) / (z - y) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -3.8e+107) tmp = Float64(Float64(x / Float64(-z)) / Float64(t - z)); elseif (z <= 1.4e+89) tmp = Float64(x / Float64(Float64(y - z) * Float64(t - z))); else tmp = Float64(Float64(x / z) / Float64(z - y)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -3.8e+107)
tmp = (x / -z) / (t - z);
elseif (z <= 1.4e+89)
tmp = x / ((y - z) * (t - z));
else
tmp = (x / z) / (z - y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -3.8e+107], N[(N[(x / (-z)), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+89], N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+107}:\\
\;\;\;\;\frac{\frac{x}{-z}}{t - z}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+89}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{z - y}\\
\end{array}
\end{array}
if z < -3.7999999999999998e107Initial program 73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6487.0
Applied rewrites87.0%
if -3.7999999999999998e107 < z < 1.3999999999999999e89Initial program 91.2%
if 1.3999999999999999e89 < z Initial program 68.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
lower-/.f6491.4
Applied rewrites91.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (/ x z) (- z y)))) (if (<= z -1e+141) t_1 (if (<= z 1.4e+89) (/ x (* (- y z) (- t z))) t_1))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = (x / z) / (z - y);
double tmp;
if (z <= -1e+141) {
tmp = t_1;
} else if (z <= 1.4e+89) {
tmp = x / ((y - z) * (t - z));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) / (z - y)
if (z <= (-1d+141)) then
tmp = t_1
else if (z <= 1.4d+89) then
tmp = x / ((y - z) * (t - z))
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = (x / z) / (z - y);
double tmp;
if (z <= -1e+141) {
tmp = t_1;
} else if (z <= 1.4e+89) {
tmp = x / ((y - z) * (t - z));
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = (x / z) / (z - y) tmp = 0 if z <= -1e+141: tmp = t_1 elif z <= 1.4e+89: tmp = x / ((y - z) * (t - z)) else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(Float64(x / z) / Float64(z - y)) tmp = 0.0 if (z <= -1e+141) tmp = t_1; elseif (z <= 1.4e+89) tmp = Float64(x / Float64(Float64(y - z) * Float64(t - z))); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = (x / z) / (z - y);
tmp = 0.0;
if (z <= -1e+141)
tmp = t_1;
elseif (z <= 1.4e+89)
tmp = x / ((y - z) * (t - z));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e+141], t$95$1, If[LessEqual[z, 1.4e+89], N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{\frac{x}{z}}{z - y}\\
\mathbf{if}\;z \leq -1 \cdot 10^{+141}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+89}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.00000000000000002e141 or 1.3999999999999999e89 < z Initial program 67.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
lower-/.f6491.2
Applied rewrites91.2%
if -1.00000000000000002e141 < z < 1.3999999999999999e89Initial program 90.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (* z z))))
(if (<= z -3.2e+37)
t_1
(if (<= z 1.8e-22)
(/ x (* (- y z) t))
(if (<= z 2.3e+35) (/ x (* y (- z))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = x / (z * z);
double tmp;
if (z <= -3.2e+37) {
tmp = t_1;
} else if (z <= 1.8e-22) {
tmp = x / ((y - z) * t);
} else if (z <= 2.3e+35) {
tmp = x / (y * -z);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 * z)
if (z <= (-3.2d+37)) then
tmp = t_1
else if (z <= 1.8d-22) then
tmp = x / ((y - z) * t)
else if (z <= 2.3d+35) then
tmp = x / (y * -z)
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = x / (z * z);
double tmp;
if (z <= -3.2e+37) {
tmp = t_1;
} else if (z <= 1.8e-22) {
tmp = x / ((y - z) * t);
} else if (z <= 2.3e+35) {
tmp = x / (y * -z);
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = x / (z * z) tmp = 0 if z <= -3.2e+37: tmp = t_1 elif z <= 1.8e-22: tmp = x / ((y - z) * t) elif z <= 2.3e+35: tmp = x / (y * -z) else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(x / Float64(z * z)) tmp = 0.0 if (z <= -3.2e+37) tmp = t_1; elseif (z <= 1.8e-22) tmp = Float64(x / Float64(Float64(y - z) * t)); elseif (z <= 2.3e+35) tmp = Float64(x / Float64(y * Float64(-z))); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = x / (z * z);
tmp = 0.0;
if (z <= -3.2e+37)
tmp = t_1;
elseif (z <= 1.8e-22)
tmp = x / ((y - z) * t);
elseif (z <= 2.3e+35)
tmp = x / (y * -z);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+37], t$95$1, If[LessEqual[z, 1.8e-22], N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e+35], N[(x / N[(y * (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot z}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-22}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{y \cdot \left(-z\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.20000000000000014e37 or 2.2999999999999998e35 < z Initial program 73.5%
Taylor expanded in z around inf
unpow2N/A
lower-*.f6466.2
Applied rewrites66.2%
if -3.20000000000000014e37 < z < 1.7999999999999999e-22Initial program 92.0%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f6475.0
Applied rewrites75.0%
if 1.7999999999999999e-22 < z < 2.2999999999999998e35Initial program 97.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.6
Applied rewrites52.6%
Taylor expanded in t around 0
Applied rewrites48.1%
Final simplification69.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (* z z))))
(if (<= z -4e-24)
t_1
(if (<= z 1.02e-27)
(/ x (* y t))
(if (<= z 2.3e+35) (/ x (* y (- z))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = x / (z * z);
double tmp;
if (z <= -4e-24) {
tmp = t_1;
} else if (z <= 1.02e-27) {
tmp = x / (y * t);
} else if (z <= 2.3e+35) {
tmp = x / (y * -z);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 * z)
if (z <= (-4d-24)) then
tmp = t_1
else if (z <= 1.02d-27) then
tmp = x / (y * t)
else if (z <= 2.3d+35) then
tmp = x / (y * -z)
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = x / (z * z);
double tmp;
if (z <= -4e-24) {
tmp = t_1;
} else if (z <= 1.02e-27) {
tmp = x / (y * t);
} else if (z <= 2.3e+35) {
tmp = x / (y * -z);
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = x / (z * z) tmp = 0 if z <= -4e-24: tmp = t_1 elif z <= 1.02e-27: tmp = x / (y * t) elif z <= 2.3e+35: tmp = x / (y * -z) else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(x / Float64(z * z)) tmp = 0.0 if (z <= -4e-24) tmp = t_1; elseif (z <= 1.02e-27) tmp = Float64(x / Float64(y * t)); elseif (z <= 2.3e+35) tmp = Float64(x / Float64(y * Float64(-z))); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = x / (z * z);
tmp = 0.0;
if (z <= -4e-24)
tmp = t_1;
elseif (z <= 1.02e-27)
tmp = x / (y * t);
elseif (z <= 2.3e+35)
tmp = x / (y * -z);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e-24], t$95$1, If[LessEqual[z, 1.02e-27], N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e+35], N[(x / N[(y * (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot z}\\
\mathbf{if}\;z \leq -4 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-27}:\\
\;\;\;\;\frac{x}{y \cdot t}\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{y \cdot \left(-z\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.99999999999999969e-24 or 2.2999999999999998e35 < z Initial program 75.3%
Taylor expanded in z around inf
unpow2N/A
lower-*.f6464.3
Applied rewrites64.3%
if -3.99999999999999969e-24 < z < 1.02000000000000002e-27Initial program 91.6%
Taylor expanded in z around 0
lower-*.f6458.7
Applied rewrites58.7%
if 1.02000000000000002e-27 < z < 2.2999999999999998e35Initial program 97.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.6
Applied rewrites52.6%
Taylor expanded in t around 0
Applied rewrites48.1%
Final simplification60.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1.95e-62) (/ x (* y (- t z))) (if (<= y 6.6e-214) (/ x (* z (- z t))) (/ x (* (- y z) t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-62) {
tmp = x / (y * (t - z));
} else if (y <= 6.6e-214) {
tmp = x / (z * (z - t));
} else {
tmp = x / ((y - z) * t);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= (-1.95d-62)) then
tmp = x / (y * (t - z))
else if (y <= 6.6d-214) then
tmp = x / (z * (z - t))
else
tmp = x / ((y - z) * t)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-62) {
tmp = x / (y * (t - z));
} else if (y <= 6.6e-214) {
tmp = x / (z * (z - t));
} else {
tmp = x / ((y - z) * t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -1.95e-62: tmp = x / (y * (t - z)) elif y <= 6.6e-214: tmp = x / (z * (z - t)) else: tmp = x / ((y - z) * t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1.95e-62) tmp = Float64(x / Float64(y * Float64(t - z))); elseif (y <= 6.6e-214) tmp = Float64(x / Float64(z * Float64(z - t))); else tmp = Float64(x / Float64(Float64(y - z) * t)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1.95e-62)
tmp = x / (y * (t - z));
elseif (y <= 6.6e-214)
tmp = x / (z * (z - t));
else
tmp = x / ((y - z) * t);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -1.95e-62], N[(x / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e-214], N[(x / N[(z * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-62}:\\
\;\;\;\;\frac{x}{y \cdot \left(t - z\right)}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-214}:\\
\;\;\;\;\frac{x}{z \cdot \left(z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if y < -1.9500000000000002e-62Initial program 87.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6484.2
Applied rewrites84.2%
if -1.9500000000000002e-62 < y < 6.5999999999999996e-214Initial program 84.1%
Taylor expanded in y around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
lower--.f6475.5
Applied rewrites75.5%
if 6.5999999999999996e-214 < y Initial program 83.2%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f6451.6
Applied rewrites51.6%
Final simplification68.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (/ x (* (- y z) t)))) (if (<= t -4.6e-160) t_1 (if (<= t 6.8e-56) (/ x (* z (- z y))) t_1))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = x / ((y - z) * t);
double tmp;
if (t <= -4.6e-160) {
tmp = t_1;
} else if (t <= 6.8e-56) {
tmp = x / (z * (z - y));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 / ((y - z) * t)
if (t <= (-4.6d-160)) then
tmp = t_1
else if (t <= 6.8d-56) then
tmp = x / (z * (z - y))
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = x / ((y - z) * t);
double tmp;
if (t <= -4.6e-160) {
tmp = t_1;
} else if (t <= 6.8e-56) {
tmp = x / (z * (z - y));
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = x / ((y - z) * t) tmp = 0 if t <= -4.6e-160: tmp = t_1 elif t <= 6.8e-56: tmp = x / (z * (z - y)) else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(x / Float64(Float64(y - z) * t)) tmp = 0.0 if (t <= -4.6e-160) tmp = t_1; elseif (t <= 6.8e-56) tmp = Float64(x / Float64(z * Float64(z - y))); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = x / ((y - z) * t);
tmp = 0.0;
if (t <= -4.6e-160)
tmp = t_1;
elseif (t <= 6.8e-56)
tmp = x / (z * (z - y));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.6e-160], t$95$1, If[LessEqual[t, 6.8e-56], N[(x / N[(z * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x}{\left(y - z\right) \cdot t}\\
\mathbf{if}\;t \leq -4.6 \cdot 10^{-160}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{-56}:\\
\;\;\;\;\frac{x}{z \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.5999999999999997e-160 or 6.79999999999999964e-56 < t Initial program 86.0%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f6472.7
Applied rewrites72.7%
if -4.5999999999999997e-160 < t < 6.79999999999999964e-56Initial program 82.4%
Taylor expanded in t around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6466.4
Applied rewrites66.4%
Final simplification70.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1.65e+175) (/ (/ x y) (- t z)) (/ x (* (- y z) (- t z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e+175) {
tmp = (x / y) / (t - z);
} else {
tmp = x / ((y - z) * (t - z));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 <= (-1.65d+175)) then
tmp = (x / y) / (t - z)
else
tmp = x / ((y - z) * (t - z))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e+175) {
tmp = (x / y) / (t - z);
} else {
tmp = x / ((y - z) * (t - z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -1.65e+175: tmp = (x / y) / (t - z) else: tmp = x / ((y - z) * (t - z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1.65e+175) tmp = Float64(Float64(x / y) / Float64(t - z)); else tmp = Float64(x / Float64(Float64(y - z) * Float64(t - z))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1.65e+175)
tmp = (x / y) / (t - z);
else
tmp = x / ((y - z) * (t - z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -1.65e+175], N[(N[(x / y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+175}:\\
\;\;\;\;\frac{\frac{x}{y}}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\
\end{array}
\end{array}
if y < -1.6500000000000001e175Initial program 81.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6496.7
Applied rewrites96.7%
Taylor expanded in y around inf
lower-/.f6496.7
Applied rewrites96.7%
if -1.6500000000000001e175 < y Initial program 85.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (/ x (* z z)))) (if (<= z -4e-24) t_1 (if (<= z 0.00034) (/ x (* y t)) t_1))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = x / (z * z);
double tmp;
if (z <= -4e-24) {
tmp = t_1;
} else if (z <= 0.00034) {
tmp = x / (y * t);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 * z)
if (z <= (-4d-24)) then
tmp = t_1
else if (z <= 0.00034d0) then
tmp = x / (y * t)
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = x / (z * z);
double tmp;
if (z <= -4e-24) {
tmp = t_1;
} else if (z <= 0.00034) {
tmp = x / (y * t);
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = x / (z * z) tmp = 0 if z <= -4e-24: tmp = t_1 elif z <= 0.00034: tmp = x / (y * t) else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(x / Float64(z * z)) tmp = 0.0 if (z <= -4e-24) tmp = t_1; elseif (z <= 0.00034) tmp = Float64(x / Float64(y * t)); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = x / (z * z);
tmp = 0.0;
if (z <= -4e-24)
tmp = t_1;
elseif (z <= 0.00034)
tmp = x / (y * t);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e-24], t$95$1, If[LessEqual[z, 0.00034], N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot z}\\
\mathbf{if}\;z \leq -4 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.00034:\\
\;\;\;\;\frac{x}{y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.99999999999999969e-24 or 3.4e-4 < z Initial program 76.8%
Taylor expanded in z around inf
unpow2N/A
lower-*.f6462.2
Applied rewrites62.2%
if -3.99999999999999969e-24 < z < 3.4e-4Initial program 91.7%
Taylor expanded in z around 0
lower-*.f6455.9
Applied rewrites55.9%
Final simplification58.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ (/ x (- t z)) (- y z)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (x / (t - z)) / (y - z);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (x / (t - z)) / (y - z);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (x / (t - z)) / (y - z)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(x / Float64(t - z)) / Float64(y - z)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (x / (t - z)) / (y - z);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{\frac{x}{t - z}}{y - z}
\end{array}
Initial program 84.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-/.f6496.8
Applied rewrites96.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return x / ((y - z) * (t - z))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(x / Float64(Float64(y - z) * Float64(t - z))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = x / ((y - z) * (t - z));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\end{array}
Initial program 84.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ x (* y t)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return x / (y * t);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 * t)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return x / (y * t);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return x / (y * t)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(x / Float64(y * t)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = x / (y * t);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{x}{y \cdot t}
\end{array}
Initial program 84.8%
Taylor expanded in z around 0
lower-*.f6436.8
Applied rewrites36.8%
Final simplification36.8%
(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 2024220
(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))))