# Class: scalarop

Defines operations between scalararrays / values. Operations are performed componentwise per vector. That means output array and input can be same. Scalartypes must match. Vectorsizes must match, except that last operand may have vectorsize of 1, as well. Non-saturated operations may cause 'wrap' values, ie truncation happening post operation. For example a uint8 operation may yield 300 as result, which means 44 (300 mod 256) is written. The saturated operations would clamp to 255 in that case.

## Hierarchy

    o-+ mathlib
      o-+ scalarop

## Methods:

### Method overview:

- add2
- add2sat
- clear0
- copy1
- div2
- div2sat
- lerp3
- lerpinv3
- madd3
- madd3sat
- max2
- min2
- mul2
- mul2sat
- sub2
- sub2sat

add2 ()
  returns: ([scalarop])
  out = arg1 + arg2.
add2sat ()
  returns: ([scalarop])
  out = saturate(arg1 + arg2).
clear0 ()
  returns: ([scalarop])
  out = 0 (zero)
copy1 ()
  returns: ([scalarop])
  out = arg1.
div2 ()
  returns: ([scalarop])
  out = arg1 / arg2.
div2sat ()
  returns: ([scalarop])
  out = saturate(arg1 / arg2).
lerp3 ()
  returns: ([scalarop])
  out = lerp(arg1 to arg2 via arg3).
lerpinv3 ()
  returns: ([scalarop])
  out = lerp(arg1 to arg2 via 1-arg3).
madd3 ()
  returns: ([scalarop])
  out = arg1 + (arg2 * arg3).
madd3sat ()
  returns: ([scalarop])
  out = saturate(arg1 + (arg2 * arg3)).
max2 ()
  returns: ([scalarop])
  out = max(arg1,arg2).
min2 ()
  returns: ([scalarop])
  out = min(arg1,arg2).
mul2 ()
  returns: ([scalarop])
  out = arg1 * arg2.
mul2sat ()
  returns: ([scalarop])
  out = saturate(arg1 * arg2).
sub2 ()
  returns: ([scalarop])
  out = arg1 - arg2.
sub2sat ()
  returns: ([scalarop])
  out = saturate(arg1 - arg2).

## Inherited Methods:

### From mathlib

quatslerpq, quatslerpqt