I'm looking for the fastest way to determine if a long
value is a perfect square (i.e. its square root is another integer). I've done it the easy way, by using the built-in Math.sqrt() function, but I'm wondering if there is a way to do it faster by restricting yourself to integer-only domain. Maintaining a lookup table is impratical (since there are about 2 31.5 integers whose square is less than 2 63 ).
Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Friday, May 25, 2012
Fastest way to determine if an integer"s square root is an integer
Wednesday, May 23, 2012
How to check if a number is a power of 2
Today I needed a simple algorithm for checking if a number is a power of 2.
Thursday, May 17, 2012
How to translate this Math Formula in PHP?
I'm trying to convert a Math Formula into PHP code.
You can see the formula in the accepted answer here: Applying a Math Formula in a more elegant way (maybe a recursive call would do the trick) .
Wednesday, May 16, 2012
Numerical library for Scala
I'm looking for a library to do numerical computing in Scala (or Java, although something that can use scala functions would be way nicer!) with at least the following capabilities:
Thursday, May 10, 2012
Why Math.min() > Math.max()?
When I type in an array into the parameter of the javascript math minimum and maximum functions, it returns the correct value:
Wednesday, May 9, 2012
Simple statistics - Java packages for calculating mean, standard deviation, etc
Could you please suggest any simple Java statistics packages?
I don't necessarily need any of the advanced stuff. I was quite surprised that there does not appear to be a function to calculate the Mean in the java.lang.Math
package...
MathML and Java
I've been doing some research for a mathematical Android related project I'd like to embark upon and I stumbled across for the first time MathML.
Tuesday, February 28, 2012
Android - calculating and storing the answer of an arithmetic expression
What would be best way to get the answer to this question which is using random numbers and random operators.