Previously, I've done this in JS like:
```
var errMargin = epsilon * Math.abs(expected);
return (expected - errMargin) <= actual && actual <= (expected + errMargin);
```

I'm slightly interested why you used the code from the wordpress author. As near as I can tell their code contains some extra complexity primarily for improving performance in extreme situations (never will be an issue here) and avoiding integer overflows in a C-based language.

Oh well. Reading the article clarifies the intent of the code, but I wouldn't have easily understood it on my own.