Thursday
Aug232007
Lazy type expansion
Thursday, August 23, 2007 WE have a problem of how to convert integers to doubles. The JavaScript spec says that all numbers are double types. But in Java, you have integers and doubles. So we assume everything is first an integer. This makes our performance much better than if we start with all doubles. We then do lazy type evaluation. So if you have two integers, and the multiplication overflows, automatically convert the result into a double. We can also do this into type contraction. Bit operators only work on integers. So if a double is to be anded, we convert the result into an int.
tagged
JavaScript
JavaScript 
Reader Comments