# Introduction

In this chapter

• Using number classes

• Performing arithmetic and trigonometry

• Working with dates and times

Without good support for numbers, there's not much you can program. It should be no surprise, then, that ActionScript 3.0 enables all kinds of numeric activity, from basic arithmetic to date and time handling. With the information in this chapter you can start making useful, interactive, and aesthetic computations.

# Understanding Numeric Types

Using ActionScript, you can create numbers of different types. To understand how to use these, however, you must take a step back and look at the sets of numbers themselves, and what they represent. Later, you will review how different kinds of numbers are represented on modern computers. Knowing the implications of these implementation details can help the wary programmer understand which data types are appropriate in which situations, the limitations of the language, and common problems that might arise.

## Sets of numbers

A number is a number is a number, right? Not so; there are several different types of numbers. These types of numbers are defined by the set of values that they can represent.

Most familiar might be the set of natural numbers, or N. This contains whole numbers starting with zero: {0, 1, 2, 3, . . .}. These are the numbers you use to count discrete objects: “I have two parents.” “There are four emergency exits on this aircraft.” “This piano has 88 keys.”

A superset of the natural ...

Get ActionScript™ 3.0 Bible now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.