View Issue Details

IDProjectCategoryView StatusLast Update
0002099FreeCADBugpublic2015-06-18 08:56
ReporterFreeCadder Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.15 
Fixed in Version0.16 
Summary0002099: Spreadsheet: Subtraction and Power Expression Parsing
DescriptionThe spreadsheet parser has problems with binary subtraction (5-4 gives #ERR) and the power function (wrong value).

Workarounds are to use addition with unary minus (5 + -4) and additional parentheses (), see code below.

However, when the document is saved and opened again, the workarounds are lost.
Steps To ReproduceApp.newDocument("Unnamed")
App.setActiveDocument("Unnamed")
App.ActiveDocument=App.getDocument("Unnamed")
Gui.ActiveDocument=Gui.getDocument("Unnamed")

App.activeDocument().addObject('Spreadsheet::Sheet','Spreadsheet')
App.ActiveDocument.Spreadsheet.set('A1', 'Problem')
App.ActiveDocument.Spreadsheet.setPosition('A2')
App.ActiveDocument.Spreadsheet.set('B1', 'Workaround')
App.ActiveDocument.Spreadsheet.setPosition('B2')
App.ActiveDocument.Spreadsheet.set('C1', 'Expected')
App.ActiveDocument.Spreadsheet.setPosition('C2')
App.ActiveDocument.Spreadsheet.set('A2', '=5 - 4')
App.ActiveDocument.Spreadsheet.setPosition('A3')
App.ActiveDocument.Spreadsheet.set('B2', '=5 + -4')
App.ActiveDocument.Spreadsheet.setPosition('B3')
App.ActiveDocument.Spreadsheet.set('C2', '1')
App.ActiveDocument.Spreadsheet.setPosition('C3')
App.ActiveDocument.Spreadsheet.set('A3', '=(3^2 + 4^2) ^ .5') # = hypot()
App.ActiveDocument.Spreadsheet.setPosition('A4')
App.ActiveDocument.Spreadsheet.set('B3', '=((3^2) + (4^2)) ^ .5')
App.ActiveDocument.Spreadsheet.setPosition('B4')
App.ActiveDocument.Spreadsheet.set('C3', '5')
App.ActiveDocument.Spreadsheet.setPosition('C4')
App.ActiveDocument.recompute()

# right mouse on "Spreadsheet": "Show Spreadsheet"
TagsNo tags attached.
FreeCAD Information

Activities

There are no notes attached to this issue.

Related Changesets

FreeCAD: master 9d5d05a7

2015-06-07 22:17:53

Eivind Kvedalen


Committer: wmayer Details Diff
Spreadsheet: Fixed handling of unary minus/plus, exponentation order, and unit rule (0002099) Affected Issues
0002099
mod - src/Mod/Spreadsheet/App/Expression.cpp Diff File
mod - src/Mod/Spreadsheet/App/Expression.h Diff File
mod - src/Mod/Spreadsheet/App/ExpressionParser.tab.c Diff File
mod - src/Mod/Spreadsheet/App/ExpressionParser.y Diff File
mod - src/Mod/Spreadsheet/App/lex.ExpressionParser.c Diff File

Issue History

Date Modified Username Field Change
2015-05-14 05:02 FreeCadder New Issue
2015-06-18 08:55 wmayer Changeset attached => FreeCAD Master master 9d5d05a7
2015-06-18 08:56 wmayer Status new => closed
2015-06-18 08:56 wmayer Resolution open => fixed
2015-06-18 08:56 wmayer Fixed in Version => 0.16