Add unary minus as operator supported by verireal.
This commit is contained in:
parent
8d3102388b
commit
fbfc796647
14
verireal.cc
14
verireal.cc
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1999-2004 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: verireal.cc,v 1.14 2003/03/07 06:10:13 steve Exp $"
|
#ident "$Id: verireal.cc,v 1.15 2004/06/04 23:33:51 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -117,6 +117,13 @@ verireal operator% (const verireal&l, const verinum&r)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verireal operator- (const verireal&l)
|
||||||
|
{
|
||||||
|
verireal res;
|
||||||
|
res.value_ = - l.value_;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
ostream& operator<< (ostream&out, const verireal&v)
|
ostream& operator<< (ostream&out, const verireal&v)
|
||||||
{
|
{
|
||||||
out << v.value_;
|
out << v.value_;
|
||||||
|
|
@ -125,6 +132,9 @@ ostream& operator<< (ostream&out, const verireal&v)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: verireal.cc,v $
|
* $Log: verireal.cc,v $
|
||||||
|
* Revision 1.15 2004/06/04 23:33:51 steve
|
||||||
|
* Add unary minus as operator supported by verireal.
|
||||||
|
*
|
||||||
* Revision 1.14 2003/03/07 06:10:13 steve
|
* Revision 1.14 2003/03/07 06:10:13 steve
|
||||||
* Use strtod to convert text to doubles.
|
* Use strtod to convert text to doubles.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
11
verireal.h
11
verireal.h
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef __verireal_H
|
#ifndef __verireal_H
|
||||||
#define __verireal_H
|
#define __verireal_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1999-2004 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: verireal.h,v 1.9 2003/02/07 06:13:44 steve Exp $"
|
#ident "$Id: verireal.h,v 1.10 2004/06/04 23:33:51 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_IOSFWD
|
#ifdef HAVE_IOSFWD
|
||||||
|
|
@ -46,6 +46,9 @@ class verireal {
|
||||||
friend verireal operator% (const verireal&, const verireal&);
|
friend verireal operator% (const verireal&, const verireal&);
|
||||||
friend verireal operator% (const verireal&, const verinum&);
|
friend verireal operator% (const verireal&, const verinum&);
|
||||||
|
|
||||||
|
// Unary minus.
|
||||||
|
friend verireal operator- (const verireal&);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit verireal();
|
explicit verireal();
|
||||||
explicit verireal(const char*text);
|
explicit verireal(const char*text);
|
||||||
|
|
@ -71,9 +74,13 @@ extern verireal operator/ (const verireal&, const verireal&);
|
||||||
extern verireal operator/ (const verireal&, const verinum&);
|
extern verireal operator/ (const verireal&, const verinum&);
|
||||||
extern verireal operator% (const verireal&, const verireal&);
|
extern verireal operator% (const verireal&, const verireal&);
|
||||||
extern verireal operator% (const verireal&, const verinum&);
|
extern verireal operator% (const verireal&, const verinum&);
|
||||||
|
extern verireal operator- (const verireal&);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: verireal.h,v $
|
* $Log: verireal.h,v $
|
||||||
|
* Revision 1.10 2004/06/04 23:33:51 steve
|
||||||
|
* Add unary minus as operator supported by verireal.
|
||||||
|
*
|
||||||
* Revision 1.9 2003/02/07 06:13:44 steve
|
* Revision 1.9 2003/02/07 06:13:44 steve
|
||||||
* Store real values as native double.
|
* Store real values as native double.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue