differencePercentage =Math.round(Pay.init/ Pay.current) * 100) - 100);
这就得到了初始薪酬和当前薪酬之间的百分比差异,但它是相反的。当它是正的,即pay高于初始值时,它表示-X%,当它低于初始值时,它表示X%。
有没有什么明显的办法让我看不到这一点?
谢谢你的见解。:)
发布于 2010-01-01 13:19:49
differencePercentage = Math.round(100 - ((Pay.init / Pay.current) * 100));-(a - b) = -a +b=b-a
另外:
differencePercentage = Math.round(100 * (1 - (Pay.init / Pay.current)));发布于 2010-01-01 13:22:14
differencePercentage =Math.round(Pay.current/ Pay.init) * 100) - 100);
https://stackoverflow.com/questions/1987936
复制相似问题