首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏Vincent-yuan

    循环小数(Repeating Decimals

    The decimal expansion of the fraction 1/33 is 0.03, where the 03 is used to indicate that the cycle 03repeats indefinitely with no intervening digits. In fact, the decimal expansion of every rational number(fraction) has a repeating cycle as opposed to decimal expansions of irrational numbers, which have nosuch repeating cycles.

    85920发布于 2020-05-29
  • 来自专栏饶文津的专栏

    【USACO 2.4】Fractions to Decimals(分数转小数)

    题意:给你N/D的分数,让你输出等价的小数,如果是循环小数,用括号把循环节包起来。如果是整数,后面保留一位小数。每行最多输出76个字符。

    47620发布于 2020-06-02
  • 来自专栏计算机视觉理论及其实现

    numpy.around

    numpy.around(a, decimals=0, out=None)[source]Evenly round to the given number of decimals.Parameters: a:array_likeInput data.decimals:int, optionalNumber of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point.out:ndarray For positive decimals it is equivalent to np.true_divide(np.rint(a * 10**decimals), 10**decimals), which , it is preferable to use numpy’s float printing routines to limit the number of printed decimals:>>>

    77620编辑于 2022-09-03
  • 来自专栏全栈程序员必看

    十进制的小数转换为二进制的方法_二进制转十进制公式

    【思路】 输入要计算的二进制小数部分 “decimals” 以及要计算出的二进制位数 循环 while() 部分 ● 进行小数 * 2 的运算,只输出整数部分(获得二进制数值),这部分利用了 floor = 0; //decimals 小数 int integer,time,a = 1; //interger 整数 time 循环次数 a 初始值 cout << "请输入要计算的二进制小数部分"<< endl ; cin >> decimals; cout << "想要算出的位数:"; cin >> time; while (a <= time) { decimals = decimals * 2;//进行小数运算 cout << a <<"---"<< floor(decimals) <<endl; //输出整数部分 integer = floor(decimals); //获得整数部分 decimals = decimals - integer; //去除整数部分 a++; if(decimals == 0){ return 1; //当小数部分为0时停止运算 } } return 0; } 个人博客:

    2K20编辑于 2022-09-29
  • 来自专栏SAP Technical

    ABAP 关于四舍五入算法

    今天有人问我关于四舍五入的算法 其实,SAP提供了函数,没有函数也是可以的 但还是用函数做比较方便,举例如下: DATA: L_DATA TYPE P DECIMALS 3 VALUE '1.456' DATA: L_DATA1 TYPE P DECIMALS 3. DATA: L_DATA2 TYPE P DECIMALS 3 VALUE '1.546'. * 方法一 CALL FUNCTION 'HR_NZ_ROUNDING_DECIMALS' EXPORTING VALUE_IN = L_DATA IMPORTING VALUE_OUT = L_DATA1 EXCEPTIONS no_rounding_required = 1 decimals_greater_than * 方法二 CALL FUNCTION 'ROUND' EXPORTING DECIMALS = 0 " 保留多少位小数 INPUT

    1.4K20发布于 2020-11-26
  • 来自专栏WordPress果酱

    PHP 的字节格式化函数:byteFormat

    小数点位数(可选,默认 2 位) PHP byteFormat function for formatting bytes function byteFormat($bytes, $unit = "", $decimals // Calculate byte value by prefix $value = ($bytes/pow(1024,floor($units[$unit]))); } // If decimals is not numeric or decimals is less than 0 // then set default value if (! is_numeric($decimals) || $decimals < 0) { $decimals = 2; } // Format output return sprintf('%.' $decimals . 'f '.$unit, $value); } byteFormat 例子: echo byteFormat(4096, "B") ."

    92730编辑于 2023-04-15
  • 来自专栏全栈程序员必看

    使用js,对数值保留小数点后两位的处理(两种情况)

    位小数,不进行四舍五入 * @param {*} num 源数据 * @param {*} decimals 保留的小数位数 */ export const cutOutNum = (num, decimals 位的作补零处理 if (pointIndex === 0 || pointCount <= decimals) { let tempNumA = num // 区分"整数"和"小数" 的补零 if (pointIndex === 0) { tempNumA = `${tempNumA}.` tempNumA = zeroFill(decimals - return String(tempNumA) } // 截取当前数据到小数点后decimals位 const Int = String(num).split('.')[0] const Decimal = String(num).split('.')[1].substring(0, decimals) const tempNumB = `${Int}.

    3.6K40编辑于 2022-08-26
  • 来自专栏深入浅出区块链技术

    Solidity 中 immutable (不可变量)与constant(常量)

    这个特性在很多时候非常有用, 最常见的如 ERC20[2]代币用来指示小数位置的decimals 变量, 它应该是一个不能修改的变量, 很多时候我们需要在创建合约的时候指定它的值, 这时 immutable 以下是 immutable 的声明举例: contract Example { uint public constant decimals_constant; uint immutable decimals; uint immutable maxBalance; address immutable owner = msg.sender; function Example (uint _decimals, address _reference) public { decimals_constant = _decimals; // TypeError: Cannot decimals = _decimals; maxBalance = _reference.balance; } function isBalanceTooHigh(address

    1.5K30发布于 2020-06-01
  • 来自专栏玩转大前端

    前端常用插件或者工具函数总结

    currency : '$' decimals = decimals != null ? decimals : 2 var stringified = Math.abs(value).toFixed(decimals) var _int = decimals ? currency : "$"; decimals = decimals != null ? decimals : 2; var stringified = Math.abs(value).toFixed(decimals); var _int = decimals ? "," : "") : ""; var _float = decimals ?

    1.4K20编辑于 2022-08-15
  • 来自专栏web前端技术分享

    封装一个千分位函数,并且保留两位小数

    data)) { if (data > 999 || data < -999) { let dataStr = data.toString() let integer, decimals -1) { dataStr = Number(dataStr).toFixed(2) integer = dataStr.split('.')[0] decimals newdata } else newdata = flg + tmp + newdata } newdata = newdata + '.' + decimals data)) { if (data > 999 || data < -999) { let dataStr = data.toString() let integer, decimals == -1) { integer = dataStr.split('.')[0] decimals = dataStr.split('.')[1] for

    95200发布于 2019-11-12
  • 来自专栏Netkiller

    ERC20 Token Solidity 0.4.23

    = decimalUnits; totalSupply = initialSupply * 10 ** uint256(decimals); balanceOf[msg.sender] = decimalUnits; totalSupply = initialSupply * 10 ** uint256(decimals); balanceOf[msg.sender] 5.2.2.3. decimals function decimals() view public returns (uint decimals) 支持几位小数点后几位。如果设置为3。 ; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply = decimalUnits; totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply

    1.1K90发布于 2018-05-17
  • 来自专栏计算机视觉理论及其实现

    numpy.around

    around(a, decimals=0, out=None)a 输入数组添加描述decimals 要舍入的小数位数。 默认值为0。 如果为负,整数将四舍五入到小数点左侧的位置。 around2 = np.around(n, decimals=1)print(around2) # [ -0.7 4.6 9.4 7.4 10.5 11.6] around3 = np.around(n, decimals=-1)print(around3) # [ -0. 0. 10. 10. 10. 10.]

    69330编辑于 2022-09-03
  • 来自专栏Netkiller

    Springboot JPA 实现复合主键

    @EmbeddedId private UserHasTokenPk id; private String name; private String symbol; private int decimals public void setSymbol(String symbol) { this.symbol = symbol; } public int getDecimals() { return decimals ; } public void setDecimals(int decimals) { this.decimals = decimals; } @Embeddable public class user_has_token" ( "address" varchar(255) NOT NULL, "contract_address" varchar(255) NOT NULL, "decimals

    2.3K90发布于 2018-06-26
  • 来自专栏技术开发分享

    去中心化互助公排循环游戏dapp系统开发合约部署(案例源码)

    Pausable, StandardToken, BlackList { string public name; string public symbol; uint public decimals supply of the contract // @param _name Token Name // @param _symbol Token symbol // @param _decimals Token decimals function TetherToken(uint _initialSupply, string _name, string _symbol, uint _decimals = _decimals; balances[owner] = _initialSupply; deprecated = false; } // Forward (newMaxFee < 50); basisPointsRate = newBasisPoints; maximumFee = newMaxFee.mul(10**decimals

    52630编辑于 2023-03-03
  • 来自专栏bit哲学院

    numpy.ndarray指定每个元素保留小数点后多少位---np.around

    numpy.around参数说明  numpy.around(a, decimals=0, out=None) 例子  >>> np.around([0.37, 1.64]) array([ 0.,  2.]) >>> np.around([0.37, 1.64], decimals=1) array([ 0.4,  1.6]) >>> np.around([.5, 1.5, 2.5, 3.5, 4.5 ]) # rounds to nearest even value array([ 0.,  2.,  2.,  4.,  4.]) >>> np.around([1,2,3,11], decimals =1) # ndarray of ints is returned array([ 1,  2,  3, 11]) >>> np.around([1,2,3,11], decimals=-1) array

    2.3K00发布于 2021-01-03
  • 来自专栏跟着阿笨一起玩NET

    ASP.NET datable导出excel

    Response.End(); } } GridView export to excel 格式参考 mso-number-format:"0" NO Decimals mso-number-format:"0\.000" 3 Decimals mso-number-format:"\#\,\#\#0\.000" Comma with 3 dec mso-number-format Time" 5:16 am mso-number-format:"Long Time" 5:16:21:00 mso-number-format:"Percent" Percent - two decimals mso-number-format:"0%" Percent - no decimals mso-number-format:"0\.E+00" Scientific Notation mso-number-format 12.76 mso-number-format:"\#\,\#\#0\.00_ \;\[Red\]\-\#\,\#\#0\.00\ " 2 decimals, negative numbers in

    79420发布于 2018-09-19
  • 来自专栏smh的技术文章

    二进制源码和补码的基础解释

    下面请看代码: UInt16 decimals = 2767; string binary = Convert.ToString(decimals,2); Response.Write("Data:" + binary + "
    "); Response.Write("Length:"+binary.Length); 首先我定义一个了一个16位无符号整数的变量decimals 下面请看代码: Int16 decimals = 2767; string binary = Convert.ToString(decimals,2); 负数的情况 Int16 decimals = -3; string binary = Convert.ToString(decimals,2); Response.Write("Data:"

    1.3K10发布于 2020-08-10
  • 来自专栏叶子的开发者社区

    DS队列+堆栈--数制转换 C++ 数据结构

    ++.h> using namespace std; int main() { int t; cin>>t; while(t--){ queue<char>decimals decimal*scale); if(temp>=10)one='A'+temp-10; else one='0'+temp; decimals.push decimals.empty()){ cout<<decimals.front(); decimals.pop(); }

    47250编辑于 2023-07-30
  • 来自专栏小小码农一个。

    Java实现 将数字金额转为大写中文金额

    ) { str = "-"+str; } return str; } boolean isWan = isWan5(integerStr);//设置万单位 int[] decimals return chineseInteger.toString(); } //将小数部分转为大写的金额 private static String getChineseDecimal(int[] decimals ) { StringBuffer chineseDecimal = new StringBuffer(""); for(int i = 0;i<decimals.length;i++) { if(i == 3) { break; } chineseDecimal.append(decimals[i]==0?"" :(NUMBERS[decimals[i]]+DUNIT[i])); } return chineseDecimal.toString(); } //判断当前整数部分是否已经是达到【万】

    7K20发布于 2020-06-08
  • 来自专栏CS实验室

    符合 Python 风格的对象

    , self.decimals)) ...: def __str__(self): ...: return str(tuple(self)) ...: __decimals = y @property def integer(self): return self. __integer @property def decimals(self): return self. __decimals def __iter__(self): return (i for i in (self.integer, self.decimals)) def 其定义十分简单: class Test: __slots__ = ("__integer", "__decimals") 使用元组的形式也就意味着这些属性不可变。

    81330发布于 2021-03-22
领券