Hi Fave
There is no definitive answer to which library is better, as it may depend on your use case, preferences, and trade-offs. However, I can provide some information
Vectorized FixedPointMathLib is a library for fixed-point arithmetic operations on uint256 numbers, using 18 decimal places as the default precision. It is based on the OpenZeppelin FixedPoint library, but with some optimizations and vectorized operations. It allows you to perform addition, subtraction, multiplication, division, and exponentiation on arrays of fixed-point numbers, as well as some utility functions such as finding the minimum, maximum, or average of an array. It also supports fractional constants such as pi and e. You can find the source code and documentation here1.
ABDKMath64x64 is a library for mathematical functions operating with signed 64.64-bit fixed point numbers. It uses int128 to store the numerator of a fraction whose denominator is 2^64. It offers a wide range of functions, such as simple arithmetic, average, power, root, exponentiation, logarithm, trigonometry, and conversions. It also has some advantages over decimal fixed-point libraries, such as better performance, smaller storage size, and higher precision for some operations. You can find the source code and documentation here2.
Some factors that you may consider when choosing between these libraries are:
The range and precision of the numbers you need to work with. Vectorized FixedPointMathLib can handle larger numbers, but with less precision than ABDKMath64x64. For example, the maximum value for Vectorized FixedPointMathLib is about 10^77, while for ABDKMath64x64 it is about 10^38. However, the smallest value for Vectorized FixedPointMathLib is about 10^-18, while for ABDKMath64x64 it is about 10^-19.
The type and complexity of the operations you need to perform. Vectorized FixedPointMathLib supports more basic operations, such as addition, subtraction, multiplication, and division, as well as some vectorized operations, such as finding the minimum, maximum, or average of an array. ABDKMath64x64 supports more advanced operations, such as power, root, exponentiation, logarithm, trigonometry, and conversions, as well as some simple arithmetic operations. However, some operations may be more expensive or less accurate in one library than the other, depending on the implementation and the input values.
The compatibility and interoperability with other libraries or contracts. Vectorized FixedPointMathLib uses the same format and precision as the OpenZeppelin FixedPoint library, which is widely used in the Ethereum ecosystem. It also uses uint256 as the underlying type, which is compatible with most Solidity types and functions. ABDKMath64x64 uses a different format and precision than most decimal fixed-point libraries, and it uses int128 as the underlying type, which may require some conversions or adaptations when interacting with other libraries or contracts.
I hope this information helps you to make an informed decision
Nov 8, 2023, 6:10 AM
did you just use gpt?
Nov 8, 2023, 11:17 AM
Ctrl + C and V
Nov 8, 2023, 11:18 AM
Most of the places😅
Nov 8, 2023, 12:33 PM