# Thread: variable double problem

1. Member
Join Date
Mar 2009
Posts
2
Rep Power
0

## variable double problem

I have some variable double example: 123123123,123123123, how to get a double 0,123123123....
Thanks....

2. Senior Member
Join Date
Jun 2008
Posts
2,366
Rep Power
7
Um
Java Code:
`double a = 0.123123123;`
maybe?

Maybe you could try to explain, a little better, what it is you really mean, and/or really want, or what it is you are actually trying to achieve.

If what you mean is that you want only the "decimal" portion of your double do
Java Code:
```double a = 123123,123123;
a = a - (int) a;```
Last edited by masijade; 03-01-2009 at 09:53 PM.

3. Member
Join Date
Mar 2009
Posts
2
Rep Power
0
code:
private voidjButton1ActionPerformed(java.awt.event.ActionE vent evt) {
double d;
double d1;
double d2;

d = Long.parseLong(jTextField1.getText());
d1 = d * 100 /97;
jTextField2.setText(String.valueOf(d1));
}

double d is insert by user and is 233123123123 , next
d1 = 240333116621,6494845360824742268
Now I must convert any variable d1 to d2 and catch d2 to look
d2 = 0,6494845360824742268 ..... for example ....
Sory for confusion......

4. Senior Member
Join Date
Jun 2008
Posts
2,366
Rep Power
7
Okay? So does the above work? Because I still don't know exactly what it is you need.

5. Senior Member
Join Date
Jan 2009
Posts
671
Rep Power
5
Java Code:
`d2 = d1 - ((long) d1);`
If the integer portion of d1 can exceed the size of a long, use BigInteger instead.

6. Senior Member
Join Date
Jun 2008
Posts
2,366
Rep Power
7
Ach, yeah, duh, long.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•