What’s the difference between “mod” and “remainder”?
My friend said that there are differences between “mod” and “remainder”. If so, what are those differences in C and C++? Does ‘%’ mean either “mod” or “rem” in C? 7 Answers 7
My friend said that there are differences between “mod” and “remainder”. If so, what are those differences in C and C++? Does ‘%’ mean either “mod” or “rem” in C? 7 Answers 7
I understand gcc’s –ffast-math flag can greatly increase speed for float ops, and goes outside of IEEE standards, but I can’t seem to find information on what is really happening when it’s on. Can anyone please explain some of the details and maybe give a clear example of how something would change if the flag … Read more
What is the best approach to calculating the largest prime factor of a number? I’m thinking the most efficient would be the following: Find lowest prime number that divides cleanly Check if result of division is prime If not, find next lowest Go to 2. I’m basing this assumption on it being easier to calculate … Read more
Is it possible to do this? double variable; variable = 5; /* the below should return true, since 5 is an int. if variable were to equal 5.7, then it would return false. */ if(variable == int) { //do stuff } I know the code probably doesn’t go anything like that, but how does it … Read more
numpy has three different functions which seem like they can be used for the same things — except that numpy.maximum can only be used element-wise, while numpy.max and numpy.amax can be used on particular axes, or all elements. Why is there more than just numpy.max? Is there some subtlety to this in performance? (Similarly for … Read more
My kids have this fun game called Spot It! The game constraints (as best I can describe) are: It is a deck of 55 cards On each card are 8 unique pictures (i.e. a card can’t have 2 of the same picture) Given any 2 cards chosen from the deck, there is 1 and only … Read more
I’ve been learning about different algorithms in my spare time recently, and one that I came across which appears to be very interesting is called the HyperLogLog algorithm – which estimates how many unique items are in a list. This was particularly interesting to me because it brought me back to my MySQL days when … Read more
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 5 months ago. The community reviewed whether to reopen this question 5 months ago and left it closed: Original close reason(s) were … Read more
In the output layer of a neural network, it is typical to use the softmax function to approximate a probability distribution: This is expensive to compute because of the exponents. Why not simply perform a Z transform so that all outputs are positive, and then normalise just by dividing all outputs by the sum of … Read more
I need a log function for JavaScript, but it needs to be base 10. I can’t see any listing for this, so I’m assuming it’s not possible. Are there any math wizards out there who know a solution for this? 10 Answers 10