rational
2.2.3, released 2 years ago by an unverified publisher
Allows you to deal with rational numbers in Dart.
WASM-ready
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.
- text
Get detailed text metrics like lines, character positions, and locations.
51Compare - number_to_word_arabic
Convert integer numbers to Arabic words up to 99 trillion.
47Compare
Works with
Packages commonly used together with rational: ones it builds on, ones built on it, and its own family.
- decimalBuilt on rationalArbitrary-precision decimal arithmetic for Dart
- bsonBuilt on rationalBSON binary-encoded serialization library for Dart and EJSON support.
- proto_annotationsBuilt on rationalAnnotations to mark and configure business model classes for code generation of .proto and Dart mappers.
- common_utilsBuilt on rationalDart common utility library containing date, regex, timer, currency, and object helpers.
- realm_dartBuilt on rationalOfficial Realm database SDK for Flutter and Dart to store and query objects locally.
- humanizerBuilt on rationalConverts raw Dart values into human-friendly representations.