AW: Java and double

2001-11-15 Thread Ralph Einfeldt

That won't change anything, as the Math class uses 
the normal primitive datatypes.
This is a 'problem' of representing numbers in double 
and float.

 -Ursprüngliche Nachricht-
 Von: Mangi, Rick [mailto:[EMAIL PROTECTED]]
 Gesendet: Mittwoch, 14. November 2001 17:47
 An: 'Tomcat Users List'
 Betreff: RE: Java and double
 
 
 Ya, I've seen that one before. use the java.math package. 
 
 -Original Message-
 From: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 14, 2001 10:39 AM
 To: [EMAIL PROTECTED]
 Subject: Java and double
 
 
 Hi,
 
 Excuse me... this mail shouldnot be on this mailing list but
 it is an hurry.
 
 public class TestDouble
 {
   static public void main(String args[]) {
 
 double val = 0.5055 * 1000 ;
 System.out.println( val );
   }
 }
 
 This program gives me the following results :
 505.44
 
 I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.
 
 Have u got informations about this ?
 Can u try too ?
 
 Thanks a lot and sorry again
 
 Bye
 
 Michenaud Laurent
 - Adeuza -
 [ Développeur Web - Administrateur Réseau ]
 
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 
 
 This email and any attachments are confidential and may be 
 legally privileged. No confidentiality or privilege is waived 
 or lost by any transmission in error.  If you are not the 
 intended recipient you are hereby notified that any use, 
 printing, copying or disclosure is strictly prohibited.  
 Please delete this email and any attachments, without 
 printing, copying, forwarding or saving them and notify the 
 sender immediately by reply e-mail.  Zurich Capital Markets 
 and its affiliates reserve the right to monitor all e-mail 
 communications through its networks.  Unless otherwise 
 stated, any pricing information in this e-mail is indicative 
 only, is subject to change and does not constitute an offer 
 to enter into any transaction at such price and any terms in 
 relation to any proposed transaction are indicative only and 
 subject to express final confirmation.
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 
 
 

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Java and double

2001-11-14 Thread Laurent Michenaud

Hi,

Excuse me... this mail shouldnot be on this mailing list but
it is an hurry.

public class TestDouble
{
  static public void main(String args[]) {

double val = 0.5055 * 1000 ;
System.out.println( val );
  }
}

This program gives me the following results :
505.44

I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.

Have u got informations about this ?
Can u try too ?

Thanks a lot and sorry again

Bye

Michenaud Laurent
- Adeuza -
[ Développeur Web - Administrateur Réseau ]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Java and double

2001-11-14 Thread Jim Rueschhoff

There is no problem.  Float and Double represents a number as a mantissa and
radix which produces a close but not exact representation of a number.  If
you round to a reasonable number of decimal places you will get the
correct result but if you insist on looking at the full precision of the
number you will get round off errors.  This is the very nature of floating
point numbers.



-Original Message-
From: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 8:39 AM
To: [EMAIL PROTECTED]
Subject: Java and double


Hi,

Excuse me... this mail shouldnot be on this mailing list but
it is an hurry.

public class TestDouble
{
  static public void main(String args[]) {

double val = 0.5055 * 1000 ;
System.out.println( val );
  }
}

This program gives me the following results :
505.44

I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.

Have u got informations about this ?
Can u try too ?

Thanks a lot and sorry again

Bye

Michenaud Laurent
- Adeuza -
[ Développeur Web - Administrateur Réseau ]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Java and double

2001-11-14 Thread Mangi, Rick

Ya, I've seen that one before. use the java.math package. 

-Original Message-
From: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:39 AM
To: [EMAIL PROTECTED]
Subject: Java and double


Hi,

Excuse me... this mail shouldnot be on this mailing list but
it is an hurry.

public class TestDouble
{
  static public void main(String args[]) {

double val = 0.5055 * 1000 ;
System.out.println( val );
  }
}

This program gives me the following results :
505.44

I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.

Have u got informations about this ?
Can u try too ?

Thanks a lot and sorry again

Bye

Michenaud Laurent
- Adeuza -
[ Développeur Web - Administrateur Réseau ]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]


This email and any attachments are confidential and may be 
legally privileged. No confidentiality or privilege is waived 
or lost by any transmission in error.  If you are not the 
intended recipient you are hereby notified that any use, 
printing, copying or disclosure is strictly prohibited.  
Please delete this email and any attachments, without 
printing, copying, forwarding or saving them and notify the 
sender immediately by reply e-mail.  Zurich Capital Markets 
and its affiliates reserve the right to monitor all e-mail 
communications through its networks.  Unless otherwise 
stated, any pricing information in this e-mail is indicative 
only, is subject to change and does not constitute an offer 
to enter into any transaction at such price and any terms in 
relation to any proposed transaction are indicative only and 
subject to express final confirmation.

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




AW: Java and double

2001-11-14 Thread Ralph Einfeldt

As in most other programming languages float 
and double are implemented in way that numbers 
are not represented exactly. That's caused by 
the internal format which is used to store
floats and doubles.

If you want know more of the basics have a look at
http://cch.loria.fr/documentation/IEEE754/ACM/goldberg.pdf

If you want more accuracy you can use
java.math.BigDecimal.

 -Ursprüngliche Nachricht-
 Von: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
 Gesendet: Mittwoch, 14. November 2001 16:39
 An: [EMAIL PROTECTED]
 Betreff: Java and double
 
 
 Hi,
 
 Excuse me... this mail shouldnot be on this mailing list but
 it is an hurry.
 
 public class TestDouble
 {
   static public void main(String args[]) {
 
 double val = 0.5055 * 1000 ;
 System.out.println( val );
   }
 }
 
 This program gives me the following results :
 505.44
 
 I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.
 
 Have u got informations about this ?
 Can u try too ?
 
 Thanks a lot and sorry again
 
 Bye
 
 Michenaud Laurent
 - Adeuza -
 [ Développeur Web - Administrateur Réseau ]
 
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 
 
 

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Java and double

2001-11-14 Thread Slava

Try to use BigDecimal.
It should be OK. 
--- Mangi, Rick [EMAIL PROTECTED] wrote:
 Ya, I've seen that one before. use the java.math package. 
 
 -Original Message-
 From: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 14, 2001 10:39 AM
 To: [EMAIL PROTECTED]
 Subject: Java and double
 
 
 Hi,
 
 Excuse me... this mail shouldnot be on this mailing list but
 it is an hurry.
 
 public class TestDouble
 {
   static public void main(String args[]) {
 
 double val = 0.5055 * 1000 ;
 System.out.println( val );
   }
 }
 
 This program gives me the following results :
 505.44
 
 I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.
 
 Have u got informations about this ?
 Can u try too ?
 
 Thanks a lot and sorry again
 
 Bye
 
 Michenaud Laurent
 - Adeuza -
 [ Développeur Web - Administrateur Réseau ]
 
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 
 
 This email and any attachments are confidential and may be 
 legally privileged. No confidentiality or privilege is waived 
 or lost by any transmission in error.  If you are not the 
 intended recipient you are hereby notified that any use, 
 printing, copying or disclosure is strictly prohibited.  
 Please delete this email and any attachments, without 
 printing, copying, forwarding or saving them and notify the 
 sender immediately by reply e-mail.  Zurich Capital Markets 
 and its affiliates reserve the right to monitor all e-mail 
 communications through its networks.  Unless otherwise 
 stated, any pricing information in this e-mail is indicative 
 only, is subject to change and does not constitute an offer 
 to enter into any transaction at such price and any terms in 
 relation to any proposed transaction are indicative only and 
 subject to express final confirmation.
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 


__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Java and double

2001-11-14 Thread Micael Padraig Og mac Grene

Not sure what your point is.  The code is okay, check out the internal
math yourself.  You can do it by hand.  If you want more precision, use
different code.

-Original Message-
From: Mangi, Rick [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Date: Wednesday, November 14, 2001 8:44 AM
Subject: RE: Java and double


Ya, I've seen that one before. use the java.math package.

-Original Message-
From: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:39 AM
To: [EMAIL PROTECTED]
Subject: Java and double


Hi,

Excuse me... this mail shouldnot be on this mailing list but
it is an hurry.

public class TestDouble
{
  static public void main(String args[]) {

double val = 0.5055 * 1000 ;
System.out.println( val );
  }
}

This program gives me the following results :
505.44

I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.

Have u got informations about this ?
Can u try too ?

Thanks a lot and sorry again

Bye

Michenaud Laurent
- Adeuza -
[ Développeur Web - Administrateur Réseau ]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]


This email and any attachments are confidential and may be
legally privileged. No confidentiality or privilege is waived
or lost by any transmission in error.  If you are not the
intended recipient you are hereby notified that any use,
printing, copying or disclosure is strictly prohibited.
Please delete this email and any attachments, without
printing, copying, forwarding or saving them and notify the
sender immediately by reply e-mail.  Zurich Capital Markets
and its affiliates reserve the right to monitor all e-mail
communications through its networks.  Unless otherwise
stated, any pricing information in this e-mail is indicative
only, is subject to change and does not constitute an offer
to enter into any transaction at such price and any terms in
relation to any proposed transaction are indicative only and
subject to express final confirmation.

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Java and double

2001-11-14 Thread phillipmastroianni

try putting a 1000d (I think you have to tell the vm that this is a 
double value or it may try an compute a float!

- Original Message -
From: Micael Padraig Og mac Grene [EMAIL PROTECTED]
Date: Wednesday, November 14, 2001 9:41 am
Subject: Re: Java and double

 Not sure what your point is.  The code is okay, check out the 
 internalmath yourself.  You can do it by hand.  If you want more 
 precision, use
 different code.
 
 -Original Message-
 From: Mangi, Rick [EMAIL PROTECTED]
 To: 'Tomcat Users List' [EMAIL PROTECTED]
 Date: Wednesday, November 14, 2001 8:44 AM
 Subject: RE: Java and double
 
 
 Ya, I've seen that one before. use the java.math package.
 
 -Original Message-
 From: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 14, 2001 10:39 AM
 To: [EMAIL PROTECTED]
 Subject: Java and double
 
 
 Hi,
 
 Excuse me... this mail shouldnot be on this mailing list but
 it is an hurry.
 
 public class TestDouble
 {
   static public void main(String args[]) {
 
 double val = 0.5055 * 1000 ;
 System.out.println( val );
   }
 }
 
 This program gives me the following results :
 505.44
 
 I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.
 
 Have u got informations about this ?
 Can u try too ?
 
 Thanks a lot and sorry again
 
 Bye
 
 Michenaud Laurent
 - Adeuza -
 [ Développeur Web - Administrateur Réseau ]
 
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 
 
 This email and any attachments are confidential and may be
 legally privileged. No confidentiality or privilege is waived
 or lost by any transmission in error.  If you are not the
 intended recipient you are hereby notified that any use,
 printing, copying or disclosure is strictly prohibited.
 Please delete this email and any attachments, without
 printing, copying, forwarding or saving them and notify the
 sender immediately by reply e-mail.  Zurich Capital Markets
 and its affiliates reserve the right to monitor all e-mail
 communications through its networks.  Unless otherwise
 stated, any pricing information in this e-mail is indicative
 only, is subject to change and does not constitute an offer
 to enter into any transaction at such price and any terms in
 relation to any proposed transaction are indicative only and
 subject to express final confirmation.
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 
 
 
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




AW: Java and double

2001-11-14 Thread Ralph Einfeldt

That changes nothing. 

If the left side of an assignment is double, 
all numbers to the right are automagically 
double. Such helpers are just needed if the
left side has a lower precision than double 
(float, int, short, byte)

The only ways to get more precise results:
- use BigDecimal.
- round the number to the number of digits 
  you are interested in.
- use an extenal Library which higher precision 
  If there is any, I had no need for so didn't 
  care to search one.

 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Gesendet: Mittwoch, 14. November 2001 20:36
 An: Tomcat Users List
 Betreff: Re: Java and double
 
 
 try putting a 1000d (I think you have to tell the vm that this is a 
 double value or it may try an compute a float!
 
 - Original Message -
 From: Micael Padraig Og mac Grene [EMAIL PROTECTED]
 Date: Wednesday, November 14, 2001 9:41 am
 Subject: Re: Java and double
 
  Not sure what your point is.  The code is okay, check out the 
  internalmath yourself.  You can do it by hand.  If you want more 
  precision, use
  different code.
  
  -Original Message-
  From: Mangi, Rick [EMAIL PROTECTED]
  To: 'Tomcat Users List' [EMAIL PROTECTED]
  Date: Wednesday, November 14, 2001 8:44 AM
  Subject: RE: Java and double
  
  
  Ya, I've seen that one before. use the java.math package.
  
  -Original Message-
  From: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, November 14, 2001 10:39 AM
  To: [EMAIL PROTECTED]
  Subject: Java and double
  
  
  Hi,
  
  Excuse me... this mail shouldnot be on this mailing list but
  it is an hurry.
  
  public class TestDouble
  {
static public void main(String args[]) {
  
  double val = 0.5055 * 1000 ;
  System.out.println( val );
}
  }
  
  This program gives me the following results :
  505.44
  
  I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.
  
  Have u got informations about this ?
  Can u try too ?
  
  Thanks a lot and sorry again
  
  Bye
  
  Michenaud Laurent
  - Adeuza -
  [ Développeur Web - Administrateur Réseau ]
  
  
  --
  To unsubscribe:   
 mailto:[EMAIL PROTECTED]
  For additional commands: 
 mailto:[EMAIL PROTECTED]
  Troubles with the list: 
 mailto:[EMAIL PROTECTED]
  
  
  This email and any attachments are confidential and may be
  legally privileged. No confidentiality or privilege is waived
  or lost by any transmission in error.  If you are not the
  intended recipient you are hereby notified that any use,
  printing, copying or disclosure is strictly prohibited.
  Please delete this email and any attachments, without
  printing, copying, forwarding or saving them and notify the
  sender immediately by reply e-mail.  Zurich Capital Markets
  and its affiliates reserve the right to monitor all e-mail
  communications through its networks.  Unless otherwise
  stated, any pricing information in this e-mail is indicative
  only, is subject to change and does not constitute an offer
  to enter into any transaction at such price and any terms in
  relation to any proposed transaction are indicative only and
  subject to express final confirmation.
  
  --
  To unsubscribe:   
 mailto:[EMAIL PROTECTED]
  For additional commands: 
 mailto:[EMAIL PROTECTED]
  Troubles with the list: 
 mailto:[EMAIL PROTECTED]
  
  
  
  
  --
  To unsubscribe:   
 mailto:[EMAIL PROTECTED]
  For additional commands: 
 mailto:[EMAIL PROTECTED]
  Troubles with the list: 
 mailto:[EMAIL PROTECTED]
  
  
 
 
 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]
 
 
 

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]