Hi,

I am developing an application that requires very large numbers, so I am

using BigDecimal.

I wanted to use atan, and saw that there was a bigdecimal/math, which

allows

you to use an atan that supports BigDecimal. However it seems faulty. It

says you cannot pass a value for x that is greater than 1 or less than

-1.

As far as I know, there is no such limit for the arctan. Also there is

no

asin or acos.

Are there any alternatives that support a bit more in terms of trig

functions?

Also, I wanted to ask whether there was any practical limit to the

precision

of a BigDecimal number? I’m looking at numbers in orders of magnitude

between about 15-25 at most.

Thanks,

Brandon

Brandon O. wrote:

I am developing an application that requires very large numbers, so I am

using BigDecimal.

Floats can handle pretty large numbers, too:

irb(main):009:0> 2.0 ** 1000

=> 1.07150860718627e+301

It’s more a question of how much precision you need.

On 2009-12-16, Brian C. wrote:

Brandon O. wrote:

I am developing an application that requires very large numbers, so

I am using BigDecimal.

Floats can handle pretty large numbers, too:

irb(main):009:0> 2.0 ** 1000

=> 1.07150860718627e+301

It’s more a question of how much precision you need.

Agreed, but these numbers will be used in calculations, so I feel a bit

more comfortable with BigDecimal.

The precision I need varies. It’ll use a lot of trig, and those should

be as exact as possible.

Brandon

Brandon O. [email protected] wrote:

says you cannot pass a value for x that is greater than 1 or less than -1.

As far as I know, there is no such limit for the arctan. Also there is no

Hi Brandon,

[-1,1] is basically all you need, since

arctan(x) = sgn(x) * Pi/2 - arctan(1/x)

Flo

Florian W. wrote:

arctan(x) = sgn(x) * Pi/2 - arctan(1/x)

Flo

sure, but this is just a feature special to arctan. It might be used for

implementation, but should not limit the set input values (i.e. its

interface)

regards

ralf