Use primitive types in NativeTypes (#3501)

This commit is contained in:
hduelme 2024-01-28 18:06:42 +01:00 committed by GitHub
parent 6830258f77
commit 90a3ce0b46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -270,11 +270,11 @@ public class NativeTypes {
@Override @Override
void parse(String val, int radix) { void parse(String val, int radix) {
Double d = Double.parseDouble( radix == 16 ? "0x" + val : val ); double d = Double.parseDouble( radix == 16 ? "0x" + val : val );
if ( doubleHasBecomeZero( d ) ) { if ( doubleHasBecomeZero( d ) ) {
throw new NumberFormatException( "floating point number too small" ); throw new NumberFormatException( "floating point number too small" );
} }
if ( d.isInfinite() ) { if ( Double.isInfinite( d ) ) {
throw new NumberFormatException( "infinitive is not allowed" ); throw new NumberFormatException( "infinitive is not allowed" );
} }
} }
@ -297,11 +297,11 @@ public class NativeTypes {
NumberRepresentation br = new NumberRepresentation( s, false, false, true ) { NumberRepresentation br = new NumberRepresentation( s, false, false, true ) {
@Override @Override
void parse(String val, int radix) { void parse(String val, int radix) {
Float f = Float.parseFloat( radix == 16 ? "0x" + val : val ); float f = Float.parseFloat( radix == 16 ? "0x" + val : val );
if ( doubleHasBecomeZero( f ) ) { if ( doubleHasBecomeZero( f ) ) {
throw new NumberFormatException( "floating point number too small" ); throw new NumberFormatException( "floating point number too small" );
} }
if ( f.isInfinite() ) { if ( Float.isInfinite( f ) ) {
throw new NumberFormatException( "infinitive is not allowed" ); throw new NumberFormatException( "infinitive is not allowed" );
} }
} }