Re: floats, doubles and maths
Patricia Shanahan <pats@xxxxxxx> writes:
Unless you have a REALLY good reason to do something different, the best
choice for financial calculations that need two decimal place rounding
is java.math.BigDecimal, with scale factor 2.
Somewhat faster would be a long with an implicit scaling of 100, but
then you need to keep in mind conversion to user-presented doubles
using division by and multiplication with 100.0.
.
Relevant Pages
- Re: IBM System z9
... It directly implements the varieties of rounding specified in ... |> IBM programmers have used BCD fixed-point for the past 40 years. ... For financial calculations. ... because there is no way to get overflow detection right ... (comp.arch) - Re: OT: Determining the size of plotting area
... rounding has come up here more than once, ... I don't recall the routines as being much more than half a dozen ... (Sometimes one wants to force zero to be ... included in the scale; other times one doesn't). ... (comp.lang.fortran) - Re: Fastcode RoundTo
... > Solerman, If you do financial calculations, then I would be ... > careful to start with a good specification and then design ... with rounding in a small set (some with 10, 15 passes on a set of up to ... (borland.public.delphi.language.basm) - Re: Get Mantissa and exponent from double?
... Patricia Shanahan wrote: ... The scale will be the smallest scale that ... he could repeatedly movePointRight by one or movePointLeft by one ... home dot woh dot rr dot com slash jbmatthews ... (comp.lang.java.help) - Re: "scale" numbers?
... Is there some procedure to "scale" all the numbers to lie in the range ... let v' be the scaled vector into, and v" be an intermediate ... Depending on the application, you may want floor, ceiling, rounding, ... if you use the integer portion instead (which is the same as the ... (sci.math) |
|