logarithm_big_int 1.0.2 copy "logarithm_big_int: ^1.0.2" to clipboard
logarithm_big_int: ^1.0.2 copied to clipboard

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.

example/logarithm_big_int_example.dart

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);
}
3
likes
160
pub points
2%
popularity

Publisher

verified publisherthiagofontes.dev

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.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on logarithm_big_int