Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Why float variables subtraction is showing wrong value as -0.00?

By
vadivel
on 12/23/15, 2:55 AM 408 views

Hi friends,

I'm facing a problem on float subtraction.When subtracting value of 10000.00 from 10000.00 we supposed to get 0, but here in openerp i get a balance value of

-1.81898940355e-12 when displaying balance using below code:

bal+=j_line.debit-j_line.credit

here, i have used a line of code for setting up 2 digits after decimal(like 123.00), i have given a line of code which i used to display:

lin_bal=bal if bal!=0.00 else 0.00 

lin_deci_bal= "%0.2f" % lin_bal

it displays output as -0.00,instead i need output as 0.00

So please suggest some solution to resolve this problem. I have taken lot of time working on this issues. Kindly help me solve this.Thanks in advance.
 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/23/15, 2:55 AM
Seen: 408 times
Last updated: 12/23/15, 2:55 AM