开发者

Problem with difficult caclulation in JavaScript

开发者 https://www.devze.com 2023-01-25 20:07 出处:网络
Is it possible to get different result in different browsers with some math operation? E.g. something like that

Is it possible to get different result in different browsers with some math operation? E.g. something like that

if(vote!=0)total_reiting = Math.round((full_reiting/vote)*100)/100;
var star_widht = full_reiting*17/vote;
$('#raiting_votes').width(star_widht);
$('#raiting_info b').append(total_reiting);
Mb its bettter to use back-end calculation? Or its better in any case to hadle logic o开发者_StackOverflow中文版n beck-end?


I doubt you would get different results on a different browser, although the nature of floating point and rounding makes it possible that you'd get different results under a different implementation. I just think it's very unlikely you'll ever see that.


MathJax is an open source JavaScript display engine for mathematics that works in all modern browsers.

0

精彩评论

暂无评论...
验证码 换一张
取 消