Next: Self & prefix operators, Up: Operators
Asymptote uses the standard binary arithmetic operators.
However, when one integer is divided by another, both arguments are
converted to real values before dividing and a real quotient is
returned (since this is usually what is intended). The function
int quotient(int x, int y) returns the greatest integer less
than or equal to x/y. In all other cases both operands are
promoted to the same type, which will also be the type of the result:
+-*/%q*quotient(p,q)+p%q == p for all
integers p and nonzero integers q.
^** is a synonym for ^.
The usual boolean operators are also defined:
==!=<<=>=>&&||^!Asymptote also supports the C-like conditional syntax:
bool positive=(pi >= 0) ? true : false;
The function T interp(T a, T b, real t) returns a+t*(b-a)
for all built-in arithmetic types T.