当前位置: 首页 > news >正文

炫酷企业网站网络营销具有很强的什么特征

炫酷企业网站,网络营销具有很强的什么特征,如何查询网站备案信息,可信验证网站1 java的允许函数的默认参数吗?java不支持类似C那样#xff0c;为函数设定默认参数#xff0c;所以需要做的事情是#xff0c;自己用函数重载的方式进行模拟。如下public class FFOverload {public String getName(String givenName,String familyName){return givenName那样为函数设定默认参数所以需要做的事情是自己用函数重载的方式进行模拟。如下public class FFOverload {public String getName(String givenName,String familyName){return givenName.familyName;}public String getName(String givenName){return getName(givenName,BBB);}public static void main(String[] args) {FFOverload demoDefaultParanew FFOverload();System.out.println(demoDefaultPara.getName(AAA));System.out.println(demoDefaultPara.getName(AAA, CCC));}}输出:AAA.BBBAAA.CCC2.  为什么floating point number不准确首先来验证一下public class FloatTest {public static void main(String[] args) {float a 1.01f; //dont forget the trailing f , else it will be treated as a double.float b 1.002f;float c 1.0000009f;float d a b c;System.out.println(expected: 3.0120009, actua: d);}}输出expected: 3.0120009, actua: 3.012001然后来看看原因:In most programming languages, floating point numbers are represented a lot like scientific notation:with an exponent anda mantissa (also called the significand).A very simple number, say 9.2, is actually this fraction:5179139571476070 * 2 -49Where the exponent is -49 and the mantissa is 5179139571476070.The reason it is impossible to represent some decimal numbers this way is that both the exponent and the mantissa must be integers. In other words, all floats must be an integer multiplied by an integer power of 2.Floating point numbers only have 32 or 64 bits of precision, so the digits are cut off at some point, and the resulting number is 0.199999999999999996 in decimal, not 0.2.3. 如何尽可能准确地表示Floating Point Numbers?3.1 使用BigDecimal Classbut currently there is a small unsolved issue in the code below. I did not see the difference between HALF_UP and HALF_DOWN in the code below.import java.math.*;public class FFBigDecimal {public static void main(String[] args) {BigDecimal bigDecimal1 new BigDecimal(1.001);BigDecimal bigDecimal2 new BigDecimal(1.0005);BigDecimal bigDecimal3 new BigDecimal(1.000007);BigDecimal bigDecimaBase new BigDecimal(2.52150);BigDecimal bigDecimal4 bigDecimaBase.setScale(3, RoundingMode.HALF_DOWN);System.out.println(Big Decimal is bigDecimal4.toString());BigDecimal bigDecimal5 bigDecimaBase .setScale(3, RoundingMode.HALF_UP);System.out.println(Big Decimal is bigDecimal5.toString());}}输出Big Decimal is 2.521Big Decimal is 2.522why????  I expected:2.5212.522HALF_UP的定义是这样的“Rounding mode to round towards nearest neighbor unless both neighbors are equidistant, in which case round up. Behaves as for RoundingMode.UP if the discarded fraction is ≥ 0.5; otherwise, behaves as for RoundingMode.DOWN. Note that this is the rounding mode commonly taught at school.”后来终于知道了原因算是比较坑爹了。BigDecimal的构造函数需要用String作为参数否则将会出现一些比较奇怪的结果。所以上面的程度如果修改为:import java.math.*;public class FFBigDecimal {public static void main(String[] args) {BigDecimal bigDecimal1 new BigDecimal(1.001);BigDecimal bigDecimal2 new BigDecimal(1.0005);BigDecimal bigDecimal3 new BigDecimal(1.000007);//test 1//bigDeciimal3 is immutable, so// WRONG: bigDecimal3.add(bigDecimal1).add(bigDecimal2);// CORRECT: bigDecimal3 bigDecimal3.add(bigDecimal1).add(bigDecimal2);bigDecimal3 bigDecimal3.add(bigDecimal1).add(bigDecimal2);BigDecimal bigDecimaBase new BigDecimal(2.52150);BigDecimal bigDecimal4 bigDecimaBase.setScale(3, RoundingMode.HALF_DOWN);System.out.println(Big Decimal is bigDecimal4.toString());BigDecimal bigDecimal5 bigDecimaBase .setScale(3, RoundingMode.HALF_UP);System.out.println(Big Decimal is bigDecimal5.toString());}}就是符合预期的得到的输出结果将是:Big Decimal is 2.521Big Decimal is 2.5223.2 如果在Double和Float中二选一选择Double.Double (8 位)Float (4 位)
http://www.zqtcl.cn/news/345374/

相关文章:

  • 重庆专业网站营销长春建站免费模板
  • 企业建设网站多少钱爱的网站歌曲
  • 宁波网站优化如何欣宝儿在什么网站做直播
  • 东营网签查询系统官方网站超炫的网站模板
  • 请人做网站谁来维护南宁营销型网站设计
  • 汕头做网站的公司西安建筑科技大学华清学院教务网
  • 免费行情网站在线石家庄正规制作网站公司
  • 站长工具网凡科网商城
  • 网站开发工程师需要会写什么区别沈阳网站建设建设公司哪家好
  • 营销型网站建设的优缺点利用海康威视做直播网站
  • 阿里手机网站开发框架怎么看网站被降权
  • 电视台做网站还是APP网络推广是什么意思
  • 浙江鼎兴建设有限公司网站wordpress看不到安装的主题
  • 琪觅公司网站开发c语言开发环境
  • 在哪个网站上做实验仪器比较好信息服务平台有哪些
  • 淘宝网站的建设目的是什么意思做雕塑设计的网站
  • 猎头网站模板个人社保缴费年限怎么查询
  • 博客网站设计及说明wordpress 显示 列表
  • 佛山制作手机网站莆田自助建站软件
  • 建邺做网站价格网站做换肤
  • 佛山有什么网站室内装饰设计怎么样
  • 智能建站与正常的网站购买 做网站 客户
  • 哪个是网络营销导向网站建设的基础微信商城开店需要费用吗
  • 宁波住房和建设局网站首页福州有做网站引流的吗
  • 国外科技类网站戴尔网站建设
  • 视频播放网站模板洞泾做网站公司
  • 深圳大学网站建设中美军事最新消息
  • gta5可用手机网站大全佛山网站建设服务
  • 智能建站软件哪个好智慧城市建设评价网站
  • 做网站用什么配资电脑织梦做的网站织梦修改网页模板