Returns the integer part of a real number
Hello,
I need to know an integer value as part of a real number, like this:
double a = 0;
double x = 0;
x = 1500.00;
a = (x / 1000);
now "a" must be equal to 1.
Pascal has a function INT (a = INT(x/1000)), and what about java ?
Thanks for help,
guido
> Hello,
> I need to know an integer value as part of a real
> number, like this:
> double a = 0;
> double x = 0;
>x = 1500.00;
> a = (x / 1000);
> now "a" must be equal to 1.
> Pascal has a function INT (a = INT(x/1000)), and what
> about java ?
It is almost the same thing.
double d = 1.5;
int i = (int) d;
OK, I don't feel offended.It's my first post, because when I have a problem, I read documentation.Simply it didn't come to my mind...guido
> It's my first post, because when I have a problem, I> read documentation.My sincerest and warmest congratulations on knowing how to do your job. Judging by 99.5% of the remainder of the posters here, you are member of a very small elite.
ejpa at 2007-7-12 3:01:35 >
