To calculate a beta, I was using the following formula(Considering $ra$ as returns of $a$ and $rb$ as returns of $b$):
$$ \beta = { cov(ra, rb) \over var(rb)} $$
As a software developer, I programmed a function that returns this value. When creating tests, I created some simulated data, thinking that it would have a beta of $0.5$:
$$ a = [0.1, 0.2, 0.4, 0.8, 1.6] $$
$$ b = [0.1, 0.4, 1.6, 6.4, 12.8] $$
That will result in:
$$ ra = [0.6931471805599453, 0.6931471805599453, 0.6931471805599453, 0.6931471805599453] $$
$$ rb = [1.3862943611198906, 1.3862943611198906, 1.3862943611198906, 1.3862943611198906] $$
So, when calculating $\beta$, both variance and covariance returned $0$, which resulted in a $NaN$ in Java. I know this is a very very rare case, but even so to me it raises two questions:
1) Is there any convention on which will be $\beta$ value when variance would be $0$?
2) Is the value of $\beta$ even relevant in cases like that?
EDIT: 3) In a software that could use this result to show the user and maybe use in other operations, would it be acceptable to display the data as 0? Or it would be misleading to say this?