mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix numberUtil
This commit is contained in:
parent
c3f187a713
commit
ff10ea0d9c
@ -28,6 +28,7 @@
|
||||
* 【dfa 】 SensitiveUtil增加setCharFilter方法(pr#1123@Github)
|
||||
* 【all 】 优化常量大小写规范(pr#188@Gitee)
|
||||
* 【core 】 优化NumberUtil中针对BigDecimal的一些处理逻辑(pr#1127@Github)
|
||||
* 【core 】 NumberUtil.factorial注释明确(pr#1126@Github)
|
||||
|
||||
### Bug修复
|
||||
* 【crypto 】 修复SM2验签后无法解密问题(issue#I1W0VP@Gitee)
|
||||
|
@ -1412,13 +1412,13 @@ public class NumberUtil {
|
||||
// ------------------------------------------------------------------------------------------- others
|
||||
|
||||
/**
|
||||
* 计算阶乘
|
||||
* 计算范围阶乘
|
||||
* <p>
|
||||
* n! = n * (n-1) * ... * end
|
||||
* factorial(start, end) = start * (start - 1) * ... * (end - 1)
|
||||
* </p>
|
||||
*
|
||||
* @param start 阶乘起始
|
||||
* @param end 阶乘结束,必须小于起始
|
||||
* @param start 阶乘起始(包含)
|
||||
* @param end 阶乘结束,必须小于起始(不包括)
|
||||
* @return 结果
|
||||
* @since 4.1.0
|
||||
*/
|
||||
|
@ -245,6 +245,8 @@ public class NumberUtilTest {
|
||||
Assert.assertEquals(120, factorial);
|
||||
factorial = NumberUtil.factorial(5, 1);
|
||||
Assert.assertEquals(120, factorial);
|
||||
|
||||
Assert.assertEquals(5, NumberUtil.factorial(5, 4));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user