Javascript and php Round Up decimals -


i having values 7030.56,5875.78,8852.67. want round value when .7 , above come on after decimal point.

eg

i want round when coming this:

        (i) 5875.78 -rounded value 5876         (i) 8978.78 -rounded value 8979 

i dont want round when coming this:

        (i) 5875.58 -rounded value 5875.58         (i) 8978.68 -rounded value 8978.68 

i want implement client side , server side also.php , javascript also.

then have implement own logic.

an example: $num number

php:

$fraction = $num - floor($num); if($fraction >= 0.7) {     $result = ceil($num); }else{     $result = $num; } 

javascript:

var fraction = num - math.floor(num); var result = num; if(fraction >= 0.7) {     result = math.ceil(num); } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -