long-integer

Multiplying two polynomials mod n,x^r-1 using long integers: what is the correct window size?

谁说胖子不能爱 提交于 2019-12-24 17:43:13
问题 Using a window multiplication algorithm to multiply two polynomials[coefficients in Z/nZ and the whole polynomial mod x^r-1 for some r] using long-integer multiplications, what size should I give to the window? Where by "window" I mean the bit-length that the coefficients should use in the initial long-integers such that the result of the long-integer multiplication contains the correct coefficients of the result[the sums of the coefficients "don't overlap"]. At the beginning I thought that

Reading a long from a struct on 32 bit system(C)

限于喜欢 提交于 2019-12-24 09:15:47
问题 In C, I have a struct with a member "frequency", which is a long unsigned int. The hardware this code is running on is 32 bits. The struct has its value set at instantiation. struct config_list configuration = { ... .frequency = (long unsigned int)5250000000u, ... } In my code, I pass this struct, via pointer, to a subroutine. Inside this subroutine, I don't seem to be able to get the right value, so to check, I put in this: printf("Config frequency: %lu\n", ptr->frequency); printf(

Ambiguity in long integer arithmetic?

隐身守侯 提交于 2019-12-24 08:01:41
问题 Have a look at the following piece of code: #include <stdio.h> int main(void) { int a; a = 2147483647; printf("a + 1 = %d \t sizeof (a + 1) = %lu\n", a + 1, sizeof (a + 1)); printf("a + 1L = %ld \t sizeof (a + 1L) = %lu\n", a + 1L, sizeof (a + 1L)); a = -1; printf("a + 1 = %d \t sizeof (a + 1) = %lu\n", a + 1, sizeof (a + 1)); printf("a + 1L = %ld \t sizeof (a + 1) = %lu\n", a + 1L, sizeof (a + 1L)); //why a + 1L does not yield long integer ? return 0; } This results in the following output:

VBA Range.Find() function not working with large floating numbers

六月ゝ 毕业季﹏ 提交于 2019-12-24 07:44:10
问题 I am writing code to lookup the highest dollar amount in a column and bring back the value as well as the value of cells in adjacent columns with 9 char in the target cell When I set the range variable it shows the value of "12000.88" which works fine, however as soon as that value extends to over 9 digits "123000.55" the "set fnd" doesn't find it and the range variable is Nothing. I have tested many other things and have found the only difference is the length of the value Sub Populate() Dim

VBA Range.Find() function not working with large floating numbers

删除回忆录丶 提交于 2019-12-24 07:43:10
问题 I am writing code to lookup the highest dollar amount in a column and bring back the value as well as the value of cells in adjacent columns with 9 char in the target cell When I set the range variable it shows the value of "12000.88" which works fine, however as soon as that value extends to over 9 digits "123000.55" the "set fnd" doesn't find it and the range variable is Nothing. I have tested many other things and have found the only difference is the length of the value Sub Populate() Dim

How to collect and store tellp(), tellg() return types?

折月煮酒 提交于 2019-12-24 02:16:07
问题 I am writing a program that maintains a linked_list in a file. So I traverse across the file, by using tellp()/tellg() and adding it to a particular long integer(can be seen as an offset) to get to the new location. An simple example would be long next_offset = sizeof(long) + sizeof(int) .... //like size of all the elements in the record, etc curr_node = out.seekg(); while(curr_node != -1) { out.read(...); **curr_node.seekg(curr_node.tellp() + next_offset);** out.read((char *)&curr_node

Bitwise operation on longs

妖精的绣舞 提交于 2019-12-23 13:11:35
问题 I trying to compile this code: Int64 itag = BitConverter.ToInt64(temp, 0); itag &= 0xFFFFFFFFFFFFFC00; However this gives me the following error: Operator '&=' cannot be applied to operands of type 'long' and 'ulong' How do I do this? 回答1: See http://msdn.microsoft.com/en-en/library/aa664674%28v=vs.71%29.aspx . If the literal has no suffix, it has the first of these types in which its value can be represented: int , uint , long , ulong . You have 0xFFFFFFFFFFFFFC00 but Int64.Max is:

int to long assignment

岁酱吖の 提交于 2019-12-23 06:56:59
问题 I have been trying this int and long conversion where I have tried assigning an int variable to a long variable. The code is as follows: public static void main(String []args){ int i = 1024; long j = i; long k = i*i*i*i; System.out.println("j= " +j+ ", k= " +k); } So, while printing j , it simply gave an output of 1024 . But while printing k , it showed an overflow ( k =0). I sorted out this problem by using this technique, where I have explicitly casted each i to long . i.e. public static

What happened between March 28th and March 29th, 1976 with the java.util.GregorianCalendar?

杀马特。学长 韩版系。学妹 提交于 2019-12-23 06:48:51
问题 Trying to use the GregorianCalendar, I got stuck on a singularity while computing the number of days since a particular date. In the scala interpreter, I entered : scala>import java.util.GregorianCalendar scala>import java.util.Calendar scala>val dateToday = new GregorianCalendar(2012,Calendar.MAY,22).getTimeInMillis() dateToday: Long = 1337637600000 scala>val days1 = (dateToday - (new GregorianCalendar(1976,Calendar.MARCH,28).getTimeInMillis())) / (1000*3600*24) days1: Long = 13203 scala>val

Java Collections.shuffle() weird behaviour [closed]

风流意气都作罢 提交于 2019-12-23 01:59:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I am experiencing something weird. I have a big ArrayList of Long numbers. It contains about 200k numbers in ascending order. These numbers are always distinct; they are not necessarily consecutive, but some groups of them usually are. I want to extract a sorted sample of 5k from this list, so basically this is my