** Next:** Strings
** Up:** Expressions
** Previous:** Numbers
** Contents**

##

Units

Numbers representing physical quantities must have their unit explicitly
specified. This is done by using a unit qualifier. The following units are
recognized:

**bps** |
bits per second |

**Bps** |
bytes per second |

**b** |
bits (aliases: **bit**, **bits**) |

**B** |
bytes (aliases: **Byte**, **Bytes**) |

**p** |
packets (aliases: **pck**, **pcks**) |

**pps** |
packets per second |

**s** |
seconds (aliases: **sec**, **secs**) |

Unit qualifiers can be prefixed with **m** (milli), **k** (kilo),
**M** (mega), or **G** (giga). Note that tcc prints a warning
if using the **m** prefix for anything but seconds. The prefixes are
usually powers of 1000, except when applied to bytes and bits, where they
become powers of 1024.

Arithmetic operators check and adjust units. Numbers with units cannot be
used with logical or bit operators.

Examples:

`1Mbps` |
are 1000000 bits per second |

`2kB` |
are 2048 bytes |

`10.0e6b/1sec` |
are 10 Mbps |

** Next:** Strings
** Up:** Expressions
** Previous:** Numbers
** Contents**
Martin A. Brown
2003-11-06