Personal tools
You are here: Home Forum Use use of formula in Notebook: WARNING!

use of formula in Notebook: WARNING!

Up to Use

use of formula in Notebook: WARNING!

Posted by pierre_j at August 24. 2012

Hi,

I would like to report what could be stated as a bug, even if it is not really.

However, this can lead to wrong results without the user noticing it: it is really frustrating (I really prefer a bug that crashes the application, than a bug like this one).

I believe this is caused by python: using an integer in a division will return an integer.

Basically, I had in the notebook:

notebook.set("Width", 1)
notebook.set("Translation_Y", "-Width/2")

instead of 

notebook.set("Width", 1.0)
notebook.set("Translation_Y", "-Width/2")

As a result, the use of "Translation_Y" leads to a translation of -1 instead of -0.5.

Maybe nothing can be done against this behaviour, but when handling very large structures, such a difference in translation may goes unoticed, while being not what is expected by the user.

At least, maybe an alarm should be emitted when integers are used in division in Salome Notebook.

Bests,

Pierre

Re: use of formula in Notebook: WARNING!

Posted by pierre_j at August 24. 2012

Or maybe, all numbers should be turned into real.

Bests,

Pierre

Re: use of formula in Notebook: WARNING!

Posted by pierre_j at August 24. 2012

PS: using Salome 6.5.0

Re: use of formula in Notebook: WARNING!

Posted by pierre_j at August 24. 2012

Hi,

Sorry to come back again.

Actually, A 2nd bug should be mentionned (an important one this time):

In the notebook, an integer that is entered as a real (for instance 1.0 instead of 1) is dumped in python as an integer (1).

Thus, replaying the script will turned to wrong results if this variable is used in formula.

Bests,

Pierre

Powered by Ploneboard
Document Actions