formatOmniSeconds function

String formatOmniSeconds(
  1. double x
)

Python's f'{x:.1f}': the exact binary value, ties to even.

Implementation

String formatOmniSeconds(double x) {
  final quarters = x * 4;
  if (quarters == quarters.roundToDouble() && quarters.round().isOdd) {
    final tenths = _roundEven(x * 10);
    return '${tenths ~/ 10}.${tenths % 10}';
  }
  return x.toStringAsFixed(1);
}