Skip to content

Commit

Permalink
FloatCodec 默认值修正 #85
Browse files Browse the repository at this point in the history
  • Loading branch information
HbnKing committed Dec 28, 2023
1 parent a734365 commit cfdd920
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class FloatCodec implements Codec<Float>, RepresentationConfigurable<Floa
private BsonType representation;

public FloatCodec() {
this.representation = INT64;
this.representation = DOUBLE;
}


Expand All @@ -62,15 +62,15 @@ private FloatCodec(final BsonType representation) {
@Override
public void encode(final BsonWriter writer, final Float value, final EncoderContext encoderContext) {
switch (representation) {
case DOUBLE:
writer.writeDouble(value.doubleValue());
break;
case INT32:
writer.writeInt32(value.intValue());
break;
case INT64:
writer.writeInt64(value.longValue());
break;
case DOUBLE:
writer.writeDouble(value.doubleValue());
break;
case DECIMAL128:
writer.writeDecimal128(Decimal128.parse(value.toString()));
break;
Expand Down

0 comments on commit cfdd920

Please sign in to comment.