For scores below a certain threshold (I believe it is something like 1e-179), BLAST reports the E-value simply as 0.0. I am interested in some cases in actually comparing the magnitude of E-values between hits, including those with E-values of 0.0 and so am trying to convert between either the score or bit-score, and the E-value.

My issue is that the comparison does not appear to yield the same values?

For example, take a Hsp with the following criteria:

- bit-score: 320.857
- score: 821
- evalue: 9.0807e-104
- eff_search_size: 17276649840
- lambda: 0.267
- kappa: 0.041

Comparison of the score and bit score works, suggesting the values of lambda and kappa are correct:

- 0.267 * 821 - ln(0.041) / ln(2) = 320.857

However, no matter how I try to calculate the E-value, I get a different value:

- 17276649840 * e^(-0.267 * 821 + ln(0.041)) = 4.465e-87
- 17276649840 / 2^(320.857) = 4.465e-87

Considering I have seen these stated as the two methods to calculate an E-value from either the score or bit-score, I find it very confusing that these consistently give a different value than what BLAST reports.

Am I making a mistake in these calculations somewhere?