jquery - The total shows the price with .999995 at end -


I have an error on this script. The calculation system works but there is an error:

  $ (document) .ready (function () {$ ("# total"). Val ("55.95"); $ ("# val (" 512MB "); $ (" # zodiac 1 "). Val ("512MB"); $ ("10GB"); Val ("10GB"); $ ("# zoder 2"). Val ("10 GB"); $ (function () {var ram = {0 : "512 MB", 1: "1 GB", 2: "2 GB", 3: "4 GB", 4: "8 GB", 5: "16 GB", 6: "32GB",} Prarm HRD = {0: "49.95", 1: "89.95", 2: "14.9.95", 3: "32", 4: "64", 5: "128" 6: "256" 0: "10 GB", 1: "15 GB", 2: "20 GB", 3: "25 GB", 4: "30 GB", 5: "35 GB",}; va R.phdd = {0: "49.95", 1: "99.95", 2: "100.95", 3: "49.14", 4: "28", 5: "40",} $ ("# Slider"). ($ Value: "0", minimum: 0, maximum: 6, step: 0, slide: function (event, UI) {$ ("# value") Val (pr [ui.value]); $ (" # Value (ram [ui.value]); $ ("# zodiac 1"). Val (ram [ui.value]) var aaa = $ ("# price"). Val (); var bbb = $ ( "# Priceb"). Val (); $ ("# Total") Val (+ aaa + bbb);}}} $ $ ("# sliderb") Slider: ($ value: "0", minimum: 0, maximum: 5, step: 1, slide: function (event, UI) {$ ("# pryasab"). Val (flashed [ui.value]); $ ( "#metb" Val (HDD [ui.value]); $ ("# AMOUNT2") Val (HDD [ui.value]); Var aaa = $ ("# price"). Val (); Var Bbb = $ ("# priceb"). Val (); $ ("# total"). Val (+ aaa + + bbb);}}); $ ("# Value") Val ('$' + $ ("# slider"). Slider ("value"); $ ("# Priceb") Val ('$' + $ ("# slider"). Slider ("value")); $ ("# Price") Val ("4"). $ ("# Priceb") Val ("3"). }); });   

If I remove the result of 49.95 + 149.95 then the result of 199.89999995, and the result is 199.9. I do not know what to do Please help me

post-text itemprop = "text">

Use floating point value for monetary data Please. Keep your prices in cents and format the numbers accordingly for the presentation. .

If you work with St., what you have to do is divided by you 100 , if you want to show values ​​in dollar (or other currency) :

  var total = 4495 + 14995; Var Display = Total / 100; $ ("# Total") val (display).    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -