mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 10:44:47 +01:00
handle infinity values
This commit is contained in:
parent
24ec45e3a2
commit
ae489b2f5a
@ -399,10 +399,24 @@ public class TextModuleWriter extends ModuleWriter {
|
||||
methodOutput.append( valueType ).append( ".const " );
|
||||
switch( valueType ) {
|
||||
case f32:
|
||||
methodOutput.append( Float.toHexString( value.floatValue() ).toLowerCase() ).append( " ;;" ).append( value );
|
||||
float floatValue = value.floatValue();
|
||||
if( floatValue == Double.POSITIVE_INFINITY ) {
|
||||
methodOutput.append( "inf" );
|
||||
} else if( floatValue == Double.POSITIVE_INFINITY ) {
|
||||
methodOutput.append( "-inf" );
|
||||
} else {
|
||||
methodOutput.append( Float.toHexString( floatValue ).toLowerCase() ).append( " ;;" ).append( value );
|
||||
}
|
||||
break;
|
||||
case f64:
|
||||
methodOutput.append( Double.toHexString( value.doubleValue() ).toLowerCase() ).append( " ;;" ).append( value );
|
||||
double doubleValue = value.doubleValue();
|
||||
if( doubleValue == Double.POSITIVE_INFINITY ) {
|
||||
methodOutput.append( "inf" );
|
||||
} else if( doubleValue == Double.POSITIVE_INFINITY ) {
|
||||
methodOutput.append( "-inf" );
|
||||
} else {
|
||||
methodOutput.append( Double.toHexString( doubleValue ).toLowerCase() ).append( " ;;" ).append( value );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
methodOutput.append( value );
|
||||
|
Loading…
x
Reference in New Issue
Block a user