Re: Sheck this simple programm

From: Joona I Palaste (palaste_at_cc.helsinki.fi)
Date: 07/14/04


Date: 14 Jul 2004 09:21:42 GMT

Fahd Shariff <fahdshariff@yahoo.com> scribbled the following:
> one possible solution: System.out.println(((double)10/(double)13));

It's enough to cast *one* of the operands to double. But take care not
to do this:
System.out.println((double)(10/13));
This will still output 0, as 10/13 is 0, and no casting into anything
will change it.

-- 
/-- Joona Palaste (palaste@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Hasta la Vista, Abie!"
   - Bart Simpson


Relevant Pages

  • Re: Does Schrumpf Harass Children Too?
    ... I don't care about other fanbases. ... administration/booster situation was poorly handled and cast a ... negative light on the program, our history of idiotic fan actions ...
    (rec.sport.football.college)
  • Re: Where the black people?
    ... >> The cast is all white folks. ... >> Wouldn't it be interesting to see some hispanics of central american ... WHO CARES whether or not somebody's racial quotas ... I just don't care one way or the other ...
    (alt.tv.survivor)
  • Re: What is wrong with this transformation?
    ... derived column transformation. ... Something about casting operands... ... input column or the result of a cast, and cannot be used with the ...
    (microsoft.public.sqlserver.dts)
  • Re: Where the black people?
    ... > The cast is all white folks. ... > Wouldn't it be interesting to see some hispanics of central american ... WHO CARES whether or not somebody's racial quotas ... I just don't care one way or the other ...
    (alt.tv.survivor)
  • Re: First Program
    ... double compute_mean(int *arr, int arr_length) ... this is one of the few cases where a cast is justified. ... operator takes two operands of the *same* numeric type, ... I might cast both operands: ...
    (comp.lang.c)