multiplication Questions

4

Solved

I am learning assembly for x86 using DosBox emulator. I am trying to perform multiplication. I do not get how it works. When I write the following code: mov al, 3 mul 2 I get an error. Although,...
Dehnel asked 10/12, 2013 at 15:58

11

Solved

I am working through a problem which I was able to solve, all but for the last piece—I am not sure how one can do multiplication using bitwise operators: 0*8 = 0 1*8 = 8 2*8 = 16 3*8 = 24 4*8 =...
Indicative asked 15/9, 2010 at 21:33

6

Solved

In C++, say that: uint64_t i; uint64_t j; then i * j will yield an uint64_t that has as value the lower part of the multiplication between i and j, i.e., (i * j) mod 2^64. Now, what if I wanted th...
Gamali asked 5/3, 2015 at 1:23

16

Solved

I am looking for an efficient (optionally standard, elegant and easy to implement) solution to multiply relatively large numbers, and store the result into one or several integers : Let say I have...
Bautista asked 29/11, 2009 at 12:14

11

Solved

What do I have to do so that when I string s = "."; If I do cout << s * 2; Will it be the same as cout << ".."; ?
Lavabo asked 7/8, 2012 at 9:44

3

Solved

I have written the code: int x = 18; x *= 0.90; System.out.println(x); This code printed 16 However, when I wrote int x = 18; x = x * 0.90; System.out.println(x); it gave me the following...
Paymar asked 8/12, 2023 at 4:15

16

Solved

How can I multiply and divide using only bit shifting and adding?
Fabre asked 5/5, 2010 at 19:35

3

Solved

If you are multiplying two binary numbers, one with n number of bits and one with m number of bits, how many bits is the product? For ex., if I multiply a binary number of 6 bits and a binary numbe...
Fiance asked 22/9, 2015 at 15:35

10

Solved

I want to create a series of lists, all of varying lengths. Each list will contain the same element e, repeated n times (where n = length of the list). How do I create the lists, without using a li...
Micropyle asked 11/8, 2010 at 14:1

4

Solved

My output is like this - ruby-1.9.2-p290 :011 > 2.32 * 3 => 6.959999999999999 And I remember sometime back on another machine I had got it like.. 2.32 * 3 = 6 What is my mistake? Thanks a...
Expropriate asked 20/10, 2011 at 20:53

6

Solved

I have a numeric matrix with 25 columns and 23 rows, and a vector of length 25. How can I multiply each row of the matrix by the vector without using a for loop? The result should be a 25x23 matri...
Colcothar asked 4/9, 2010 at 18:51

7

This question was asked in an interview. You have an array of small integers. You have to multiply all of them. You need not worry about overflow you have ample support for that. What can you do t...
Moulin asked 15/4, 2014 at 17:50

15

Given a list of numbers like [1,2,3,4,5,6], how can I write code to multiply them all together, i.e. compute 1*2*3*4*5*6?
Premiere asked 12/12, 2012 at 13:0

3

Solved

I'm looking for a way to multiply the values of a Counter object, i.e. a = collections.Counter(one=1, two=2, three=3) >>> Counter({'three': 3, 'two': 2, 'one': 1}) b = a*2 >>> C...
Flashcube asked 15/5, 2014 at 12:17

6

Solved

I came accross a weird problem, I want to do some basic math checks. I have read to avoid floating numbers so I decided to multiply my math values with 10000, because my value can be between 0.9 an...
Numeral asked 3/4, 2012 at 12:28

9

Solved

Python's sum() function returns the sum of numbers in an iterable. sum([3,4,5]) == 3 + 4 + 5 == 12 I'm looking for the function that returns the product instead. somelib.somefunc([3,4,5])...
Epeirogeny asked 27/2, 2009 at 16:6

1

Solved

Basically, the expression 0.4 * a is consistently, and surprisingly, significantly faster than a * 0.4. a being an integer. And I have no idea why. I speculated that it is a case of a LOAD_CONST LO...
Unsuccess asked 11/8, 2022 at 20:29

2

Solved

I need to multiply several big long integers as efficiently as possible. I am trying to implement the Harvey & van der Hoeven 2019 algorithm for integer multiplication, but I am stuck on unders...
Excellency asked 10/1, 2022 at 0:13

10

Solved

I have the following code int i, a, z; i = 2343243443; a = 5464354324324324; z = i * a; cout << z << endl; When these are multiplied it gives me -1431223188 which is not the...
Jetta asked 25/10, 2014 at 0:7

2

Solved

If I had the sum of products like z*a + z*b + z*c + ... + z*y, it would be possible to move the z factor, which is the same, out before brackets: z(a + b + c + ... y). I'd like to know how it is p...

4

Solved

Coding some Quantum Mechanics routines, I have discovered a curious behavior of Python's NumPy. When I use NumPy's multiply with more than two arrays, I get faulty results. In the code below, i hav...
Usanis asked 19/4, 2013 at 7:28

6

Solved

Is there any efficient and portable way to check when multiplication operations with int64_t or uint64_t operands overflow in C? For instance, for addition of uint64_t I can do: if (UINT64_MAX - ...
Cache asked 16/12, 2011 at 12:24

5

Solved

I had a problem when I was adding three floating point values and comparing them to 1. cout << ((0.7 + 0.2 + 0.1)==1)<<endl; //output is 0 cout << ((0.7 + 0.1 + 0.2)==1)<<e...
Maravedi asked 29/4, 2012 at 11:46

3

Solved

I want to multiply all elements in a numpy array. If there's an array like [1, 2, 3, 4, 5], I want to get value of 1 * 2 * 3 * 4 * 5. I tried this by making my own method, but size of array is very...
Palaeolithic asked 27/5, 2017 at 4:3

5

Solved

I have two data.frames: df and weights (code below). df looks like this: id a b d EE f 1 this 0.23421153 -0.02324956 0.5457353 0.73068586 0.5642554 2 is 0.28378641 0.36346241 1.0190496 1.9771501...
Canaday asked 18/7, 2021 at 5:56

© 2022 - 2024 — McMap. All rights reserved.