eobermuhlner / big-math

Advanced Java BigDecimal math functions (pow, sqrt, log, sin, ...) using arbitrary precision.
MIT License
311 stars 40 forks source link

Questions about the big-math library: Capabilities and Future. #60

Open PowerUser1234 opened 2 years ago

PowerUser1234 commented 2 years ago

-In terms of base 10 positive intetgers, is there a maximum positive integer that your library can load into memory and operate with?

-In terms of base 10 positive decimals (only), is there a minimum minute value that your library can load into memory and operate with?

-Full completion of the project Valhalla for Java along with OpenJDK promises value types and primitive types. I have gathered that it is possible to set up mathematics with the big-math library so that every operation does not require the precision to be submitted along as well, but that can be managed from one place within scope before the beginning of mathematics. If Valhalla allows operator inclusion with its new primitive types and other new advantages, are the big-math project developers likely going to be persuaded to incorporated into big-math? Operators like +,-,, both modes of /, %, i++, i--, --i, ++i, +=, -=, =, /= both modes, %= ?

eobermuhlner commented 2 years ago

The big-math library is built on top of the standard Java BigDecimal and has the same memory limitations.

Yes - I would probably provide Valhalla operators as soon as they are available. Depending on the details of Valhalla I would consider providing them in a separate library.

PowerUser1234 commented 2 years ago

The way that the Java OpenJDK original BigInteger and Bigdecimal method arithmetic methods presently work, every time you want to do an arithmetic operation, you need to include the MathContext, containing precision, each time. Admittedly, it should be easy to create a Factory class to mask and once submit a MathContext object so that arithmetic methods could be called more easily.

Does your library include the ability to just create and submit the Mathcontent/precision just once, at the top of a codespace, inside a "Factory" class, to generate BigIntegers and BigDecimals from there, so that you don't have to submit two parameters for every arithmetic call every time?

eobermuhlner commented 1 year ago

Yes, there is a DefaultBigDecimalMath that does not need to pass a MathContext with every call. This class is used in the kotlin-big-math library: https://github.com/eobermuhlner/kotlin-big-math for the operators.

PowerUser1234 commented 1 year ago

Is there one of those for BigInteger as well?

eobermuhlner commented 1 year ago

BigInteger does not need this, since they do not use a MathContext to specify a precision.

On Tue, Nov 15, 2022 at 12:22 AM PowerUser1234 @.***> wrote:

Is there one of those for BigInteger as well?

— Reply to this email directly, view it on GitHub https://github.com/eobermuhlner/big-math/issues/60#issuecomment-1314539012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDEMP22ITUMETF777CFRLWILCU5ANCNFSM6AAAAAARF2OQRI . You are receiving this because you commented.Message ID: @.***>

PowerUser1234 commented 1 year ago

Why does the big-math library's BigInteger not need a MathContext? What does it use to specify the maximum number of figures?

eobermuhlner commented 1 year ago

The BigInteger operations always calculate the precision from the input arguments (roughly max of arguments precisions for add/subtract and the sum of argument precisions for multiplication).

BigDecimal operations optionally do the same thing. The add/subtract/mutliply methods exist in a variant without MathContext. Only for the divide operation the MathContext is very strongly recommended.

On Thu, Nov 17, 2022 at 6:12 AM PowerUser1234 @.***> wrote:

Why does the big-math library's BigInteger not need a MathContext? What does it use to specify the maximum number of figures?

— Reply to this email directly, view it on GitHub https://github.com/eobermuhlner/big-math/issues/60#issuecomment-1318087293, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDEMLIYZKHPYRRKC24PM3WIW5DNANCNFSM6AAAAAARF2OQRI . You are receiving this because you commented.Message ID: @.***>

eobermuhlner commented 1 year ago

Also just make it clear: BigDecimal and BigInteger and standard Java classes.

The big-math library adds basically only static methods for mathematical operations on BigDecimal (none for BigInteger).

Additionally it provides the classes

PowerUser1234 commented 1 year ago

If I wish to use the big-math library for OpenJDK Java, I need a High Precision Integer class, a Decimal class, and a Calculator class that may take either of the previous two, even after type conversion. What are the names of these 3 (three) classes?

eobermuhlner commented 1 year ago

I do not understand this question.

Who needs these 3 classes?

JDK does not have or need them (there is an Integer class - but I think you mean something else). big-math does not have or need them.

You can use big-math library with any standard OpenJDK >= 1.8 and you do not need any additional libraries or any additional classes.

On Sun, Nov 20, 2022 at 8:19 AM PowerUser1234 @.***> wrote:

If I wish to use the big-math library for OpenJDK Java, I need an Integer class, a Decimal class, and a Calculator class. What are the names of these 3 (three) classes?

— Reply to this email directly, view it on GitHub https://github.com/eobermuhlner/big-math/issues/60#issuecomment-1321058638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDEMJWQ5ZFH25L7OR3PY3WJHGHFANCNFSM6AAAAAARF2OQRI . You are receiving this because you commented.Message ID: @.***>

PowerUser1234 commented 1 year ago

I have not mentioned classes, I have mentioned types of Numbers. What classes does big-math have that corresponds to an integer number, decimal number, and a calculator class for these two types of numbers?

eobermuhlner commented 1 year ago

I still do not understand the question. big-math does not have its own number types or anything (with the exception of BigComplex which is a composition of 2 BigDecimal).

Did you read the big-math documentation and try a little hello world example ?

On Mon, Nov 21, 2022 at 8:54 AM PowerUser1234 @.***> wrote:

I have not mentioned classes, I have mentioned types of Numbers. What classes does big-math have that corresponds to an integer number, decimal number, and a calculator class for these two types of numbers?

— Reply to this email directly, view it on GitHub https://github.com/eobermuhlner/big-math/issues/60#issuecomment-1321604226, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDEMIH2ETXGX7R3YZAJDLWJMTE5ANCNFSM6AAAAAARF2OQRI . You are receiving this because you commented.Message ID: @.***>