SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    These 2 number cant add up

    attached image
    Code snippet
    Code:
               for (var i = 0; i <= 22; i++) {
    	   		        var incbidsize = -11 + i;
    				var buyprices = buyprice + (bidsize * incbidsize ) ; // this is to start from backwards  
                                    var newprice = buyprices ;
    Variable are taken from a form element
    Just do not understand why cant the variable add up ?


    var newprice is the 1.32 you see in the 1st column
    i want it to increment by a variable instead of usual ++
    the first value should be (1.32 - 0.11) = 1.21
    second value should be 1.22

    i try changing them to number using parsefloat
    or change both to string using toString
    but it does not work

    other variables are adding correctly

  2. #2
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •