Article View: borland.public.jbuilder.java.language
Article #18369Re: What is a BigDecimal ?
From: Clint Brewer
Date: Fri, 03 Jul 1998 00:00
Date: Fri, 03 Jul 1998 00:00
53 lines
2067 bytes
2067 bytes
In addition to Rich's comments, Big Decimal is intended mainly for use when you need an arbitrarily large number. Say for scientific software that needs to be really accurate or for calculating very large prime numbers for encryption, dealling with astronomical data, etc. That's where big deimal shines. -Clint Brewer OL wrote: > Hello; > > I am developing some business classes. > > It was suggested to me to use the BigDecimal type to map a NUMERIC, > DECIMAL, MONEY or SMALLMONEY database type. > > I am having the following problem when using BigDecimal : > > 1. It does not seem very feasible to use common operators like '/' or > '-' when using BigDecimal. > > Exemple: > "montTvaLigne = montTvaLigne + ( montLig * ( 1 + ( tauxTva / 100)));" > generates the following error message in JBuilder 2 : > "Error 103 : method / (java.math.BigDecimal, int) not found in class > Client." > > The same exact line works fine if I change my type declaration from > BigDecimal to double. > > 2. A simple affectation like : > "cli_id = 1.0000;" > causes > "Error: (63) incompatible types; found: double, required: > java.math.BigDecimal" > but > "cli_id = new BigDecimal(1);" works. > > So, to me BigDecimal doesn't appear to be very user-friendly. > > What is it intendeed for ? > Do you use it as a solid alternative to double as was suggested to me ? > > Thanks for any clarification; > > Olivier. > Simple language question may be.
Technical Details
Message-ID:
<359CB9F4.9DE8653A@borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<359BA71E.5F3D2976@compuserve.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,f6a1b28a03366ef X-Google-Attributes: gidf74b3,public From: Clint Brewer <supportinfo@borland.com> Subject: Re: What is a BigDecimal ? Date: 1998/07/03 Message-ID: <359CB9F4.9DE8653A@borland.com> X-Deja-AN: 368229407 Content-Transfer-Encoding: 7bit References: <359BA71E.5F3D2976@compuserve.com> Content-Type: text/plain; charset=us-ascii Organization: Borland International Developer Support Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language