
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * y) - (z * y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
def code(x, y, z, t): return ((x * y) - (z * y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x * y) - Float64(z * y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x * y) - (z * y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y - z \cdot y\right) \cdot t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * y) - (z * y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
def code(x, y, z, t): return ((x * y) - (z * y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x * y) - Float64(z * y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x * y) - (z * y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y - z \cdot y\right) \cdot t
\end{array}
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 1.7e-36) (* y (* t (- x z))) (* (- x z) (* t y))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.7e-36) {
tmp = y * (t * (x - z));
} else {
tmp = (x - z) * (t * y);
}
return tmp;
}
NOTE: y 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 (t <= 1.7d-36) then
tmp = y * (t * (x - z))
else
tmp = (x - z) * (t * y)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.7e-36) {
tmp = y * (t * (x - z));
} else {
tmp = (x - z) * (t * y);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if t <= 1.7e-36: tmp = y * (t * (x - z)) else: tmp = (x - z) * (t * y) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 1.7e-36) tmp = Float64(y * Float64(t * Float64(x - z))); else tmp = Float64(Float64(x - z) * Float64(t * y)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= 1.7e-36)
tmp = y * (t * (x - z));
else
tmp = (x - z) * (t * y);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, 1.7e-36], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(t * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.7 \cdot 10^{-36}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right)\\
\end{array}
\end{array}
if t < 1.7000000000000001e-36Initial program 86.2%
distribute-rgt-out--87.9%
associate-*l*97.1%
Simplified97.1%
if 1.7000000000000001e-36 < t Initial program 93.6%
distribute-rgt-out--93.6%
Simplified93.6%
add-cube-cbrt92.6%
pow392.6%
Applied egg-rr92.6%
unpow392.6%
add-cube-cbrt93.6%
associate-*r*86.1%
*-commutative86.1%
flip--74.1%
div-inv74.1%
associate-*l*69.0%
*-commutative69.0%
div-inv69.0%
clear-num69.0%
un-div-inv69.1%
clear-num69.0%
div-inv69.0%
*-commutative69.0%
associate-*l*74.1%
div-inv74.1%
flip--86.1%
*-commutative86.1%
Applied egg-rr86.1%
Taylor expanded in y around 0 86.1%
associate-*r*98.6%
*-commutative98.6%
Simplified98.6%
Final simplification97.5%
NOTE: y and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* t x))) (t_2 (* y (* t (- z)))))
(if (<= z -5.5e-55)
t_2
(if (<= z 4.2e-133)
t_1
(if (<= z 1.12e+14) t_2 (if (<= z 9.5e+51) t_1 (* t (* y (- z)))))))))assert(y < t);
double code(double x, double y, double z, double t) {
double t_1 = y * (t * x);
double t_2 = y * (t * -z);
double tmp;
if (z <= -5.5e-55) {
tmp = t_2;
} else if (z <= 4.2e-133) {
tmp = t_1;
} else if (z <= 1.12e+14) {
tmp = t_2;
} else if (z <= 9.5e+51) {
tmp = t_1;
} else {
tmp = t * (y * -z);
}
return tmp;
}
NOTE: y 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) :: t_2
real(8) :: tmp
t_1 = y * (t * x)
t_2 = y * (t * -z)
if (z <= (-5.5d-55)) then
tmp = t_2
else if (z <= 4.2d-133) then
tmp = t_1
else if (z <= 1.12d+14) then
tmp = t_2
else if (z <= 9.5d+51) then
tmp = t_1
else
tmp = t * (y * -z)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t * x);
double t_2 = y * (t * -z);
double tmp;
if (z <= -5.5e-55) {
tmp = t_2;
} else if (z <= 4.2e-133) {
tmp = t_1;
} else if (z <= 1.12e+14) {
tmp = t_2;
} else if (z <= 9.5e+51) {
tmp = t_1;
} else {
tmp = t * (y * -z);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): t_1 = y * (t * x) t_2 = y * (t * -z) tmp = 0 if z <= -5.5e-55: tmp = t_2 elif z <= 4.2e-133: tmp = t_1 elif z <= 1.12e+14: tmp = t_2 elif z <= 9.5e+51: tmp = t_1 else: tmp = t * (y * -z) return tmp
y, t = sort([y, t]) function code(x, y, z, t) t_1 = Float64(y * Float64(t * x)) t_2 = Float64(y * Float64(t * Float64(-z))) tmp = 0.0 if (z <= -5.5e-55) tmp = t_2; elseif (z <= 4.2e-133) tmp = t_1; elseif (z <= 1.12e+14) tmp = t_2; elseif (z <= 9.5e+51) tmp = t_1; else tmp = Float64(t * Float64(y * Float64(-z))); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = y * (t * x);
t_2 = y * (t * -z);
tmp = 0.0;
if (z <= -5.5e-55)
tmp = t_2;
elseif (z <= 4.2e-133)
tmp = t_1;
elseif (z <= 1.12e+14)
tmp = t_2;
elseif (z <= 9.5e+51)
tmp = t_1;
else
tmp = t * (y * -z);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t * (-z)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e-55], t$95$2, If[LessEqual[z, 4.2e-133], t$95$1, If[LessEqual[z, 1.12e+14], t$95$2, If[LessEqual[z, 9.5e+51], t$95$1, N[(t * N[(y * (-z)), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
t_1 := y \cdot \left(t \cdot x\right)\\
t_2 := y \cdot \left(t \cdot \left(-z\right)\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{-55}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-133}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+14}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+51}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if z < -5.4999999999999999e-55 or 4.2000000000000002e-133 < z < 1.12e14Initial program 87.4%
distribute-rgt-out--88.5%
associate-*l*93.0%
Simplified93.0%
Taylor expanded in x around 0 76.8%
mul-1-neg76.8%
*-commutative76.8%
distribute-rgt-neg-in76.8%
Simplified76.8%
if -5.4999999999999999e-55 < z < 4.2000000000000002e-133 or 1.12e14 < z < 9.4999999999999999e51Initial program 90.5%
distribute-rgt-out--90.5%
associate-*l*97.6%
Simplified97.6%
Taylor expanded in x around inf 88.0%
if 9.4999999999999999e51 < z Initial program 86.8%
distribute-rgt-out--89.9%
Simplified89.9%
Taylor expanded in x around 0 77.0%
mul-1-neg77.0%
distribute-rgt-neg-out77.0%
Simplified77.0%
Final simplification80.8%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x -1.4e+45) (* t (* y x)) (if (<= x 3.8e+110) (* y (* t (- z))) (* x (* t y)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.4e+45) {
tmp = t * (y * x);
} else if (x <= 3.8e+110) {
tmp = y * (t * -z);
} else {
tmp = x * (t * y);
}
return tmp;
}
NOTE: y 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 (x <= (-1.4d+45)) then
tmp = t * (y * x)
else if (x <= 3.8d+110) then
tmp = y * (t * -z)
else
tmp = x * (t * y)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.4e+45) {
tmp = t * (y * x);
} else if (x <= 3.8e+110) {
tmp = y * (t * -z);
} else {
tmp = x * (t * y);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if x <= -1.4e+45: tmp = t * (y * x) elif x <= 3.8e+110: tmp = y * (t * -z) else: tmp = x * (t * y) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (x <= -1.4e+45) tmp = Float64(t * Float64(y * x)); elseif (x <= 3.8e+110) tmp = Float64(y * Float64(t * Float64(-z))); else tmp = Float64(x * Float64(t * y)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= -1.4e+45)
tmp = t * (y * x);
elseif (x <= 3.8e+110)
tmp = y * (t * -z);
else
tmp = x * (t * y);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, -1.4e+45], N[(t * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.8e+110], N[(y * N[(t * (-z)), $MachinePrecision]), $MachinePrecision], N[(x * N[(t * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+45}:\\
\;\;\;\;t \cdot \left(y \cdot x\right)\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+110}:\\
\;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t \cdot y\right)\\
\end{array}
\end{array}
if x < -1.4e45Initial program 93.1%
distribute-rgt-out--95.0%
Simplified95.0%
Taylor expanded in x around inf 78.9%
if -1.4e45 < x < 3.79999999999999989e110Initial program 87.5%
distribute-rgt-out--88.1%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in x around 0 78.4%
mul-1-neg78.4%
*-commutative78.4%
distribute-rgt-neg-in78.4%
Simplified78.4%
if 3.79999999999999989e110 < x Initial program 84.1%
distribute-rgt-out--87.3%
Simplified87.3%
add-cube-cbrt86.2%
pow386.1%
Applied egg-rr86.1%
unpow386.2%
add-cube-cbrt87.3%
associate-*r*78.3%
*-commutative78.3%
flip--27.7%
div-inv27.7%
associate-*l*21.7%
*-commutative21.7%
div-inv21.7%
clear-num21.7%
un-div-inv21.8%
clear-num21.7%
div-inv21.8%
*-commutative21.8%
associate-*l*27.6%
div-inv27.7%
flip--78.4%
*-commutative78.4%
Applied egg-rr78.4%
Taylor expanded in x around inf 68.9%
associate-*r*81.2%
*-commutative81.2%
Simplified81.2%
Final simplification78.8%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 1.65e-71) (* y (* t (- x z))) (* t (* y (- x z)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e-71) {
tmp = y * (t * (x - z));
} else {
tmp = t * (y * (x - z));
}
return tmp;
}
NOTE: y 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 (t <= 1.65d-71) then
tmp = y * (t * (x - z))
else
tmp = t * (y * (x - z))
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e-71) {
tmp = y * (t * (x - z));
} else {
tmp = t * (y * (x - z));
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if t <= 1.65e-71: tmp = y * (t * (x - z)) else: tmp = t * (y * (x - z)) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 1.65e-71) tmp = Float64(y * Float64(t * Float64(x - z))); else tmp = Float64(t * Float64(y * Float64(x - z))); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= 1.65e-71)
tmp = y * (t * (x - z));
else
tmp = t * (y * (x - z));
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, 1.65e-71], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.65 \cdot 10^{-71}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\end{array}
\end{array}
if t < 1.6500000000000001e-71Initial program 86.2%
distribute-rgt-out--87.5%
associate-*l*97.0%
Simplified97.0%
if 1.6500000000000001e-71 < t Initial program 92.9%
distribute-rgt-out--94.1%
Simplified94.1%
Final simplification96.1%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 1.75e-139) (* y (* t x)) (* x (* t y))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.75e-139) {
tmp = y * (t * x);
} else {
tmp = x * (t * y);
}
return tmp;
}
NOTE: y 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 (t <= 1.75d-139) then
tmp = y * (t * x)
else
tmp = x * (t * y)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.75e-139) {
tmp = y * (t * x);
} else {
tmp = x * (t * y);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if t <= 1.75e-139: tmp = y * (t * x) else: tmp = x * (t * y) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 1.75e-139) tmp = Float64(y * Float64(t * x)); else tmp = Float64(x * Float64(t * y)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= 1.75e-139)
tmp = y * (t * x);
else
tmp = x * (t * y);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, 1.75e-139], N[(y * N[(t * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(t * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.75 \cdot 10^{-139}:\\
\;\;\;\;y \cdot \left(t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t \cdot y\right)\\
\end{array}
\end{array}
if t < 1.75000000000000001e-139Initial program 86.0%
distribute-rgt-out--87.4%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in x around inf 49.7%
if 1.75000000000000001e-139 < t Initial program 92.1%
distribute-rgt-out--93.1%
Simplified93.1%
add-cube-cbrt92.0%
pow392.0%
Applied egg-rr92.0%
unpow392.0%
add-cube-cbrt93.1%
associate-*r*89.3%
*-commutative89.3%
flip--71.3%
div-inv71.2%
associate-*l*67.3%
*-commutative67.3%
div-inv67.3%
clear-num67.3%
un-div-inv67.4%
clear-num67.3%
div-inv67.3%
*-commutative67.3%
associate-*l*71.2%
div-inv71.3%
flip--89.3%
*-commutative89.3%
Applied egg-rr89.3%
Taylor expanded in x around inf 46.7%
associate-*r*51.5%
*-commutative51.5%
Simplified51.5%
Final simplification50.4%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -9.5e+55) (* y (* t x)) (* t (* y x))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e+55) {
tmp = y * (t * x);
} else {
tmp = t * (y * x);
}
return tmp;
}
NOTE: y 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 <= (-9.5d+55)) then
tmp = y * (t * x)
else
tmp = t * (y * x)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e+55) {
tmp = y * (t * x);
} else {
tmp = t * (y * x);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if y <= -9.5e+55: tmp = y * (t * x) else: tmp = t * (y * x) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -9.5e+55) tmp = Float64(y * Float64(t * x)); else tmp = Float64(t * Float64(y * x)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -9.5e+55)
tmp = y * (t * x);
else
tmp = t * (y * x);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -9.5e+55], N[(y * N[(t * x), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+55}:\\
\;\;\;\;y \cdot \left(t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if y < -9.49999999999999989e55Initial program 75.2%
distribute-rgt-out--79.5%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around inf 51.2%
if -9.49999999999999989e55 < y Initial program 91.3%
distribute-rgt-out--91.8%
Simplified91.8%
Taylor expanded in x around inf 49.2%
Final simplification49.5%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* y (* t (- x z))))
assert(y < t);
double code(double x, double y, double z, double t) {
return y * (t * (x - z));
}
NOTE: y 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 = y * (t * (x - z))
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
return y * (t * (x - z));
}
[y, t] = sort([y, t]) def code(x, y, z, t): return y * (t * (x - z))
y, t = sort([y, t]) function code(x, y, z, t) return Float64(y * Float64(t * Float64(x - z))) end
y, t = num2cell(sort([y, t])){:}
function tmp = code(x, y, z, t)
tmp = y * (t * (x - z));
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
y \cdot \left(t \cdot \left(x - z\right)\right)
\end{array}
Initial program 88.4%
distribute-rgt-out--89.6%
associate-*l*93.9%
Simplified93.9%
Final simplification93.9%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* x (* t y)))
assert(y < t);
double code(double x, double y, double z, double t) {
return x * (t * y);
}
NOTE: y 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 * y)
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
return x * (t * y);
}
[y, t] = sort([y, t]) def code(x, y, z, t): return x * (t * y)
y, t = sort([y, t]) function code(x, y, z, t) return Float64(x * Float64(t * y)) end
y, t = num2cell(sort([y, t])){:}
function tmp = code(x, y, z, t)
tmp = x * (t * y);
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x * N[(t * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
x \cdot \left(t \cdot y\right)
\end{array}
Initial program 88.4%
distribute-rgt-out--89.6%
Simplified89.6%
add-cube-cbrt88.6%
pow388.6%
Applied egg-rr88.6%
unpow388.6%
add-cube-cbrt89.6%
associate-*r*93.9%
*-commutative93.9%
flip--68.2%
div-inv68.2%
associate-*l*65.2%
*-commutative65.2%
div-inv65.2%
clear-num65.2%
un-div-inv65.2%
clear-num65.2%
div-inv65.1%
*-commutative65.1%
associate-*l*68.1%
div-inv68.2%
flip--93.8%
*-commutative93.8%
Applied egg-rr93.8%
Taylor expanded in x around inf 48.6%
associate-*r*46.0%
*-commutative46.0%
Simplified46.0%
Final simplification46.0%
(FPCore (x y z t) :precision binary64 (if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t < -9.231879582886777e-80) {
tmp = (y * t) * (x - z);
} else if (t < 2.543067051564877e+83) {
tmp = y * (t * (x - z));
} else {
tmp = (y * (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 < (-9.231879582886777d-80)) then
tmp = (y * t) * (x - z)
else if (t < 2.543067051564877d+83) then
tmp = y * (t * (x - z))
else
tmp = (y * (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 < -9.231879582886777e-80) {
tmp = (y * t) * (x - z);
} else if (t < 2.543067051564877e+83) {
tmp = y * (t * (x - z));
} else {
tmp = (y * (x - z)) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t < -9.231879582886777e-80: tmp = (y * t) * (x - z) elif t < 2.543067051564877e+83: tmp = y * (t * (x - z)) else: tmp = (y * (x - z)) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t < -9.231879582886777e-80) tmp = Float64(Float64(y * t) * Float64(x - z)); elseif (t < 2.543067051564877e+83) tmp = Float64(y * Float64(t * Float64(x - z))); else tmp = Float64(Float64(y * Float64(x - z)) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t < -9.231879582886777e-80) tmp = (y * t) * (x - z); elseif (t < 2.543067051564877e+83) tmp = y * (t * (x - z)); else tmp = (y * (x - z)) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[t, -9.231879582886777e-80], N[(N[(y * t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], If[Less[t, 2.543067051564877e+83], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t < -9.231879582886777 \cdot 10^{-80}:\\
\;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\
\mathbf{elif}\;t < 2.543067051564877 \cdot 10^{+83}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\
\end{array}
\end{array}
herbie shell --seed 2023200
(FPCore (x y z t)
:name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))
(* (- (* x y) (* z y)) t))