Twitter
Essays
Random
« Tamarin and SpiderMonkey fail | Main | How to deal with switch statements »
Thursday
Aug232007

Lazy type expansion

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.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>