## `^` (Absolute)

The absolute type in Rax represents an duration of an absolute amount of time. For example, "one day" or "thirty-three seconds." Unlike with relative duration which will be described in the next section, the actual length of the absolute does not depend on the starting point of the duration. One day is always one day, regardless of whether we're counting from the 1st of September or from the 1st of October. Things are different with relative durations, like 1 month. The absolute type is denoted by the `^` symbol in Rax. As with all temporal types in Rax, a string in ISO 8601 format can be cast to a valid typed value. Also, numbers and reals can be cast to an absolute value.

```    ^: one'day := (^)"P1D";
^: epsilon := (^)"PT00:00:00.0001";
^: halfday := (^).5;
```

Like a number, an absolute can be negative, for example minus one week. Also like with numbers the unary `+`, `-`, and `#` work as expected. For example:

```    ^: a := (^)"P-7D";
`print a;     // Output: P-1W
`print -a;    // Output: P1W
`print #a;    // Output: P1W
`print +-#-a; // Output: P-1W
```

Multiplying two duration in Rax is considered an error, for what would the result be? However, adding an absolute duration to a point in time results in a new point in time and hence is allowed in Rax. The same holds for adding two absolutes and multiplying a number and an absolute. Continuing the previous example, these are all valid expressions except the first:

```    `print (@)"now" * (@)"now";  // !!! This will cause an error.
`print one'day + halfday;
`print (@)"now" + halfday;
`print (@)"now" - halfday;
`print one'day == 2 * halfday;
```

The absolute difference between (though not the sum of) two points in time is a valid operator and can be calculated using the `^` operator, for example, like so:

```    @: birthday := (@)"2014-08-20T12:33:15";
^: baby_age := (@)"now" ^ birthday;
```

Note that the time difference operator is the `^` and not the minus sign. This is because there is also another type of duration: the relative duration. The table below summarizes all operators defined on `^`.

Table 4.2. Operators defined on `^`

SyntaxExplanation
`ad1 := ad2`Assignment
`ad1 == ad2`Equals
`ad1 != ad2`Not equals
`ad1 < ad2`Less than
`ad1 > ad2`Greater than
`ad1 <= ad2`Less than or equal to
`ad1 >= ad2`Greater than or equal to
`ad1 + ad2`Addition
`ad1 - ad2`Subtraction
`+ad`Unary plus
`-ad`Unary minus
`#ad`Magnitude value
`ad1 % ad2`Modulo. It works exactly as you would expect it to, for example: ```(^)"P1W" % (^)"P2D" == (^)"P1D"```.
`ad * n`Multiplication, where `n` is of type `#`. For example: ```(^)"P1W" * 2 == (^)"P2W"```.
`n * ad`Multiplication, where `n` is of type `#`. For example: ```2 * (^)"P1W" == (^)"P2W"```.
`ad / n`Division, where `n` is of type `#`. For example: ```(^)"P1W" / 2 == (^)"P3DT12H"```.
`ad * r`Multiplication, where `r` is of type `&`. For example: ```(^)"P1W" * 2.5 == (^)"P2W3DT12H"```.
`r * ad`Multiplication, where `r` is of type `&`. For example: ```2.5 * (^)"P1W" == (^)"P2W3DT12H"```.
`ad / r`Division, where `r` is of type `&`. For example: ```(^)"P1W" / 3.5 == (^)"P2D"```.
`t + ad`Addition, `ad` is of type `^`. Returns a point in time resulting from shifting `t` forward by the absolute duration `ad`. For example: ``` (@)"2014-09-11" + (^)"1W2D" == (@)"2014-09-19"```.
`t - ad`Subtraction, `ad` is of type `^`. Returns a point in time resulting from shifting `t` backwards by the absolute duration `ad`. For example: ``` (@)"2014-09-11" - (^)"1W2D" == (@)"2014-09-02"```.