viminfo
[gnucap-felix.git] / lib / m_base_math.cc
blob0858eba21e1f6823311e32ebeb2bea85278eadac
1 /*$Id: m_base_math.cc,v 26.114 2009/08/13 16:32:53 al Exp $ -*- C++ -*-
2 * Copyright (C) 2003 Albert Davis
3 * Author: Albert Davis <aldavis@gnu.org>
5 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *------------------------------------------------------------------
23 //testing=script 2009.08.13
24 #include "m_base.h"
25 /*--------------------------------------------------------------------------*/
26 std::string new_name()
27 {untested();
28 static int c = 0;
29 char s[30];
30 sprintf(s, "EX%04u", ++c);
31 return s;
33 /*--------------------------------------------------------------------------*/
34 Base* Base::logic_not()const
36 if (to_bool()) {
37 return new Float(0.);
38 }else{untested();
39 return new Float(1.);
42 /*--------------------------------------------------------------------------*/
43 Base* Base::logic_or(const Base* X)const
45 if ((to_bool()) || (X && X->to_bool())) {
46 return new Float(1.);
47 }else{
48 return new Float(0.);
51 /*--------------------------------------------------------------------------*/
52 Base* Base::logic_and(const Base* X)const
54 if (!to_bool() || !X || !X->to_bool()) {
55 return new Float(0.);
56 }else{
57 return new Float(1.);
60 /*--------------------------------------------------------------------------*/
61 /*--------------------------------------------------------------------------*/
62 // vim:ts=8:sw=2:noet: