读取 oracle 错误后的 jython 浮点精度

jython float precision after reading oracle wrong

我在从 oracle 读取浮点数时遇到问题。 我有以下片段:

sqlstr='select prio from tabletest'
statement = None
if connection is not None:
    try:
        statement = connection.prepareStatement(sqlstr)
        if connection is not None:
            rs = statement.executeQuery()
            if rs is not None:
                #statement.closeOnComplete()
                while (rs.next()):
                    NWW = rs.getFloat(1)
                    print (NWW)
                rs.close()
            else:
                statement.close()
  except:
        pass
    finally:
        connection.close()

这让我明白了:

 0.5
 0.5
 0.5
 0.20000000298
 0.5
 0.990000009537
 0.5
 0.5
 0.699999988079

但我在数据库中的实际数据如下所示:

0,5
0,5
0,5
0,2
0,5
0,99
0,5
0,5
0,7

数据库定义为:

  CREATE TABLE "SYSTEM"."tabletest" 
   (        "NWW" NUMBER(12,8)
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM" ;

如您所见,浮点数只有在 prio=0.5 时才精确...是否有任何选项我可以设置为浮点数是精确的?

谢谢, E.

...有点尴尬,但 rs.getDouble(1) 解决了我的问题。 :)