# All Questions

197340 views

### Is floating point math broken?

0.1 + 0.2 == 0.3 -> false 0.1 + 0.2 -> 0.30000000000000004 Why does this happen?
368925 views

### What is JavaScript's highest integer value that a number can go to without losing precision?

Is this defined by the language? Is there a defined maximum? Is it different in different browsers?
288222 views

### Evaluating a math expression given in string form

I'm trying to write a Java routine to evaluate simple math expressions from String values like: "5+3" "10-40" "10*3" I want to avoid a lot of if-then-else statements. How can I do this?
270356 views

### Determine Whether Two Date Ranges Overlap

Given two date ranges, what is the simplest or most efficient way to determine whether the two date ranges overlap? As an example, suppose we have ranges denoted by DateTime variables StartDate1 to E...
127866 views

### Division of integers in Java

This is a basic question but I can't find an answer. I've looked into floating point arithmetic and a few other topics but nothing has seemed to address this. I'm sure I just have the wrong terminol...
516846 views

### Calculate distance between two latitude-longitude points? (Haversine formula)

How do I calculate the distance between two points specified by latitude and longitude? For clarification, I'd like the distance in kilometers; the points use the WGS84 system and I'd like to underst...
143242 views

### Fastest way to list all primes below N

This is the best algorithm I could come up. def get_primes(n): numbers = set(range(n, 1, -1)) primes = [] while numbers: p = numbers.pop() primes.append(p) numbers...
2797 views

### How do I compose a rotation matrix with human readable angles from scratch?

The one thing that has always hindered me from doing 3D programming is failing to understand how math works. I can go along with math fine in programming flow using methods and functions, then its all...