---
name: "Set::Infinite::Arithmetic"
section: "3pm"
platform: "linux"
package: "perl-set-infinite"
version: "0.65-7"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Set::Infinite::Arithmetic"
---

# Set::Infinite::Arithmetic(3pm)

### NAME

Set::Infinite::Arithmetic - Scalar operations used by **quantize()** and **offset()**

### AUTHOR

Flavio Soibelmann Glock - fglock@pucrs.br

### %\_MODE hash of subs

```
    $a->offset ( value => [1,2], mode => 'offset', unit => 'days' );
    $a->offset ( value => [1,2, -5,-4], mode => 'offset', unit => 'days' );
```

note: if mode = circle, then "-5" counts from end (like a Perl negative array index).

```
    $a->offset ( value => [1,2], mode => 'offset', unit => 'days', strict => $a );
```

option 'strict' will return intersection($a,offset). Default: none.

### %subs\_offset2($object, $offset1, $offset2)

```
    &{ $subs_offset2{$unit} } ($object, $offset1, $offset2);
```

A hash of functions that return:

```
    ($object+$offset1, $object+$offset2)
```

in `$unit` context.

Returned `$object`+$offset1, `$object`+$offset2 may be scalars or objects.

### %Offset\_to\_value($object, $offset)

### %Init\_quantizer($object)

```
    $Offset_to_value{$unit} ($object, $offset);
    $Init_quantizer{$unit} ($object);
```

Maps an 'offset value' to a 'value'

A hash of functions that return ( int($object) + `$offset` ) in `$unit` context.

Init\_quantizer subroutines must be called before using subs\_offset1 functions.

int(object)+offset is a scalar.

Offset\_to\_value is optimized for calling it multiple times on the same object, with different offsets. That's why there is a separate initialization subroutine.

`$self`-\>{offset} is created on initialization. It is an index used  by the memoization cache.
