Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Simple Java question

Name: Anonymous 2007-09-13 19:00 ID:apP5YkPr

I just started looking into Java programing and I have read some online things about it.
I decided to fiddle around with some programs just multiplying basic numbers. I have set up a float variable for 0.182, when I try to compile I get a "Possible loss or precision" error. What does this mean?
Also my code
class Mutiply {
    public static void main(String[] arguments) {
        float number1 = 5;
        float number2 = 0.182;
        float result = number1 * number2;
        System.out.println(number1 + " Times " + number2);
        System.out.println("\nResult");
     }
}

Name: Anonymous 2007-09-13 19:03 ID:PqsVGkrt

Read this short book, it'll answer all your questions:
http://mitpress.mit.edu/sicp/full-text/book/book.html

Name: Anonymous 2007-09-13 19:03 ID:GOERnICG

Learn the difference between float and double etc

Name: Anonymous 2007-09-13 19:19 ID:Heaven

Thanks for not answering my question and rather giving me something that I can learn from. Really its a good thing, better to learn by myself. Thanks again.

Name: Anonymous 2007-09-13 19:32 ID:PqsVGkrt

>>4
You are welcome, I'm very glad I could be helpful. I wish you luck in your endeavours.

Name: Anonymous 2007-09-13 19:49 ID:EUpZsIXs

A man goes into a library and asks for a book on suicide.

The librarian says; "Fuck off, you won't bring it back."

Name: Anonymous 2007-09-13 20:00 ID:q5Bkx51T

Put an f after the number.

float fl = 3.1415926f;

Name: Anonymous 2007-09-13 20:13 ID:egj1b0JG



class Mutiply {
    public static void main(String[] args) {
        float number1 = 5;
        float number2 = 0.182;
        float result = number1 * number2;
        System.out.printf("%f times %f, number1 , number2);
        System.out.printf("\n %f" , result);
     }
}

Name: Anonymous 2009-03-06 8:10

Some pretty ugly shit   only lusers who   just discovered HTML   use and are   afraid that you   hacked one of   the best threads   of this year   instead of using   C for that   With current browser.

Name: Anonymous 2009-08-03 9:11

story make a talked. me I I to I around method   dumped. pointer is / 24 24 | the might Montreal, to to   (Kingston,   is Linear time are Cubic 3+1+1+2+4=11 adds of also 3+1+1+2+4=11 know, work. to work. to do tried init() method my

Name: Anonymous 2010-12-17 1:19

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2011-02-03 3:58

Don't change these.
Name: Email:
Entire Thread Thread List