Questions tagged [apfloat]

Apfloat is a High Performance Arbitrary Precision Arithmetic Package for C++ and Java

Apfloat is a High Performance Arbitrary Precision Arithmetic Package for C++ and Java

12 questions
6
votes
2 answers

Error calculating pi using the Chudnovsky algorithm - Java

I have been trying to write a simple program to calculate pi using the Chudnovsky algorithm however I keep getting the wrong value output. The latest code i have written is below and outputs:…
Kingkaz
  • 63
  • 5
3
votes
1 answer

How to convert Apfloat to BigDecimal?

I am using the following code where k is a BigDecimal: Apfloat power = ApfloatMath.pow(new Apfloat(-1), new Apfloat(k)); Apfloat seems to have methods like intValue(), doubleValue(), floatValue() but I can't see how I can convert Apfloat to…
user2948708
  • 95
  • 1
  • 4
2
votes
0 answers

Apfloat Pi is returning null

I'm using the Apfloat library of version 1.8.3 During my computation i need to calculate value of pi with appropriate precision. At the moment i'm using ApfloatMath.pi method and the code looks like this object Problem461 extends App { val Pi =…
Odomontois
  • 14,820
  • 2
  • 34
  • 67
1
vote
0 answers

Arithmetic calculations in Apfloat arbitrary precision library for Android (Java) - low performance on weak devices

I'm working on a project in Android Studio (Java) which need to calculate arithmetic expressions with complex numbers while using arbitrary precision method (maximum accuracy). I'm using in Apfloat library (based on arbitrary precision) in my…
Ben
  • 71
  • 1
  • 7
1
vote
0 answers

Efficient way to divide many different terms and sum them up in java

I would like to know how to efficiently divide n terms and sum them up. I have 2 Arrays each containing large Decimal which is stored by an external Library called Apfloat: Apfloat[] nume=new Apfloat[n]; Apfloat[] deno==new Apfloat[n]; Using a…
Paul
  • 660
  • 7
  • 19
0
votes
1 answer

Apfloat calculating trigonometric function wrong result

I am C# developer and I have UWP app which can precisely calculate many math related problems using DecimalEx Nuget package. I recently started porting my app to Java and Android, and I use Apfloat as alternative (if there is better one please…
Krum Cvetkov
  • 63
  • 10
0
votes
1 answer

ApfloatMath.pow taking a lot of time

I have to find log and later after few computations antilog of many big decimal numbers. Since log and antilog are not supported for BigDecimal numbers, for this I used Apfloat library and use its pow method which can take both arguments as Apfloat…
0
votes
1 answer

ApfloatMath.pow method returns almost the correct value

Here is a sample code: ApfloatMath.pow(new Apfloat(25, 5), new Apfloat(0.5, 5)); The above code performs the square root of 25. This returns 4.9999. I would've thought that this being arbitrary would return the correct value.
Dan Joe
  • 17
  • 1
  • 3
0
votes
1 answer

Rounding at specific precision with ApFloat

ApFloat http://www.apfloat.org/ is a C/C++/Java math library that can calculate many trascendental operations such as square roots, exponentiations, logarithms, trigonometric/hyperbolic functions, numeric value of π, etc. with numbers of arbitrary…
0
votes
2 answers

Understanding Apfloat and its precision

I'm using an application which uses mm and inches to draw scaled drawings. I need to convert from one to another without losing precision. I'm struggling with accuracy and have turned to the Apfloat package. Can someone explain... if I start with…
cworner1
  • 443
  • 4
  • 13
0
votes
1 answer

Is possible to use apfloat library in android applications?

I am working on android app. (eclipse kepler) in which i want to use 3rd party library Apfloat. I have configured build path and references for external library (30 times), restarted, cleaned, rebuilded every time, imported org.apfloat.Apfloat;,…
Martin877
  • 233
  • 1
  • 7
0
votes
1 answer

How to use ApfloatMath.round()?

In this snippet I expected "2" as the result? Apfloat f = new Apfloat("1.5", 50); f = ApfloatMath.round(f, 15, RoundingMode.HALF_UP); System.out.println(f.toString()); Or should ApfloatMath.round() be used differently?
axelclk
  • 951
  • 8
  • 23