java基础面试题:Math.round(11.5)等於多少? Math.round(-11.5)等於多少?
2024-10-07 19:29:30
package com.swift; public class Math_Round { public static void main(String[] args) {
/*
* Math round为+0.5后的floor(也可以说正数四舍五入负数五舍六入) ceil天花板 floor地板
*/ System.out.println(Math.round(11.4));
System.out.println(Math.round(11.5));
System.out.println(Math.round(11.6));
System.out.println(Math.round(-11.4));//-11.4+0.5=-10.9 取floor为-11
System.out.println(Math.round(-11.5));//-11.5+0.5=-11 取floor为-11
System.out.println(Math.round(-11.6));//-11.6+0.5=-11.1 取floor 为-12
} }
最新文章
- 条件注释判断浏览器版本<;!--[if lt IE 9]>;
- 项目管理工具之Git使用说明
- dw添加emmet
- ububtu 14.04 问题集合
- laravel项目拉取下来安装,node.js库安装
- NEUQ1051: 谭浩强C语言(第三版)习题6.7
- 【二十四】使用mysqli扩展类批量执行多条sql语句
- 在Linux上搭建测试环境常用命令(转自-测试小柚子)
- Web程序报错:Error instantiating servlet
- C# 枚举转列表
- keepalived+lvs子网掩码造成VIP切换故障 + vrrp_script+track_script
- c++创建二维动态数组与内存释放
- CENTOS7更换YUM源为163源
- 题外话:我想立刻辞职,然后闭关学习编程语言,我给自己3个月时间学习C语言!这样行的通吗
- Web 应用性能提升的 10 个建议
- MySQL小误区:关于set global sql_slave_skip_counter=N 命令的一些点
- 【模拟】Gym - 101190A - Abbreviation
- QT Creator常用快捷键
- 【强连通分量缩点】【记忆化搜索】bzoj1589 [Usaco2008 Dec]Trick or Treat on the Farm 采集糖果
- POJ1363 Rails 验证出栈序列问题
热门文章
- 牛客 PUBG
- sql 存储过程-proc
- postgresql删除还有活动连接的数据库
- Git把旧仓库的分支拉到新仓库中
- Unity Download Assistant Error: &#39;SendRequest Error&#39; while downloading ini file from http://files.unity3d.com/bootstrapper/29055738eb78/unity-5.3.6f1-win.ini
- css盒子模型 css3盒子相关样式
- 1 误删dbf文件造成ORA-01109: 数据库未打开.
- 子元素的margin-top会影响父元素
- 一、基础知识 React API 一览
- cf314E. Sereja and Squares(dp)