wood burning stoves*
The moose likes Beginning Java and the fly likes Float Double numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Float Double numbers" Watch "Float Double numbers" New topic
Author

Float Double numbers

cornel jew
Ranch Hand

Joined: Jul 13, 2002
Posts: 37
Hi all
Is there perhaps a way to get grip of the following :Float/Double MAX_MIN VALUES,POSITVE/NEGATIVE_INFINITY,NAN casting to int /float type etc, and using MATH methods on them.
It is very confusing remembering all the different results, i forgot sometimes what is what.
If anyone can perhaps explain the workings around it it will help, cos memorising this makes it difficult.
I have done a lot of mock questions, but hey i don't feel confident with it.
Thanks for any help.
Corn
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
cornel,
What do you mean exactly by "get grip"?
[ May 18, 2003: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
cornel jew
Ranch Hand

Joined: Jul 13, 2002
Posts: 37
Hi
Like doing arithmetic or casting operations for instance:
int i = (int)Float/Double.MIN/MAX_VALUE
float f = Float.NEGATIVE_INFINTY
int i = Math.round(f) etc.
Not to talk about using % / etc on them.
Maybe if i understand how double and float works i will understand.
I was doing a mock exam of Dan's operators and that was the type of questions which was asked.
Hope this will give you more info.
Thanks for the reply
Corn
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Honestly, I only have a vague idea of what you are talking about. I don't spend my time memorizing the Java API. If I need to use something, I look it up in the API docs. Eventually, I know some basics about several classes by using them over and over in actual programs. I honestly don't think an abstract description will be much help. You just have to use it in a program to see how it can be used
In this particular instance, I can't think of any meaningful examples where to use these constants from the Float and Double classes. I think all of them are often used for error checking, especially NAN and POSITIVE/NETAGIVE_INFINITY. Here is some pseudocode that can illustrate this:

I don't think I can be any more specific than that at the moment. Perhaps you should get a book, such as Core Java, that shows some examples of how to use such members of the API classes.


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Float Double numbers
 
Similar Threads
String / float Question
Wrapper class question from Danchisolm
How to use C++ created binary files
Primitive conversions
converting float to double