toString method

  1. @override
String toString({
  1. int? precision,
})
override

Returns the algebraic (Cartesian) representation of the number.

Example: ā€œ3.00 + 4.00iā€. The number of decimal places is given by precision.

Implementation

@override
String toString({int? precision}) {
  final p = precision ?? 2;
  final sign = _im >= 0 ? '+' : '-';
  return '${_re.toStringAsFixed(p)} $sign ${_im.abs().toStringAsFixed(p)}i';
}