Article View: borland.public.jbuilder.java.language
Article #18361What is a BigDecimal ?
From: OL
Date: Thu, 02 Jul 1998 00:00
Date: Thu, 02 Jul 1998 00:00
40 lines
1602 bytes
1602 bytes
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:
<359BA71E.5F3D2976@compuserve.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,f6a1b28a03366ef,start X-Google-Attributes: gidf74b3,public From: OL <100543.1646@compuserve.com> Subject: What is a BigDecimal ? Date: 1998/07/02 Message-ID: <359BA71E.5F3D2976@compuserve.com> X-Deja-AN: 368110076 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language