Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 ...
Mark Vincze's user avatar
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 ...
Sam Orozco's user avatar
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 ...
Alex's user avatar
  • 353
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. ...
Shadow's user avatar
  • 643
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 ...
Elephants on Parade's user avatar
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 ...
Germann Arlington's user avatar
13 votes
3 answers
6k views

Is this a good isNaN method?

...
enon's user avatar
  • 387
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 ...
Germann Arlington's user avatar
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-...
Brian J. Fink's user avatar
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 ...
Brian J. Fink's user avatar