Skip to content
pubscout

rational

2.2.3, released 2 years ago by an unverified publisher

Allows you to deal with rational numbers in Dart.

WASM-ready
$ flutter pub add rational
Source repository

What it does

Provides a Rational class for performing exact computations on rational numbers. Supports parsing from strings and initializing from integers or BigInts.

AI-written summary of version 2.2.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need precise fractional arithmetic without floating-point inaccuracies
  • You are doing mathematical computations requiring rational numbers

Skip it when

  • You only need standard floating-point operations where minor precision loss is acceptable

Strengths

  • Precise computations on rational numbers
  • Custom gcd implementation for improved performance

Weaknesses

  • Slower than native floating-point types for basic operations

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:rational/rational.dart';

final r = Rational.parse('1.23');

Alternatives

Packages that do the same job and could replace rational.

Works with

Packages commonly used together with rational: ones it builds on, ones built on it, and its own family.