Properly compare against MIN/MAX_VALUE

This commit is contained in:
Andrew Steinborn
2019-04-23 13:52:03 -04:00
parent 545966a4e7
commit c8e33eef60
2 changed files with 4 additions and 4 deletions

View File

@@ -24,8 +24,8 @@ class DoubleArgumentPropertySerializer implements ArgumentPropertySerializer<Dou
@Override
public void serialize(DoubleArgumentType object, ByteBuf buf) {
boolean hasMinimum = object.getMinimum() != Double.MIN_VALUE;
boolean hasMaximum = object.getMaximum() != Double.MAX_VALUE;
boolean hasMinimum = Double.compare(object.getMinimum(), Double.MIN_VALUE) != 0;
boolean hasMaximum = Double.compare(object.getMaximum(), Double.MAX_VALUE) != 0;
byte flag = getFlags(hasMinimum, hasMaximum);
buf.writeByte(flag);

View File

@@ -25,8 +25,8 @@ class FloatArgumentPropertySerializer implements ArgumentPropertySerializer<Floa
@Override
public void serialize(FloatArgumentType object, ByteBuf buf) {
boolean hasMinimum = object.getMinimum() != Float.MIN_VALUE;
boolean hasMaximum = object.getMaximum() != Float.MAX_VALUE;
boolean hasMinimum = Float.compare(object.getMinimum(), Float.MIN_VALUE) != 0;
boolean hasMaximum = Float.compare(object.getMaximum(), Float.MAX_VALUE) != 0;
byte flag = getFlags(hasMinimum, hasMaximum);
buf.writeByte(flag);