LCOV - code coverage report
Current view: top level - sc/source/core/tool - subtotal.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 23 43.5 %
Date: 2012-08-25 Functions: 2 3 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 8 25.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "subtotal.hxx"
      30                 :            : #include "interpre.hxx"
      31                 :            : 
      32                 :            : // -----------------------------------------------------------------------
      33                 :            : 
      34                 :       3021 : sal_Bool SubTotal::SafePlus(double& fVal1, double fVal2)
      35                 :            : {
      36                 :       3021 :     sal_Bool bOk = sal_True;
      37                 :            :     SAL_MATH_FPEXCEPTIONS_OFF();
      38                 :       3021 :     fVal1 += fVal2;
      39         [ -  + ]:       3021 :     if (!::rtl::math::isFinite(fVal1))
      40                 :            :     {
      41                 :          0 :         bOk = false;
      42         [ #  # ]:          0 :         if (fVal2 > 0.0)
      43                 :          0 :             fVal1 = DBL_MAX;
      44                 :            :         else
      45                 :          0 :             fVal1 = -DBL_MAX;
      46                 :            :     }
      47                 :       3021 :     return bOk;
      48                 :            : }
      49                 :            : 
      50                 :            : 
      51                 :        187 : sal_Bool SubTotal::SafeMult(double& fVal1, double fVal2)
      52                 :            : {
      53                 :        187 :     sal_Bool bOk = sal_True;
      54                 :            :     SAL_MATH_FPEXCEPTIONS_OFF();
      55                 :        187 :     fVal1 *= fVal2;
      56         [ -  + ]:        187 :     if (!::rtl::math::isFinite(fVal1))
      57                 :            :     {
      58                 :          0 :         bOk = false;
      59                 :          0 :         fVal1 = DBL_MAX;
      60                 :            :     }
      61                 :        187 :     return bOk;
      62                 :            : }
      63                 :            : 
      64                 :            : 
      65                 :          0 : sal_Bool SubTotal::SafeDiv(double& fVal1, double fVal2)
      66                 :            : {
      67                 :          0 :     sal_Bool bOk = sal_True;
      68                 :            :     SAL_MATH_FPEXCEPTIONS_OFF();
      69                 :          0 :     fVal1 /= fVal2;
      70         [ #  # ]:          0 :     if (!::rtl::math::isFinite(fVal1))
      71                 :            :     {
      72                 :          0 :         bOk = false;
      73                 :          0 :         fVal1 = DBL_MAX;
      74                 :            :     }
      75                 :          0 :     return bOk;
      76                 :            : }
      77                 :            : 
      78                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10