calculation

jQuery calculation plugin: show total in form field rather than text

I'm embarrassed by the 'basicness' of this question, but after wasted hours, here goes. In an effort to do something with the jQuery Calculation plugin, I am playing with the basic example of the order form on the plugin site. I want to have the grand total as a form field,rather than text, so I can use the value. The function that ca...

jQuery changing fields to substring of related field

Another jquery calculation question. I've this, which is sample code from the plugin site that I am playing with to get this working: function recalc(){ $("[id^=total_item]").calc( "qty * price", { qty: $("input[name^=qty_item_]"), price: $("input[name^=price_item_]"), }, fu...

jquery performing calculation on dynamically generated elements

I have a table made up of a row of 3 input elements: Price, Quanity, and Total. Under that, I have two links I can click to dynamically generate another row in the table. All that is working well, but actually calculating a value for the total element is giving me trouble. I know how to calculate the value of the first total element but ...

How to get the nth root of big numbers in C++?

Is there a C++ library that can take nth roots of big numbers (numbers than can't fit in an unsigned long long)? ...

Why does this JavaScript not correctly update input values?

I have two input fields, and without changing their names (i.e., I have to use the name with the brackets), how do I make this javascript code work? <script> function calc_concreteprice(mainform) { var oprice; var ototal; oprice = (eval(mainform.['concrete[concrete][sqft]'].value) * eval(mainform.['concrete...

where should I do the calculating stuff,PHP or Mysql?

I've been doing a lot of calculating stuff nowadays. Usually I prefer to do these calculations in PHP rather than MySQL though I know PHP is not good at this. I thought MySQL may be worse. But I found some performance problem: some pages were loaded so slowly that 30 seconds' time limit is not enough for them! So I wonder where is the b...

Algorithm for calculating definite integrals with bounds at infinity

Suppose I have an integral that's bounded on one (or both) end by (-)infinity. AFAICT, I can't analytically solve this problem, it takes brute force (e.g. using a Left Riemann Sum). I'm having trouble generalizing the algorithm so that it sets the proper subdivisions; I'll either do far too much work to calculate something trivial, or ...

C - floating point rounding

I'm trying to understand how floating point numbers work. I think I'd like to test out what I know / need to learn by evaluating the following: I would like to find the smallest x such that x + 1 = x, where x is a floating point number. As I understand it, this would happen in the case where x is large enough so that x + 1 is closer t...

Getting TexBox's ID's .... to Calculate

i have : vb code: Private Sub Calculation() Dim txt1 As Decimal txt1 = (CS_Incoms_done.Text / CS_Incoms_target.Text) * 100 CS_Incom_Result.Text = "%" + FormatNumber(txt, 2, TriState.False) Dim txt2 As Decimal txt2 = (CS_GovernmentService_done.Text / CS_GovernmentService_target....

C++ calculation evaluated to 0

I'm parsing a file and trying to decode coordinates to the right unit. What happens is that this code is evaluated to 0. If I type it into gdb the result is correct. int pLat = (int)( (argv[6].data() == "plus" ? 1 : -1) * ( atoi(argv[7].data()) + atoi(argv[8].data()) / 60. + atoi(argv[9]...

Need help nesting an Excel calculation

Here's what's currently happening: Z8: 100 Z9: =((Z8*W2)+Z8) Z10: =Z9*X2+Z9 Z11: =Z10*Y2+Z10 I start with a value of 100 and then add data from W2, X2 and Y2. This works, but it spans across three cells. I need it to fit into one. I'm drawing a blank on nesting the equations to fit into the one. Help? ...

How to take a user entered number, perform a calculation and display the result in action script?

Hi there, I basically want to know how to take a user entered number, then take another user entered number and times it by a predefined number and then display the result when submit is clicked. E.g. 200 + 300 x 0.4 = xxxx Im sure this must be fairly simple so if anyone is able to help me out it would be greatly appreciated! If thi...

reverse formula conversion

Hi All! I have a formula which calculate position for Y, here it is: double y = ...; double minX = ..; double scaleY = ..; int MAX_COORD = (1 << 16) - 1; int sy = ~(int)((y - minY) / scaleY * MAX_COORD) & 0xFFFF; and now i have sy, and i need to calculate y like this: y = (sy * scaleY) / MAX_COORD + minY; but conversion is not equ...

How to give a textbox a fixed width of 17,5 cm?

I have an application with a textbox, and the width of the textbox on the screen must always be 17,5 centimeters on the screen of the user. This is what I tried so far: const double centimeter = 17.5; // the width I need const double inches = centimeter * 0.393700787; // convert centimeter to inches float dpi = GetDpiX(); // get the d...

Common strategies to deal with rounding errors in currency-intensive soft?

What is your advice on: compensation of accumulated error in bulk math operations on collections of Money objects. How is this implemented in your production code for your locale? theory behind rounding in accountancy. any literature on topic. I currently read Fowler. He mentions Money type, it's typcal structure (int, long, BigDecim...

Calculating intraday candlesticks by time intervals

This maybe an over asked question, but my mind draws blank at this moment. I know what a candlestick chart is and how to draw it daily. But how to draw it intraday at asked time periods. I have this server, written in Java, that gives me trade depth (each trade done since the start of the day). Its just a stream of raw data: price, share...

How many posibilities on a binary ?

in hexadecimal "10 10 10 10" system you have 0-255 posibilities right? in total 256 different posibilities as there are 8 1s and 0s. how many different posibilities would i get? if i had 10 digits. instead of 8? or how would i calculate that in php ? ...

Need help programming with Mclauren series and Taylor series!

Ok so here's what i have so far: #include <stdio.h> #include <math.h> //#define PI 3.14159 int factorial(int n){ if(n <= 1) return(1); else return(n * factorial(n-1)); } void McLaurin(float pi){ int factorial(int); float x = 42*pi/180; int i, val=0, sign; for(i=1, sign=-1; i<11; i+=2){ sign *= -1; // alternate...

Problem with loop MATLAB

no time scores 1 10 123 2 11 22 3 12 22 4 50 55 5 60 22 6 70 66 . . . . . . n n n Above a the content of my txt file (thousand of lines). 1st column - number of samples 2nd column - time (from beginning to end ->accumulated) 3rd column - scores I wanted to create a new file...

GWT Calendrical Calculations

We have a GWT application that needs to display various holidays. Is there a library available to do these calendrical calculations? If not, we'll have to do our own that we can ingest a set of rules to. Cheers ...