Hello Codeforces!!
A few days ago, I wrote a code for BigInt and BigFloat classes and i would like to share it with you for feedback and improvement. For the code Press here.
Note: My BigFloat class stores numbers as a numerator and denominator to efficiently represent fractions like (1/3) without wasting data.
You can use functions like floor(object, n), ceil(object, n), or round(object, n) to extract the first n decimal places or convert the object to a string with a specified precision using str(n).
I've also implemented all comparison operations for BigFloat objects.
Note: The modulus operation for BigFloat currently calculates the modular inverse of the number. While this is interesting, you might also consider offering standard modulus behavior for users.
The Important Operations is
Multiplication: O((n + m) * log(n + m)) using FFT (Fast Fourier Transform). However, for small values of m, O(n * m) might be faster due to lower constant factors. (Here, n refers to the number of digits in the first number, and m refers to the number of digits in the second number.)
Addition and Subtraction: O(max(n, m)) for efficient handling.
Division and Modulus: O(n * m).
Bitwise Operations: O(n * log(n)).
GCD (Greatest Common Divisor) and LCM (Least Common Multiple): O(n * n * log(n)).
Other Mathematical Functions: I've added ceil, floor, round, abs, sqrt, and cbrt (using Newton's Method) to enhance the functionality of the BigFloat class.
Finally, I would like to thank mostafa133 for his help for this code and TryOmar for training me during the beaver scholarship.