View | Details | Raw Unified | Return to issue 38759
Collapse All | Expand All

(-)sc/source/core/tool/interpr1.cxx (-2 / +28 lines)
Lines 2440-2445 void ScInterpreter::ScMin( BOOL bTextAsZ Link Here
2440
	double nVal = 0.0;
2442
	double nVal = 0.0;
2441
	ScAddress aAdr;
2443
	ScAddress aAdr;
2442
	ScRange aRange;
2444
	ScRange aRange;
2445
	bool bEmptyCells = FALSE;
2446
	
2443
	for (short i = 0; i < nParamCount; i++)
2447
	for (short i = 0; i < nParamCount; i++)
2444
	{
2448
	{
2445
		switch (GetStackType())
2449
		switch (GetStackType())
Lines 2466-2471 void ScInterpreter::ScMin( BOOL bTextAsZ Link Here
2466
					if ( nMin > 0.0 )
2470
					if ( nMin > 0.0 )
2467
						nMin = 0.0;
2471
						nMin = 0.0;
2468
				}
2472
				}
2473
				else if ( pCell && pCell->GetStringData().Len() == 0 )
2474
					bEmptyCells = TRUE;
2469
			}
2475
			}
2470
			break;
2476
			break;
2471
			case svDoubleRef :
2477
			case svDoubleRef :
Lines 2485-2490 void ScInterpreter::ScMin( BOOL bTextAsZ Link Here
2485
					}
2491
					}
2486
					SetError(nErr);
2492
					SetError(nErr);
2487
				}
2493
				}
2494
				else
2495
					bEmptyCells = TRUE;
2488
			}
2496
			}
2489
			break;
2497
			break;
2490
			case svMatrix :
2498
			case svMatrix :
Lines 2520-2525 void ScInterpreter::ScMin( BOOL bTextAsZ Link Here
2520
									if ( nMin > 0.0 )
2528
									if ( nMin > 0.0 )
2521
										nMin = 0.0;
2529
										nMin = 0.0;
2522
								}
2530
								}
2531
								else if ( pMat->IsEmpty(i,j) )
2532
									bEmptyCells = TRUE;
2523
							}
2533
							}
2524
						 }
2534
						 }
2525
					}
2535
					}
Lines 2544-2550 void ScInterpreter::ScMin( BOOL bTextAsZ Link Here
2544
		}
2554
		}
2545
	}
2555
	}
2546
	if (nMin == SC_DOUBLE_MAXVALUE)
2556
	if (nMin == SC_DOUBLE_MAXVALUE)
2547
		SetIllegalArgument();
2557
	{
2558
		if (bEmptyCells)
2559
			PushDouble(0.0);
2560
		else
2561
			SetIllegalArgument();
2562
	}
2548
	else
2563
	else
2549
		PushDouble(nMin);
2564
		PushDouble(nMin);
2550
}
2565
}
Lines 2560-2565 void ScInterpreter::ScMax( BOOL bTextAsZ Link Here
2560
	double nVal = 0.0;
2575
	double nVal = 0.0;
2561
	ScAddress aAdr;
2576
	ScAddress aAdr;
2562
	ScRange aRange;
2577
	ScRange aRange;
2578
	bool bEmptyCells = FALSE;
2579
	
2563
	for (short i = 0; i < nParamCount; i++)
2580
	for (short i = 0; i < nParamCount; i++)
2564
	{
2581
	{
2565
		switch (GetStackType())
2582
		switch (GetStackType())
Lines 2586-2591 void ScInterpreter::ScMax( BOOL bTextAsZ Link Here
2586
					if ( nMax < 0.0 )
2603
					if ( nMax < 0.0 )
2587
						nMax = 0.0;
2604
						nMax = 0.0;
2588
				}
2605
				}
2606
				else if ( pCell && pCell->GetStringData().Len() == 0 )
2607
					bEmptyCells = TRUE;
2589
			}
2608
			}
2590
			break;
2609
			break;
2591
			case svDoubleRef :
2610
			case svDoubleRef :
Lines 2605-2610 void ScInterpreter::ScMax( BOOL bTextAsZ Link Here
2605
					}
2624
					}
2606
					SetError(nErr);
2625
					SetError(nErr);
2607
				}
2626
				}
2627
				else
2628
					bEmptyCells = TRUE;
2608
			}
2629
			}
2609
			break;
2630
			break;
2610
			case svMatrix :
2631
			case svMatrix :
Lines 2640-2645 void ScInterpreter::ScMax( BOOL bTextAsZ Link Here
2640
									if ( nMax < 0.0 )
2661
									if ( nMax < 0.0 )
2641
										nMax = 0.0;
2662
										nMax = 0.0;
2642
								}
2663
								}
2664
								else if ( pMat->IsEmpty(i,j) )
2665
									bEmptyCells = TRUE;
2643
							}
2666
							}
2644
						}
2667
						}
2645
					}
2668
					}
Lines 2664-2670 void ScInterpreter::ScMax( BOOL bTextAsZ Link Here
2664
		}
2687
		}
2665
	}
2688
	}
2666
	if (nMax == -SC_DOUBLE_MAXVALUE)
2689
	if (nMax == -SC_DOUBLE_MAXVALUE)
2667
		SetIllegalArgument();
2690
	{
2691
		if (bEmptyCells)
2692
			PushDouble(0.0);
2693
		else
2694
			SetIllegalArgument();
2695
	}
2668
	else
2696
	else
2669
		PushDouble(nMax);
2697
		PushDouble(nMax);
2670
}
2698
}

Return to issue 38759