adding GNU dc ("desk calculator")
[unix-history] / gnu / lib / libg++ / g++-include / NegExp.h
CommitLineData
15637ed4
RG
1// This may look like C code, but it is really -*- C++ -*-
2/*
3Copyright (C) 1988 Free Software Foundation
4 written by Dirk Grunwald (grunwald@cs.uiuc.edu)
5
6This file is part of GNU CC.
7
8GNU CC is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY. No author or distributor
10accepts responsibility to anyone for the consequences of using it
11or for whether it serves any particular purpose or works at all,
12unless he says so in writing. Refer to the GNU CC General Public
13License for full details.
14
15Everyone is granted permission to copy, modify and redistribute
16GNU CC, but only under the conditions described in the
17GNU CC General Public License. A copy of this license is
18supposed to have been given to you along with GNU CC so you
19can know your rights and responsibilities. It should be in a
20file named COPYING. Among other things, the copyright notice
21and this notice must be preserved on all copies.
22*/
23#ifndef _NegativeExpntl_h
24#ifdef __GNUG__
25#pragma once
26#pragma interface
27#endif
28#define _NegativeExpntl_h 1
29
30
31//
32// Negative Exponential Random Numbers
33//
34//
35
36#include <Random.h>
37
38class NegativeExpntl: public Random {
39protected:
40 double pMean;
41public:
42 NegativeExpntl(double xmean, RNG *gen);
43 double mean();
44 double mean(double x);
45
46 virtual double operator()();
47};
48
49#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES)
50
51inline NegativeExpntl::NegativeExpntl(double xmean, RNG *gen)
52: (gen) {
53 pMean = xmean;
54}
55
56inline double NegativeExpntl::mean() { return pMean; }
57inline double NegativeExpntl::mean(double x) {
58 double t = pMean; pMean = x;
59 return t;
60}
61
62#endif
63#endif