logarithm_big_int

pub package

A way to calculate logarithm with a bigInt value given a the base also in bigInt, note that the returned value will be also a bigInt so the decimal values will be lost.

To use this package, run dart pub add logarithm_big_int to add as a dependency in your pubspec.yaml file or flutter pub add logarithm_big_int on a flutter project.

Example

import 'package:logarithm_big_int/logarithm_big_int.dart';

void main() {
  BigInt? logResult;
  // Using extension to calculate log10, with base 10
  logResult = LogarithmBigInt.bigLog(value: 10.toBigInt, logBase: 10.toBigInt);

  // logResult:1 | result on calculator 1
  print(logResult);

  // Using extension method to calculate log101, with base 4
  // You can create a BigInt using the from factory: BigInt.from(x)
  // or using the extension x.toBinInt
  logResult = BigInt.from(101).bigLog(4.toBigInt);

  // logResult:3 | result on calculator 3,3291057413758973685858295567452
  print(logResult);
}

Libraries

logarithm_big_int
Use this library to get the bigInt logarithm value given the value to be calculated and the base of the logarithm