Fixed point arithmetic is done using a set number of decimal places. It can be faster and is more precise than floating-point.
3
votes
2answers
47 views
Cut float numbers in a stream (putchar, getchar) and in a string
For example, the following row:
"a+12.3456-b-0.456789+1.3-45678"
will be transformed into
"a+12.34-b-0.45+1.3-45678"
That is, we need to cut out the figures after the point from the third figure. ...
3
votes
3answers
188 views
4
votes
1answer
71 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 ...
12
votes
3answers
2k views
0
votes
1answer
135 views
Round division to two decimal places [closed]
I'm working on a revision of my electrical calculator. I used string formatting to round the answers it gives to two decimal places. On the operations that require multiplication (voltage, wattage), ...
5
votes
2answers
305 views
BigDecimal made Simple
Here is my take on (lighter version of) Java's BigDecimal.
Originally I wrote this as a replacement for BigDecimal in order to improve performance during serialisation and data manipulation.
...
4
votes
1answer
256 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 ...
7
votes
1answer
294 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 ...
7
votes
2answers
115 views