欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Java代碼數(shù)值向上取整 java 向上取整數(shù)

java arctan

java arctan是什么,讓我們一起了解一下?

萬秀ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!

arctan是java中數(shù)學(xué)運(yùn)算的三角函數(shù)方法,tan() 三角正切,通過編程Java代碼實(shí)現(xiàn),常用的還有cos() 三角余弦,sin()為 三角正弦,asin() 正弦的反函數(shù),cos() 余弦的反函數(shù),tan() 正切的反函數(shù)。

他的源代碼如下:

public?class?MainTest?{ ????public?static?void?main(String[]?args)?{ ????????//求sin值 ????????double?sin?=?Math.sin(3.14); ????????System.out.println("sin3.14="?+?sin); ????????//求cos值 ???皮寬?????double?cos?=?Math.cos(0); ????????System.out.println("cos0="?+?cos); ????????//求tan值 ????????double?tan?=?Math.tan(0.785); ????????System.out.println("tan0.785="?+?tan); ????????//求arcsin ????????double?arcsin?=?Math.asin(1); ????????System.out.println("arcsin1?=?"?+?arcsin); ????????//求arccos ????????double?arccos?=?Math.acos(1); ????????System.out.println("arccos?=?"?+?arccos); ????????//求arctan ????????double?arctan?=?Math.atan(30); ????????System.out.println("arctan30?=?"?+?arctan); ????????//求弧度 ????????double?radians?=?Math.toRadians(180); ????????System.out.println("180度角的弧度為"?+?radians); ????????//求角度 ????????double?angle?=?Math.toDegrees(3.141592653589793); ????????System.out.println("π的角度數(shù)為"?+?angle); ????????//求以e為底的指數(shù) ????????double?exp?=?Math.exp(1); ????????System.out.println("以e為底指數(shù)為1的數(shù)為"?+?exp); ????????//求以e為底e的平方的對數(shù) ????????double?log?=?模鄭Math.log(Math.E?*?Math.E); ????????System.out.println("以e為底e的平方的對數(shù)"?+?log); ????????//求以10為底100的對數(shù) ????????double?log10?=?Math.log10(100); ????????System.out.println("以10為底100的對數(shù)"?+?log10); ???燃碼亮?????//求100的平方根 ????????double?sqrt?=?Math.sqrt(100); ????????System.out.println("100的平方根是"?+?sqrt); ????????//求27的立方根 ????????double?cbrt?=?Math.cbrt(27); ????????System.out.println("27的立方根是"?+?cbrt); ????????//求10除以3的余數(shù) ????????double?rest?=?Math.IEEEremainder(10,?3); ????????System.out.println("10除以3的余數(shù)為"?+?rest); ????????//求0.9向上取整 ????????double?ceil?=?Math.ceil(0.9); ????????System.out.println("0.9向上取整"?+?ceil); ????????//求2.49向下取整 ????????double?floor?=?Math.floor(2.49); ????????System.out.println("2.49向下取整"?+?floor); ????????//求最接近參數(shù)的整數(shù)值(若有兩個滿足條件的數(shù)據(jù)則取為偶數(shù)的數(shù)據(jù)) ????????double?rint?=?Math.rint(3.5); ????????System.out.println("最接近參數(shù)的整數(shù)值"?+?rint); ????????//獲得(1,1)坐標(biāo)與x軸夾角度數(shù) ????????double?atan2?=?Math.atan2(1,?1); ????????System.out.println("坐標(biāo)(1,1)的極坐標(biāo)為"?+?atan2); ????????//求3的5次方 ????????double?pow?=?Math.pow(3,?5); ????????System.out.println("3的5次方"?+?pow); ????????//4舍5入 ????????double?round?=?Math.round(3.5); ????????System.out.println("3.5四舍五入為"?+?round); ????????//計(jì)算2

求解java中Math類中的取整方法?

public static long round(double a)

返回最接近參數(shù)的 long 長整型。結(jié)果將四舍五入為整數(shù),對結(jié)果調(diào)用 Math.floor函數(shù), 并將所得結(jié)果強(qiáng)制轉(zhuǎn)換為 long 類型。

換句話說,結(jié)果等于以下表達(dá)式的值:

(long)Math.floor(a + 0.5d)

對于負(fù)數(shù)的四舍五入運(yùn)擾規(guī)則是 先塵桐把負(fù)數(shù)轉(zhuǎn)換為正數(shù),四舍五入后,再轉(zhuǎn)換為負(fù)數(shù)

-2.6轉(zhuǎn)換為正數(shù)2.6,四舍五入2.6+0.5=3.1,然后再轉(zhuǎn)為負(fù)數(shù)-3.1

用Math.floor函數(shù)去掉小數(shù)部分旁兄旦為-3,然后強(qiáng)制轉(zhuǎn)換成長整型-3.

-2.4轉(zhuǎn)換為正數(shù)2.4,四舍五入2.4+0.5=2.9,然后再轉(zhuǎn)為負(fù)數(shù)-2.9

用Math.floor函數(shù)去掉小數(shù)部分為-2,然后強(qiáng)制轉(zhuǎn)換成長整型-2.

所以Math.round(-2.6)=-3,Math.round(-2.4)=-2.

分享標(biāo)題:Java代碼數(shù)值向上取整 java 向上取整數(shù)
文章路徑:http://chinadenli.net/article30/dspphso.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動態(tài)網(wǎng)站面包屑導(dǎo)航做網(wǎng)站手機(jī)網(wǎng)站建設(shè)網(wǎng)站營銷網(wǎng)頁設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營