| View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0015557 | VTK | (No Category) | public | 2015-06-27 11:37 | 2015-08-13 10:11 | ||||
| Reporter | Tsutomu Ikegami | ||||||||
| Assigned To | T.J. Corona | ||||||||
| Priority | normal | Severity | minor | Reproducibility | have not tried | ||||
| Status | closed | Resolution | fixed | ||||||
| Platform | OS | OS Version | |||||||
| Product Version | 6.0.0 | ||||||||
| Target Version | Fixed in Version | ||||||||
| Summary | 0015557: vtkFunctionParser gives wrong results for numeric literals | ||||||||
| Description | The vtkFunctionParser wrongly parses numeric literals with exponent notation. For example, "3.0e+01" is parsed as 31.0 = 3.0e01 + 01. I have confirmed the phenomena on VTK version 6.2.0. ----- sample code in python ----- import vtk f = vtk.vtkFunctionParser() f.SetFunction("3.0e+01") print f.GetScalarResult() => 31.0 --------------------------------- I noticed that only the '(\d)e-(\d)' case is treated specially in vtkFunctionParser.cxx:l.1542, but I have no graceful idea to fix it. | ||||||||
| Tags | No tags attached. | ||||||||
| Project | TBD | ||||||||
| Type | incorrect functionality | ||||||||
| Attached Files | |||||||||
| Relationships | |
| Relationships |
| Notes | |
|
(0034974) T.J. Corona (developer) 2015-08-12 10:57 |
Scientific notation with a unary plus operator now behaves correctly. Additionally, the unary plus operator has been added to vtkFunctionParser. For more information, see https://gitlab.kitware.com/tjcorona/vtk/commit/1f890b9bfa5e45cdfd748f9147225907c980da00 [^] |
|
(0034979) Tsutomu Ikegami (reporter) 2015-08-12 21:28 |
Thank you for the correction. Please allow me to add a quick patch. This corrects "3.0E-01" case, which is also parsed by atof() function at line 2034. --- vtkFunctionParser.cxx.orig 2015-08-13 10:21:58.000000000 +0900 +++ vtkFunctionParser.cxx 2015-08-13 10:22:47.000000000 +0900 @@ -1563,7 +1563,7 @@ !((this->Function[i] == '-' || this->Function[i] == '+') && (this->IsElementaryOperator(this->Function[i-1]) || this->Function[i-1] == '(' || - (this->Function[i-1] == 'e' && i > 1 && + ((this->Function[i-1] == 'e' || this->Function[i-1] == 'E') && i > 1 && isdigit(this->Function[i-2])))) && !(this->Function[i] == '.' && (i+1 < this->FunctionLength) && |
|
(0034986) T.J. Corona (developer) 2015-08-13 10:11 |
Thanks! This addition has been made. For more information, see https://gitlab.kitware.com/vtk/vtk/commit/c5c1880ab61b37fa931f60ad359a0f1e4ee308c6 [^] |
| Notes |
| Issue History | |||
| Date Modified | Username | Field | Change |
| 2015-06-27 11:37 | Tsutomu Ikegami | New Issue | |
| 2015-08-07 12:58 | T.J. Corona | Assigned To | => T.J. Corona |
| 2015-08-12 10:57 | T.J. Corona | Note Added: 0034974 | |
| 2015-08-12 10:57 | T.J. Corona | Status | backlog => closed |
| 2015-08-12 10:57 | T.J. Corona | Resolution | open => fixed |
| 2015-08-12 21:28 | Tsutomu Ikegami | Note Added: 0034979 | |
| 2015-08-12 21:28 | Tsutomu Ikegami | Status | closed => backlog |
| 2015-08-12 21:28 | Tsutomu Ikegami | Resolution | fixed => reopened |
| 2015-08-13 10:11 | T.J. Corona | Note Added: 0034986 | |
| 2015-08-13 10:11 | T.J. Corona | Status | backlog => closed |
| 2015-08-13 10:11 | T.J. Corona | Resolution | reopened => fixed |
| Issue History |
| Copyright © 2000 - 2018 MantisBT Team |