Posts Tagged nan

Steal Some More Bits

Tags: , , ,

Today we continue stealing float bits, but in an entirely different way this time. We’ll end up with the ability to switch between float and 21-bit integer modes and to know which mode we’re in. We can do all of this without using any more than four bytes just by exploiting a little knowledge of the float data format. Read on to learn how!

Read the rest of this article »

No Comments

Definitive isNaN()

Tags: , , ,

I wrote an article in November 2009 titled Faster isNaN() and a followup to it titled Even Faster isNaN() and continue to get comments on both, so today I’m doing a followup to bring together both articles and the many comments on them into one definitive article. (UPDATE: added Windows performance results)

Read the rest of this article »

11 Comments

Even Faster isNaN()

Tags: , , , ,

I wrote an article last November showing how to make your isNaN() calls 12x faster. Today, thanks to a tip from the comments on that article, I’ll show you how to make your isNaN() calls even even faster! (UPDATE: see the definitive article on isNaN for much more!)

Read the rest of this article »

9 Comments

Faster isNaN()

Tags: ,

You cannot directly check if a value is NaN by comparing with it. AS3, AS2, and JavaScript therefore provide a useful isNaN() function to do this very check. However, it is very slow. Today I’ll show you a workaround that results in a faster isNaN(): (UPDATE: see the definitive article on isNaN for much more!)

Read the rest of this article »

22 Comments