您现在的位置是: 首页 > PHP PHP
固定费率N次后费率及本金(复利率)
冬寂
2021-12-22 10:12:21
【PHP】
3356人已围观
$cash = 1000;$i=0;while(1 == bccomp($cash,10,5)){ $tax = bcmul($cash,0.001,5); $cash = bcsub($cash,$tax,5); $i++; echo "当前执行第{$i}次,本次手续费{$tax},剩余金额{$cash}"."<br>";}echo $i;echo '<hr>';getTax(1000,0.001,3006,5);//本金,费率,第N次,精度function getTax($benjin,$feilv,$cishu,$jingdu){ //公式:1000*(1-0.001)^n $a = bcpow(1-$feilv, $cishu, $jingdu); $b = bcmul($benjin,$a,$jingdu); echo "当前执行第{$cishu}次,本次手续费{$a},剩余金额{$b}"."<br>";}
下一篇: PHP高精度计算函数
相关文章
点击排行

站长推荐

猜你喜欢
- MySQL ANY_VALUE() 函数
- MySQL 随机排序 ORDER BY RAND() 性能优化
- 如何在网上向人求助
- 提问的智慧
- 执行count(1)、count(*) 与 count(列名) 到底有什么区别?
- 韦伯天文望远镜将会改写宇宙历史,如果它能正常工作的话(The Webb Space Telescope Will Rewrite Cosmic History. If It Works.)
- 韦伯太空望远镜将改写宇宙历史(The Webb Space Telescope Will Rewrite Cosmic History. If It Works.)
- 韦伯太空望远镜将改写宇宙历史(The Webb Space Telescope Will Rewrite Cosmic History. If It Works.)
- 《人类动物园》:为什么说都市是人类动物园?
- 对话罗永浩:再创业可能后悔,不再创业百分之百后悔