multiplication

Multiplying two long long ints C

I am working on a program in C as a part of Homework in which I have to get the product of two long numbers which are taken as character string. eg: 123456789021 and 132456789098. Since it is taken as a string, I converted them to long long int for the multiplication. But the resulting product will be very large(larger than long long int...

c# programs..multiplication of strings with n numbers and display it.

I want to multiply strings using functions.with user giving the string and the power to that string.and display it. ...

Fastest algorithm for evaluating large polynomials

Hey everyone. A rather general question, what is the fastest (in terms of time complexity) algorithm for evaluating polynomials of Degree 400 to 500. Thanks in advance. ...

Strassen's algorithm for matrix multiplication

Can someone please explain strassen's algorithm for matrix multiplication in an intuitive way? I've gone through (well, tried to go through) the explanation in the book and wiki but it's not clicking upstairs. Any links on the web that use a lot of English rather than formal notation etc. would be helpful, too. Are there any analogies wh...

Fast multiplication of very large integers

How to multiply two very large numbers greater than 32 characters for example multiplication of 100! with 122! or 22^122 with 11^200 by the help of divide and conquer, do any body have java code or C# code? ...

Python basic maths

My friend wrote up this script for me to calculate the quantity of construction materials needed for a theoretical site. It basically takes 2 numbers and increases them independently until the large number reaches 50,000. It then prints a list like this: 20000:6.40,21000:6.61,22000:6.82,23000:7.03,24000:7.24,25000:7.45,26000:7.66,2700...

Double variable keeping wrong value.

Simimilar problem to http://stackoverflow.com/questions/1957801/math-atan2-or-class-instance-problem-in-c and http://stackoverflow.com/questions/1193630/add-two-double-given-wrong-result It is something that simple lines: public static String DegreeToRadianStr(Double degree) { Double piBy180 = (Math.PI / 180); Dou...

Why does (int)(33.46639 * 1000000) return 33466389?

(int)(33.46639 * 1000000) returns 33466389 Why does this happen? ...

Why does multiplying a double by -1 not give the negative of the current answer

I am trying to multiply a double value by -1 to get the negative value. It continues to give me a positive value EDIT: I am putting all the code up. public class DecToTime { public static void main(String[] args) throws IOException { DecToTime dtt = new DecToTime(); double val = dtt.getNumber("13.930000000000E+02"); S...

Modifying multiplying calculation to use delta time

function(deltaTime) { x = x * FACTOR; // FACTOR = 0.9 } This function is called in a game loop. First assume that it's running at a constant 30 FPS, so deltaTime is always 1/30. Now the game is changed so deltaTime isn't always 1/30 but becomes variable. How can I incorporate deltaTime in the calculation of x to keep the "effect per...

Multiplication algorithm for abritrary precision (bignum) integers.

Hi, I'm writing a small bignum library for a homework project. I am to implement Karatsuba multiplication, but before that I would like to write a naive multiplication routine. I'm following a guide written by Paul Zimmerman titled "Modern Computer Arithmetic" which is freely available online. On page 4, there is a description of an a...

How can i multiply and divide with only using bit shifting and adding?

How can i multiply and divide with only using bit shifting and adding? ...

Calculating interest in objective c?

What is a simple piece of code to read a stored number, calculate interest on the stored value, say $100, at a rate of %10. Then I store the new value in place of the old one. I was working towards this: NSNumber *bankTemp = [[NSNumber alloc] initWithInt:[[NSUserDefaults standardUserDefaults] integerForKey:@"bank"]]; bankTemp = bankTe...

Variable Multiplication in C?

//Hydroelectric Dam Helper #include <stdio.h> #define GRAV 9.80 #define EFINC 0.9 #define EFINC2 90 int main() { //Defines all the variables to be used double height, work, mass; printf("Height of dam (in meters):"); scanf("%lf", &height); printf("Flow of water (in thousand cubic meters per second):"); scanf("%lf", &mass); ...

Strange CUDA behavior in vector multiplication program

Hi, I'm having some trouble with a very basic CUDA program. I have a program that multiplies two vectors on the Host and on the Device and then compares them. This works without a problem. What's wrong is that I'm trying to test different number of threads and blocks for learning purposes. I have the following kernel: __global__ void m...

Mutiplication support for jquery Calculation.

Hi, I would like to know how to add support for multiplication in this jQuery solution: http://stackoverflow.com/questions/3239760/jquery-calculation-question It works well for addition and substraction, but how can it support multiplication? thanks. You can see the code example here: http://jsfiddle.net/JRcqk/1/ ...

How to multiply two big big numbers

Hey guys, Consider a list of numbers L=. We can only have the series between +=2^j, while 0<=j<=32.We have to implement an algorithm which implements the largest product. ...

Bash Multiplying Decimal to int

I read price from user input. When i multiply the input with int like this T="$((PRICE*QTY))"|bc; gives line 272: 12.00: syntax error: invalid arithmetic operator (error token is ".00") or .50 depending on user input. How do i multiply these two variables and get a total with 2 decimal points? ...

can't convert Array into Integer

I'm trying to iterate through an array, @chem_species = ["H2", "S", "O4"] and multiply a constant times the amount of constants present: H = 1.01 * 2, S = 32.1 * 1 and so on. The constants are of course defined within the class, before the instance method. The code I've constructed to do this does not function: def fw x = @chem_specie...

64 bit integer math and bitwise operation benchmarks

I'm trying to get a feel for the difference in performance between integer multiplication compared to bitwise operations... I have two potential hashing algorithms acting on 64 bit keys, one which uses a single multiply, single right shift, and single mask, the other which involves several shift and mask operations... but I want to try ...