multiplication

Elliptic Curve Multiplication Function

时光怂恿深爱的人放手 提交于 2020-01-21 10:00:38
问题 I'm trying to make my own library for the elliptic curve. Some things work, but some others don't. To calculate a public key from a private key, you should multiply the Generator Point with the private key, and you get another point: the public key Point (ECPoint = BigInteger * ECPoint). Now, I have a private key, and I multiply it with the Generator Point of the Secp256k1 curve. I get a a key, but it is not the key I should get. This is my JAVA code: import java.math.BigInteger; public class

Multiply two 100-Digit Numbers inside Excel Using Matrix

匆匆过客 提交于 2020-01-20 09:40:32
问题 I want to multiply two 100-Digit Numbers In Excel using matrix. The issue in Excel is that after 15-digit, it shows only 0. So, the output also need to be in a Matrix. 1st Number: "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" 2nd Number: "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" Output:

Multiply two 100-Digit Numbers inside Excel Using Matrix

ε祈祈猫儿з 提交于 2020-01-20 09:36:34
问题 I want to multiply two 100-Digit Numbers In Excel using matrix. The issue in Excel is that after 15-digit, it shows only 0. So, the output also need to be in a Matrix. 1st Number: "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" 2nd Number: "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" Output:

Multiplication, multiply register verilog

孤街醉人 提交于 2020-01-16 19:21:09
问题 is there a way to multiply a register/ wire with a value? e.g. ... input wire [13:0] setpoint ... if (timer>(setpoint*0.95)) 回答1: Yes this is possible, but multipliers can be quite large so use with caution. In this case the multiplicand is fixed so it will reduce the logic down quite a lot. In RTL a real (as in 0.95) does not have much meaning you need to multiply by a fixed point number, which will also limit the precision which you can represent 0.95. Allowing 10 binary places, a scaling

How many least-significant bits are the same for both an unsigned and a signed multiplication?

那年仲夏 提交于 2020-01-15 09:44:12
问题 ARM processors, for example, have a mul instruction, which performs a 32-bit x 32-bit multiplication and returns the least-significant 32-bits of the result. They also have umull and smull instructions, which again do a 32-bit x 32-bit multiplication, but return a full 64-bit result. umull does an unsigned multiplication, and smull does a signed multiplication. Why is it not necessary to have separate unsigned and signed versions of mul ? In the case of a 32-bit x 32-bit multiplication,

Mysteries of C++ optimization

倖福魔咒の 提交于 2020-01-14 10:13:49
问题 Take the two following snippets: int main() { unsigned long int start = utime(); __int128_t n = 128; for(__int128_t i=1; i<1000000000; i++) n = (n * i); unsigned long int end = utime(); cout<<(unsigned long int) n<<endl; cout<<end - start<<endl; } and int main() { unsigned long int start = utime(); __int128_t n = 128; for(__int128_t i=1; i<1000000000; i++) n = (n * i) >> 2; unsigned long int end = utime(); cout<<(unsigned long int) n<<endl; cout<<end - start<<endl; } I am benchmarking 128 bit

C - Saturating Signed Integer Multiplication with Bitwise Operators

时光总嘲笑我的痴心妄想 提交于 2020-01-13 20:25:45
问题 Alright, so the assignment I have to do is to multiply a signed integer by 2 and return the value. If the value overflows then saturate it by returning Tmin or Tmax instead. The challenge is using only these logical operators (! ~ & ^ | + << >>) with no (if statements, loops, etc.) and only allowed a maximum of 20 logical operators. Now my thought process to tackle this problem was first to find the limits. So I divided Tmin/max by 2 to get the boundaries. Here's what I have: Positive This

JQ: How to multiply values that are recognised as strings?

℡╲_俬逩灬. 提交于 2020-01-13 19:24:26
问题 I am trying to get some trade information from an exchange websocket. Both values .p and .q are enclosed between double quotes in the JSON I get from the socket. When I try to multiply two values, it says I am trying to multiply two strings. So I pass those strings though the tonumber filter and the error message changes a bit, but can't get it to work really. JSON: {"e":"aggTrade","E":1562109562958,"s":"BTCUSDT","a":134343336,"p":"10796.60000000","q":"0.00139000","f":147532295,"l":147532295,

JQ: How to multiply values that are recognised as strings?

安稳与你 提交于 2020-01-13 19:24:06
问题 I am trying to get some trade information from an exchange websocket. Both values .p and .q are enclosed between double quotes in the JSON I get from the socket. When I try to multiply two values, it says I am trying to multiply two strings. So I pass those strings though the tonumber filter and the error message changes a bit, but can't get it to work really. JSON: {"e":"aggTrade","E":1562109562958,"s":"BTCUSDT","a":134343336,"p":"10796.60000000","q":"0.00139000","f":147532295,"l":147532295,

How do I efficiently multiply a range of values of an array with a given number?

只谈情不闲聊 提交于 2020-01-12 03:53:14
问题 The naive way would be to linearly iterate the range and multiply with each number in the range. Example: Array: {1,2,3,4,5,6,7,8,9,10}; Multiply index 3 to index 8 with 2. Assuming one based index. Result array should be : {1,2,6,8,10,12,14,16,9,10}; I know that Binary indexed tree can be used for the 'sum' part. How can I efficiently multiply a given range with a number? 回答1: If you want to actually modify the array, you can't do better than the naive linear algorithm: you have to iterate