パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v6.3.0

fixed

数学演算、フォーマット、パースを備えた固定スケールの小数。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
15.7万
いいね数
12
Pub ポイント
160

パッケージをインストール

flutter pub add fixed

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

固定パッケージは、固定スケールの小数をサポートし、正確な数学演算、フォーマット、解析を可能にします。固定された小数桁数で数値を表現することで、一貫した小数精度を保証し、浮動小数点の不正確さを防ぎます。金融計算や正確な小数演算が必要なシナリオに最適であり、適切な丸め処理を伴う信頼できる加算、減算、乗算、除算を提供します。このパッケージは、Android、iOS、Web、macOS、Windows、Linuxなど、複数のプラットフォームをサポートしています。

用途

  • 財務計算
  • 正確な10進小数演算
  • 通貨の取り扱い
  • 固定精度でのデータシリアライズ
  • 正確な小数が必要な科学計算

主な機能

  • 固定小数スケール
  • 正確な算術演算
  • 組み込みのフォーマットおよびパース
  • 大きな数のサポート
  • クロスプラットフォーム互換性

適している対象

  • 正確な小数計算が必要な開発者
  • 金融または会計アプリケーション
  • 一貫した小数表現を必要とするアプリケーション
  • 浮動小数点エラーを回避するチーム

注意事項

  • スケールファクターの慎重な選択が必要です
  • 固定精度のみに制限
  • 重い計算にはパフォーマンスのオーバーヘッドが発生する可能性があります
  • 任意の精度要件には適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

The Fixed package allows you to store and perform math on decimal numbers with a fixed scale (fixed no. of decimal places).

All amounts are stored as BigInts to allow precision math to be performed.

The features of Fixed are:

  • Fixed uses a selectable fixed scale (no. of decimal places)
  • Fixed provides a builtin formatter and parser Fixed.format(pattern)
  • Full set of mathematical opertors.
  • Fixed includes a convenience method Fixed.formatIntl(locale) which formats the number with the provided locale or the default locale if not provided.

Sponsors

Fixed is sponsored by OnePub, the Dart private package repository.

OnePub

You can create a Fixed instance from a number sources

var t1 = Fixed.fromNum(1); /// == 1.00
var t2 = Fixed.fromNum(1, decimalDigits: 3); /// == 1.000

var add = t1 + 10;
var multiply = t1 * t2;

var t3 = Fixed.parse("1.23356"); // == 1.23356, decimalDigits: 5

if (t1 == t2) // true
{
    print(t1.format('0.##')); // '1.00'
    print(t3.format('0.###')); // '1.123'
}

Full documentation can be found here.

カテゴリー

依存関係

依存関係一覧 3 件

ソースリポジトリ

このパッケージを使用しているプロジェクト