summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-06-20 18:07:54 +0200
committerEike Rathke <erack@redhat.com>2018-06-20 19:47:26 +0200
commit93dcfa7ee157dd865f5d266d1f877014462eac72 (patch)
treeb71e9a514090a2247eb7174acaae7d7e0869b0b8
parent678f8ab7eb90f5b0dd99328957b21d11e3be68b4 (diff)
Related: tdf#117049 treat yet unknown result as initial 0.0
For the first =A1+B1 in B1 with iterations the result could had been #VALUE! depending on string conversion calculation settings. Change-Id: I8d7a745d67ba7a20f7a66e8aa143642d08ea5111 Reviewed-on: https://gerrit.libreoffice.org/56173 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
-rw-r--r--sc/source/core/tool/formularesult.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/sc/source/core/tool/formularesult.cxx b/sc/source/core/tool/formularesult.cxx
index c1ed01516113..ad10f51a36ba 100644
--- a/sc/source/core/tool/formularesult.cxx
+++ b/sc/source/core/tool/formularesult.cxx
@@ -274,7 +274,12 @@ namespace {
inline bool isValue( formula::StackVar sv )
{
return sv == formula::svDouble || sv == formula::svError
- || sv == formula::svEmptyCell;
+ || sv == formula::svEmptyCell
+ // The initial unitialized result value is double 0.0, even if the type
+ // is unknown, so the interpreter asking for it gets that double
+ // instead of having to convert a string which may result in #VALUE!
+ // (otherwise the unknown would be neither error nor double nor string)
+ || sv == formula::svUnknown;
}
inline bool isString( formula::StackVar sv )
@@ -457,6 +462,8 @@ double ScFormulaResult::GetDouble() const
; // nothing
}
}
+ // Note that we reach here also for the default ctor and
+ // formula::svUnknown from GetType().
return 0.0;
}
if (mbEmpty)