首页 > 其他分享 >Non-terminating decimal expansion; no exact representable decimal result.

Non-terminating decimal expansion; no exact representable decimal result.

时间:2023-10-10 16:01:55浏览次数:23  
标签:Non divide no decimal terminating result

 上网查了一下这个异常的,找到了原因所在:通过BigDecimal的divide方法进行除法时当不整除,出现无限循环小数时,就会抛异常:java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result. 

  解决的办法就是给divide方法设置精确的小数点,如:divide(xxxxx,2)。

标签:Non,divide,no,decimal,terminating,result
From: https://www.cnblogs.com/deepalley/p/17754903.html

相关文章

  • System.NotSupportedException:“无法显式设置 SplitterPanel 的高度。改在 SplitCont
    System.NotSupportedException:“无法显式设置SplitterPanel的高度。改在SplitContainer上设置SplitterDistance。”这个错误信息是在使用SplitContainer控件时出现的。它表明您尝试显式设置SplitterPanel的高度,但这是不支持的操作,应该在SplitContainer上设置Splitte......
  • NOIPTG联合权值
    P1351[NOIP2014提高组]联合权值我们对于每个点计算它的子结点的\(\sumw,\maxw\)。如图,发现贡献有三类:直接计算。需要剔除自己这个点,对于sum直接减去即可,对于max维护一个次大值,发现这个点是最大值用次大值代替。枚举子节点,然后直接利用子节点的\(\sum,\max\)信......
  • Math、System、Runtime //BigDecimal、Date、SimpleDaateFormat、Calendar
    1、Math =======================================================================================BigDecimal 1、构造器publicBigDecimal(Stringval)publicclassBigDecimalDemo01{publicstaticvoidmain(String[]args){//目标:掌握BigDecimal的......
  • 学习笔记427—Python Keras 报错AttributeError: 'Sequential' object has no attribu
    PythonKeras报错AttributeError:'Sequential'objecthasnoattribute'predict_classes'解决方法本文文要介绍Python中,使用Keras执行yhat_classes=model.predict_classes(X_test)代码报错:AttributeError:'Sequential'objecthasnoattribute'pr......
  • MongoDB Node.js Driver and MongoClient All In One
    MongoDBNode.jsDriverandMongoClientAllInOneThenextgenerationNode.jsdriverforMongoDB$npmimongodb#OR$npmi-Smongodb#OR$npminstallmongodb--savehttps://mongodb.github.io/node-mongodb-native/index.htmlhttps://www.mongodb.com......
  • Error: Failed to download metadata for repo 'appstream': Cannot prepare internal
    一背景跑了一份centos容器,想装一下net-tools,报如下错误Error:Failedtodownloadmetadataforrepo'appstream':Cannotprepareinternalmirrorlist:NoURLsinmirrorlist 二解决参考帖子:https://developer.aliyun.com/article/1165954  CentOS已经停止......
  • The designer cannot be shown because the document for it was never loaded. (Visua
    Thedesignercannotbeshownbecausethedocumentforitwasneverloaded. 查看窗体设计器报错   查看代码是空的   多做代码备份。 REFhttps://stackoverflow.com/questions/7688630/the-designer-could-not-be-shown-for-this-file-because-none-of-the-classes-wi......
  • gatk UnifiedGenotyper
    使用UnifiedGenotyper注意如下:(1)输入:.recalibration.bam(2)输入:.recalibration.bai(3)dbSNP:vcfdbsnp,有头部;有与DNA一样的染色体顺序;有idx文件;UnifiedGenotyperUnabletoreadindexfile,forinputsource:vcf.idxSorryforthedelayedresponse.Itturnsoutthatthisisa......
  • gitignore不生效
    参考.gitignore只能忽略那些原来没有被track的文件,如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的。gitrm-r--cached.gitadd.gitcommit-m"update.gitignore"再推送......
  • 关联容器(map、set、multimap、multiset、pair、unordered_map)
    一、使用关联容器key---value)对:关键字起到索引的作用,值则表示与索引相关联的数据。set中每个元素只包含一个关键字;set支持高效的关键字查询操作---检查一个关键字是否在set中。multimap允许多个元素具有相同的关键字。   pair类型用于保存两个数据类型,pair的数据成员是public......