All Questions
Tagged with fixed-point java
10 questions
4
votes
0
answers
819
views
Java code to convert BigDecimal to/from .NET decimal
Background
In many languages we have built-in data types for representing decimal floating point numbers. In .NET that's decimal, and in Java we have ...
3
votes
3
answers
356
views
Java number formatting in accountant style
I have written a string number formatter. I would like to know if this can be improved and any suggestions with how it's done.
The purpose of this function is to convert a double that has been ...
3
votes
2
answers
933
views
BigDecimal wrapper that ignores zero operands
I want to perform mathematical operations on a range of values, where zeros should be ignored. This means that multiplication by zero does not result in zero but returns the first operand and likewise ...
3
votes
2
answers
1k
views
Decimal expansion of a rational number
I wrote a program that does division and either does or doesn't show repeating groups. After designing it the first time I had to redesign it because although it worked it was unnecessarily complex. ...
5
votes
2
answers
2k
views
Java helper function to round a number to the specified number of decimal places
The function I need:
Rounds a double to the specified number of decimal places
I figured this would be a part of java.lang.math, but inexplicably it doesn't have ...
4
votes
1
answer
162
views
BigDecimal made Simple - take 2
Following all comments on my original post:
BigDecimal made simple
The following interface was derived from functionality provided by (mainly) Bigdecimal and is ...
13
votes
3
answers
6k
views
7
votes
2
answers
2k
views
BigDecimal made simple
Here is my take on (a lighter version of) Java's BigDecimal. I originally wrote this as a replacement for BigDecimal in order to ...
4
votes
1
answer
1k
views
Followup: How do I optimize this Java cube root function for BigInteger?
Followup to How do I optimize this Java cube root function for BigInteger?
So I've tried several implementations of this algorithm. The version using only BigInteger sometimes results in a never-...
7
votes
1
answer
3k
views
How do I optimize this Java cube root function for BigInteger?
I find that this function is one of the biggest causes of slow program execution. I can write a square root version with BigInteger only, but with the cube root, the algorithm sometimes gets caught in ...