calculation

How to loop between two dates

Hello! I have a calendar which passes selected dates as strings into a method. Inside this method, I want to generate a list of all the dates starting from the selected start date and ending with the selected end date, obviously including all of the dates inbetween, regardless of how many days are inbetween the selected start and end dat...

Currency Mask with Jquery

I'm using the Jquery calculation and have just about everything working properly, but I need the total to display as 99.90, not 99.9 <-- Just an example. Here is a link the form I'm using. [link text][1] [1]: So... .toFixed(), isn't working for some reason, when it should be! I can't find a mask that would work with this problem. ...

Mysql calculation issues: 1+1=1.999999999

The problem is this, when I add two or more doubles from a table to a view, instead of giving me the right results, it adds a about ten or so more digits. For example 0.5+1.5=1.99999999998 or 5.5+8.5=14.0000000001. Any ideas? (I know this is sort of n00b question and I remember having to deal with stuff like that in the exams at 9th grad...

Complicated Javascript Calculation

I've got a fairly large table that needs to have a total on the right side and bottom for daily totals. I've been able to get the side to total correctly, but not the bottom. I may be thinking too little of this, but currently I have this: (Yes, I know it's not correct and doesn't work. I was testing) script: HorizVertiCalc = functi...

Horizontal and Vertical complicated Javascript Calculation and Coldfusion

Now the table is being populated with 2 loops and an array. I have to control everything through the classes I put on the input. Been working on this for a while, some insight would be helpful. Here is the loop and the inputs: <cfloop from="1" to="#ArrayLen(labels)#" index="r"> <tr> <td class="labels"><cfif ArrayIsDefined(...

In need of help - - Total of rows and columns of a table

Found the answer. Take a look if you're interested. Changed my approach to completing this project. Need to be able to calculate rows to "Total" on the right hand side and the columns to "Daily Totals" I've been able to get some of it working, but it's screwy with the calculations and can't be right. Grand total seems to be working,...

CRC-5 correct computation?

I need to generate a CRC table for the standard CRC-5 algorithm, (or at least need some way to validate that the table I have is indeed correct). I was under the impression that CRC-5 would simply utilize 5 bits to calculate the CRC value, but in my table below I notice some first bytes with values greater than 7. Is this correct and is...

calculate frequency on certain range

Hi, I have maths problem ... (at the moment i solved it using manual iteration which is pretty slow) ... For example if an employee got paid weekly (it can be fortnightly / every 2 weeks and monthly) with certain date (let's call the employee got paid every tuesday and for monthly the employee paid on certain date). I have date range...

Derive integer factors of float value?

I have a difficult mathematical question that is breaking my brain, my whiteboard, and all my pens. I am working with a file that expresses 2 values, a multiplicand and a percentage. Both of those values must be integers. These two values are multiplied together to produce a range. Range is a float value. My users edit the range, and I ...

Excel data wont re-format or calculate

I have a spreadsheet that was created from a webapp. I save it as an excel wkbk. I close file and go to file and open from my pc. When I try to reformat a column of numbers, nothing happens. (it says the format is 'general' and alignment is 'general & top') it appears as all numbers, left aligned. I have tried to 'unlock' the cells...

How can I generate convenient date ranges based on a given NSDate?

I'm creating a report generator in Cocoa, and I need to produce convenient date ranges such as "Today", "This Week", "This Month", "This Year", etc. Is there a good way to do this? Here is my skeleton thus far: @interface DateRange : NSObject { NSDate startDate; NSDate endDate; } @property (assign) NSDate * startDate; @propert...

Calculating the percentage difference between two values

Before you start laughing at such a simple question let me explain: I am trying to determine how much change (percentage %) there is in an account over various indicators. This is not particularly hard. But how do you generally handle the cases where the current value is zero or the previous value is zero? i.e. This week: Earnings ...

Jquery Calculation issue

Hi , Having a small issue with the following bit of jquery. Its used to calculate line items and aggregate totals. e.g. line_item 1: qty x rate + vat (if vatable) = subtotal line_item 1: qty x rate + vat (if vatable) = subtotal subtotal: sum(qtys x rates) vat: sum (subtotal x vat formula) total : sum(subtotals) Heres the code, any ...

time calculation in xslt

I am using xsl version 2.0 I have a time field that I need to add 1 to. I am getting a formatted number from the the below node: <xsl:value-of select="Master/End/Timecode"/> <xsl:text> The data in "Master/End/Timecode" looks like 01:00:00:00 basically time-- hours :minutes :seconds :frames the frames are a count from oo to 2...

Perform calculation on values in a string "3+4"

What is the best way to do calculations on values in a string, for example: "(3.25 * 4) / 1.25 + 10" ...

Interpolation on excel

Hi to all I've a source data like this: 35 40 -15 15.0 15.1 -10 17.2 17.4 -5 19.7 19.8 and I need to find the value in (-16, 37). I've tried with linear interpolation but I can solve only with (x,y) couple of values. Could you help me? thanks a lot, Andrea ...

What are the most useful shortcuts for performing back-of-the-envelope calculations of computing problems?

With a back-of-the-envelope calculation you can mentally obtain an answer to a question, within an order of magnitude of its actual value. Some shortcuts can simplify these calculations. In computing I've found the rule 103n is-close-to 210n invaluable. For instance, through this I can say that I can binary search through a billion ...

Home loan calculation formula (algorithm)?

How a bank calculate home loan's payments? For example, $1,000,000 at 5.00% over a 25 year period. Monthly payment: $5,845.90 Current Payment To Date Payment -------------------------- ---------------------------------------------- Number Interest Principal Inter...

Calling atan function on Blackberry 4.2 JDE

Hi there. I need to calculate the arc tan value from my Blackberry Java app. Unfortunately, the blackberry 4.2 api doesn't have the Math.atan() function. Heaven knows why, but that's the Blackberry API for you. Version 4.6 of the Blackberry JDE has it, but not 4.2. Does anyone know of a workaround to calculate atan? ...

Calculation error - need help!

Hello, I need to ask someone for a big favor. What you see in the code below are my calculations for train movement for a train game I am writing. There is a problem with the calculations, but I just can't seem to find it. The problem seems to be located in this code: if($trainRow['direction'] == '-') { $trackUnitCount = ...