1 // Absolute value, aka vector magnitude
29 if (isnegativenumber(p1
))
35 if (iscomplexnumber(p1
)) {
46 // abs(1/a) evaluates to 1/abs(a)
48 if (car(p1
) == symbol(POWER
) && isnegativeterm(caddr(p1
))) {
57 // abs(a*b) evaluates to abs(a)*abs(b)
59 if (car(p1
) == symbol(MULTIPLY
)) {
67 multiply_all(tos
- h
);
72 if (isnegativeterm(p1
) || (car(p1
) == symbol(ADD
) && isnegativeterm(cadr(p1
)))) {
88 if (p1
->u
.tensor
->ndim
!= 1)
89 stop("abs(tensor) with tensor rank > 1");