Fixed a bug in floatToByte().

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149938 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doug Cutting 2003-01-24 18:33:27 +00:00
parent e8a9993725
commit 31ec31b325
1 changed files with 3 additions and 3 deletions

View File

@ -212,9 +212,9 @@ public abstract class Similarity {
mantissa = 7; mantissa = 7;
} }
if (exponent < 1) { // underflow: use min value if (exponent < 0) { // underflow: use min value
exponent = 1; exponent = 0;
mantissa = 0; mantissa = 1;
} }
return (byte)((exponent << 3) | mantissa); // pack into a byte return (byte)((exponent << 3) | mantissa); // pack into a byte