number-rounding

    3熱度

    2回答

    我有什麼似乎是一個簡單的問題。我只是想表明不帶小數位的百分比,並有總爲100。這裏有一個小snipit: create table genderTable (person varchar(10), isMale varchar(5)) insert into genderTable values ('Mary', 'false') insert into genderTable valu

    0熱度

    2回答

    我有一個預填充數據表,在數據表中需要每一行加起來100 我想使用這種方法,如果行的總值小於100,則循環訪問該行中的值,並首先將1單位添加到最大值,檢查是否達到100,如果不是將1單位添加到第二大值在行中等等。 例如: 原始數據 50.2,40.6,9.0總99.8 四捨五入後: 50.3,40.7,9.0合計100.0 如果整體合計值對於行是超過100,那麼我希望重複這個過程,但從最大值首先刪除

    8熱度

    2回答

    我正在使用jdk 1.8.0_45,並且我們的測試發現了路由中的一個錯誤。 RoundingMode.HALF_DOWN的工作方式相同RoundingMode.HALF_UP當決定舍入的最後一位小數是5 我發現相關問題與RoundingMode.HALF_UP,但它們固定在更新40.我也把錯誤的oracle,但從我的經驗來看,他們確實沒有反應。 package testjava8; impor

    0熱度

    3回答

    public double hypotenuse() { //return Math.hypot(leg, leg); //returns 7.0710678118654755 //return 0.1 * Math.floor(Math.hypot(leg, leg) * 10); //returns 7.0 //return 0.1 * Math.ceil(M

    15熱度

    4回答

    好的,所以我試圖將輸入17.92857四捨五入,以便在bash中輸入17.929。 到目前爲止我的代碼是: read input echo "scale = 3; $input" | bc -l 然而,當我用這個,它不圓了,它返回17.928。 有沒有人知道任何解決方案?

    0熱度

    1回答

    在下面的代碼,方法A從方法B.不同不同的結果有人可以解釋爲什麼 輪_mm_cvt_ss2si到偶數時小數部分恰好爲0.5? float f; // rounding method A _mm_cvt_ss2si(_mm_load_ss(&f)); // rounding method B (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));

    0熱度

    2回答

    我正在爲Crystal報表創建一個報表,用於彙總在同一年激活和停用的客戶。我的報告看起來像這樣: <table border=1> <tr> <td>Customer</td> <td>Create Date</td> <td>End Date</td> <td>Days Active</td> <td>Month

    -1熱度

    1回答

    如何圓一個數字,2位小數,例如 12.72 --> 12.70 12.76 --> 12.75 例如 decimal from 1.01 to 1.02 will round off to 1.00 decimal from 1.03 to 1.04 will round off to 1.05 decimal from 1.06 to 1.07 will round off to 1.

    4熱度

    3回答

    我對Java相當陌生,而且我最近編寫了一個代碼,用於計算您需要支付多少金額項目。它運作良好;我唯一的問題是,只要沒有百分之一的虧損(例如4.60美元),它就會下降到十分之一(4.6美元)。 如果有人知道如何解決這個問題,我將非常感激。我有下面的代碼。 class Main { public static void main(String[] args) throws IOExceptio

    1熱度

    2回答

    似乎Ruby選擇將負數倒圓而不是接近零。 -1.5.round #=>-2 而正數工作的其他方式: 2.5.round #=>3 如何圍捕負數(接近零),而不是四捨五入下來的?我使用的是Ruby 2.2.2版本。