how to get decimals when divide two numbers

One Star

how to get decimals when divide two numbers

can anyone give me a tip how to get decimals when divide two numbers?
output is Double
I get the output 0.0
How do i get 0.1???
output_row.price =1.0/10
Moderator

Re: how to get decimals when divide two numbers

Hi,
If I understand you well, do you want to convert Double to Decimal after the divide operation?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: how to get decimals when divide two numbers

can anyone give me a tip how to get decimals when divide two numbers?
output is Double
I get the output 0.0
How do i get 0.1???
output_row.price =1.0/10

Is this the real expression? You should not have an issue if your output row is defined as double.
You could try 1.0d/10d
But this expression looks okay to me
Your result suggests that you're getting and integer division that is then converted to a double
One Star

Re: how to get decimals when divide two numbers

Thanks!
A mixture between both worked:
new java.math.BigDecimal((double)(TalendDate.diffDate(rowHoved.TrombolyseStarttid,rowHoved.Innleggelsestidspunkt,"ss"))/3600d)
Moderator

Re: how to get decimals when divide two numbers

Hi,
Thanks for your feedback.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.