Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mac_drand48r.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __MACDRAND48_R_H
25 #define __MACDRAND48_R_H
26 
27 #include <stdlib.h>
28 
29 #include <limits.h>
30 #ifndef WIN32
31 #include <mach/mach.h>
32 #endif
33 
35  {
36  double d;
37 
38  /* This is the IEEE 754 double-precision format. */
39  struct
40  {
41  /* Together these comprise the mantissa. */
42  unsigned int mantissa1:32;
43  unsigned int mantissa0:20;
44  unsigned int exponent:11;
45  unsigned int negative:1;
46  } ieee;
47 
48  /* This format makes it easier to see if a NaN is a signalling NaN. */
49  struct
50  {
51  /* Together these comprise the mantissa. */
52  unsigned int mantissa1:32;
53  unsigned int mantissa0:19;
54  unsigned int quiet_nan:1;
55  unsigned int exponent:11;
56  unsigned int negative:1;
57  } ieee_nan;
58  };
59 
60 #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
61 
62 
63 struct drand48_data {
64  unsigned short int __x[3]; /* Current state. */
65  unsigned short int __old_x[3]; /* Old state. */
66  unsigned short int __c; /* Additive const. in congruential formula. */
67  unsigned short int __init; /* Flag for initializing. */
68  unsigned long long int __a; /* Factor in congruential formula. */
69 };
70 
71 
72 int srand48_r (long int seedval, struct drand48_data *buffer);
73 
74 int drand48_r ( struct drand48_data *buffer, double *result);
75 
76 
77 #endif
Definition: mac_drand48r.h:63
unsigned int exponent
Definition: mac_drand48r.h:44
unsigned long long int __a
Definition: mac_drand48r.h:68
unsigned int mantissa1
Definition: mac_drand48r.h:42
unsigned int negative
Definition: mac_drand48r.h:45
int drand48_r(struct drand48_data *buffer, double *result)
Definition: randomgenerator.cpp:104
struct ieee754_double::@0 ieee
double d
Definition: mac_drand48r.h:36
unsigned short int __init
Definition: mac_drand48r.h:67
unsigned short int __old_x[3]
Definition: mac_drand48r.h:65
int srand48_r(long int seedval, struct drand48_data *buffer)
Definition: randomgenerator.cpp:87
Definition: mac_drand48r.h:34
struct ieee754_double::@1 ieee_nan
unsigned short int __x[3]
Definition: mac_drand48r.h:64
unsigned short int __c
Definition: mac_drand48r.h:66
unsigned int mantissa0
Definition: mac_drand48r.h:43
unsigned int quiet_nan
Definition: mac_drand48r.h:54