Exemplo n.º 1
0
def test_add( is_inexact, out, a, b ):
  a_bits = float2bits(a)
  b_bits = float2bits(b)
  #print 'expected:', float2bits(out), out, lib.softfloat_exceptionFlags
  out_bits = lib.f32_add( a_bits, b_bits )
  #print 'actual:  ', out_bits, bits2float( out_bits ), is_inexact
  assert float2bits(out) == out_bits
  assert is_inexact == lib.softfloat_exceptionFlags
  #if out != bits2float( out_bits ):
  #  print "WARNING: bits match but float conversion doesn't!"
  #print
  lib.softfloat_exceptionFlags = 0
Exemplo n.º 2
0
def test_add(is_inexact, out, a, b):
    a_bits = float2bits(a)
    b_bits = float2bits(b)
    #print 'expected:', float2bits(out), out, lib.softfloat_exceptionFlags
    out_bits = lib.f32_add(a_bits, b_bits)
    #print 'actual:  ', out_bits, bits2float( out_bits ), is_inexact
    assert float2bits(out) == out_bits
    assert is_inexact == lib.softfloat_exceptionFlags
    #if out != bits2float( out_bits ):
    #  print "WARNING: bits match but float conversion doesn't!"
    #print
    lib.softfloat_exceptionFlags = 0
Exemplo n.º 3
0
def execute_cvt_s_w( s, inst ):
  x = signed( s.rf[ inst.fs ] )
  s.rf[ inst.fd ] = float2bits( float( x ) )
  s.pc += 4
Exemplo n.º 4
0
def execute_div_s( s, inst ):
  a = bits2float( s.rf[ inst.fs ] )
  b = bits2float( s.rf[ inst.ft ] )
  s.rf[ inst.fd ] = float2bits( a / b )
  s.pc += 4