multiplication

long long vs int multiplication

Given the following snippet: #include <stdio.h> typedef signed long long int64; typedef signed int int32; typedef signed char int8; int main() { printf("%i\n", sizeof(int8)); printf("%i\n", sizeof(int32)); printf("%i\n", sizeof(int64)); int8 a = 100; int8 b = 100; int32 c = a * b; printf("%i\n", c); i...

How to correctly multiply two long long ints?

I want to multiply long numbers which are given in a 2^32 basis. I already thought of an nice algorithm to do that, but unfortunatly I'm stuck. The situation I'm stuck at, is how I do multiply two long ints and represent it on the 2^32 basis. #include <stdio.h> #include <stdlib.h> #include <limits.h> typedef unsigned int uint32; typedef...

An exception on OpenCV matrix Function

Hello guys! I am quite a newbie on OpenCV, and I am just about finished my first big program with it. Actually, I would be if a nasty exception wasn't happening. Here it is: OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupport ed array type) in unknown function, file ........\ocv\opencv\src\cxcore\cxarr ay.cpp...

Multiply rows of matrix by vector?

I'm optimizing a function and I want to get rid of slow for loops. I'm looking for a faster way to multiply each row of a matrix by a vector. Any ideas? EDIT: I'm not looking for a 'classical' multiplication. Eg. I have matrix that has 23 columns and 25 rows and a vector that has length of 23. In a result I want to have matrix 25x23...

Fast multiplication of values in an array

Is there a fast way to multiply values of a float array in C++, to optimize this function (where count is a multiple of 4): void multiply(float* values, float factor, int count) { for(int i=0; i < count; i++) { *value *= factor; value++; } } A solution must work on Mac OS X and Windows, Intel and non-Intel....

bitwise multiplication problem

I am working through a problem which i was able to solve, all but for the last piece - i am not sure how can one do multiplication using bitwise operators: 0*8 = 0 1*8 = 8 2*8 = 16 3*8 = 24 4*8 = 32 Can you please recommend an approach to solve this? ...

Is there a solution for Floating point Arithmetic problems in C++ ?

I am doing some floating point arithmetic and having precision problems. The resulting value is different on two machines for the same input. I read the post @ http://stackoverflow.com/questions/3031143/why-cant-i-multiply-a-float and also read other material on the web & understood that it is got to do with binary representation of floa...

Error CS0051 (Inconsistent accessibility: parameter type 'Job' is less accessible than method 'AddJobs.TotalPay(Job)')

I compiled and ran the source code below successfully by omitting the totalFee field. How do I write totalFee into this program so that it will accurately calculate the total fee for each job (rate * time)? Below, you'll see I tried using a method; which generated the error CS0051 (Inconsistent accessibility: parameter type 'Job' is less...