Question: Is there a way to determine whether dividing one number by another will result in whole number in JavaScript? Like `18.4 / 0.002` gives us `9200`, but `18.4 / 0.1` gives us `183.99999999999997`. The problem is that both of them may be any float number (like 0.1, 0.01, 1, 10, ...) which makes it impossible to use the standard function modulo or trying to subtract, and floating point precision issues mean we will sometimes get non-whole-number results for numbers that should be whole, or whole-number results for ones that shouldn't be.

Answer: 
One hacky way would be 

1. Convert both numbers to strings with `toString()`
2. Count the precision points (N) by stripping off the characters before the `.` (including the `.`) and taking the length of the remaining part
3. Multiply with 10^N to make them integers
4. Do modulo and get the result

Updated Demo: <http://jsfiddle.net/9HLxe/1/>

```
function isDivisible(u, d) {
    var numD = Math.max(u.toString().replace(/^\d+\./, '').length, 
                        d.toString().replace(/^\d+\./, '').length);
    u = Math.round(u * Math.pow(10, numD));
    d = Math.round(d * Math.pow(10, numD));
    return (u % d) === 0;
}

```
Divide first number by second one and check if result is integer ?

Only, when you check that the result is integer, you need to specify a rounding threshold.
In javascript, 3.39/1.13 is slightly more than 3.

Example :

```
/**
* Returns true iif a is an integer multiple of b
*/
function isIntegerMultiple(a, b, precision) {
    if (precision === undefined) {
        precision = 10;
    }

    var quotient = a / b;
    return Math.abs(quotient - Math.round(quotient)) < Math.pow(10, -precision);
}

console.log(isIntegerMultiple(2, 1)); // true
console.log(isIntegerMultiple(2.4, 1.2)); // true
console.log(isIntegerMultiple(3.39, 1.13)); // true
console.log(isIntegerMultiple(3.39, 1.13, 20)); // false
console.log(isIntegerMultiple(3, 2)); // false

```

Have a look at this for more details on floating point rounding issues: [Is floating point math broken?](https://stackoverflow.com/questions/588004/is-floating-point-math-broken)