Is it possible to use PRBMath V3 as a library instead of a type? #143
-
Hello, is it possible to use the math functions as library instead of a type? In the old version it was possible to access math functions by writing:
Is this still possible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi Alex, I'm afraid that it is not possible to use PRBMath V3 as a library. V3 is a major release (according to the semver definition), and so it includes breaking changes. As per the release notes and the announcement thread on Twitter, I have deliberately refactored the library to use only user defined value types and free functions instead of the library syntax. I did this because using the As a short term solution, what you could do is stick with the v2.5.0 release, noting that the v2.x trunk will not benefit from any further maintenance from me (except for critical bugs). In the long term, I would encourage you to dabble into user defined value types. They really are great. I spent quite a bit of time documenting how V3 works, and in the README you can find several code snippets that should simplify the learning curve. I would imagine that for your use case, the Convertor Functions section is the most relevant. |
Beta Was this translation helpful? Give feedback.
Hi Alex, I'm afraid that it is not possible to use PRBMath V3 as a library. V3 is a major release (according to the semver definition), and so it includes breaking changes.
As per the release notes and the announcement thread on Twitter, I have deliberately refactored the library to use only user defined value types and free functions instead of the library syntax. I did this because using the
SD59x18
type instead ofint256
is much less of a footgun for end users, because it forces them to handle the fixed-point types separately (see this comparison I made between V2 and V3).As a short term solution, what you could do is stick with the v2.5.0 release, noting that the v2.x trunk will not …