*** sc\source\core\tool/interpr1.cxx Mon Dec 10 14:59:32 2007 --- sc\source\core\tool/interpr1.cxx Tue Dec 18 14:59:56 2007 *************** *** 2768,2773 **** --- 2768,2774 ---- double nVal = 0.0; ScAddress aAdr; ScRange aRange; + bool bEmptyCells = FALSE; for (short i = 0; i < nParamCount; i++) { switch (GetStackType()) *************** *** 2794,2799 **** --- 2795,2802 ---- if ( nMin > 0.0 ) nMin = 0.0; } + else + bEmptyCells = TRUE; } break; case svDoubleRef : *************** *** 2813,2818 **** --- 2816,2823 ---- } SetError(nErr); } + else + bEmptyCells = TRUE; } break; case svMatrix : *************** *** 2834,2839 **** --- 2839,2845 ---- } else { + bEmptyCells = TRUE; for (SCSIZE nMatCol = 0; nMatCol < nC; nMatCol++) { for (SCSIZE nMatRow = 0; nMatRow < nR; nMatRow++) *************** *** 2842,2847 **** --- 2848,2854 ---- { nVal = pMat->GetDouble(nMatCol,nMatRow); if (nMin > nVal) nMin = nVal; + bEmptyCells = FALSE; } else if ( bTextAsZero ) { *************** *** 2863,2869 **** nMin = 0.0; } else ! SetError(errIllegalParameter); } break; default : --- 2870,2876 ---- nMin = 0.0; } else ! bEmptyCells = TRUE; } break; default : *************** *** 2872,2880 **** } } if (nMin == SC_DOUBLE_MAXVALUE) ! SetIllegalArgument(); else PushDouble(nMin); } #if defined(WIN) && defined(MSC) --- 2879,2899 ---- } } if (nMin == SC_DOUBLE_MAXVALUE) ! { ! if (bEmptyCells) ! PushDouble(0.0); ! else ! SetIllegalArgument(); ! } else + { + if (bEmptyCells && bTextAsZero) + { + if ( nMin > 0.0 ) + nMin = 0.0; + } PushDouble(nMin); + } } #if defined(WIN) && defined(MSC) *************** *** 2888,2893 **** --- 2907,2913 ---- double nVal = 0.0; ScAddress aAdr; ScRange aRange; + bool bEmptyCells = FALSE; for (short i = 0; i < nParamCount; i++) { switch (GetStackType()) *************** *** 2914,2919 **** --- 2934,2941 ---- if ( nMax < 0.0 ) nMax = 0.0; } + else + bEmptyCells = TRUE; } break; case svDoubleRef : *************** *** 2933,2938 **** --- 2955,2962 ---- } SetError(nErr); } + else + bEmptyCells = TRUE; } break; case svMatrix : *************** *** 2954,2959 **** --- 2978,2984 ---- } else { + bEmptyCells = TRUE; for (SCSIZE nMatCol = 0; nMatCol < nC; nMatCol++) { for (SCSIZE nMatRow = 0; nMatRow < nR; nMatRow++) *************** *** 2962,2967 **** --- 2987,2993 ---- { nVal = pMat->GetDouble(nMatCol,nMatRow); if (nMax < nVal) nMax = nVal; + bEmptyCells = FALSE; } else if ( bTextAsZero ) { *************** *** 2983,2989 **** nMax = 0.0; } else ! SetError(errIllegalParameter); } break; default : --- 3009,3015 ---- nMax = 0.0; } else ! bEmptyCells = TRUE; } break; default : *************** *** 2992,3000 **** } } if (nMax == -SC_DOUBLE_MAXVALUE) ! SetIllegalArgument(); else PushDouble(nMax); } #if defined(WIN) && defined(MSC) #pragma optimize("",on) --- 3018,3038 ---- } } if (nMax == -SC_DOUBLE_MAXVALUE) ! { ! if (bEmptyCells) ! PushDouble(0.0); ! else ! SetIllegalArgument(); ! } else + { + if (bEmptyCells && bTextAsZero) + { + if ( nMax < 0.0 ) + nMax = 0.0; + } PushDouble(nMax); + } } #if defined(WIN) && defined(MSC) #pragma optimize("",on)