The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
numerical.h
Go to the documentation of this file.
1 
31 #pragma once
32 
33 #include <stdbool.h>
34 
36 typedef uint64_t seed_type;
37 
42 typedef struct _numerical_state {
44  double gset;
45  bool iset;
47 
48 void numerical_init(void);
49 
50 
51 // without this stuff dijkstra on thousands of nodes would probably fail horribly:
52 // this is needed in order to lose less precision on hundreds of double additions
53 
56  double sum;
57  double crt;
58 };
59 
60 double NeumaierSum (unsigned cnt, double addendums[cnt]);
61 struct _sum_helper_t PartialNeumaierSum(struct _sum_helper_t sh, double addendum);
62 
63 #define ValueSumHelper(a) (a.crt + a.sum)
64 
65 #define CmpSumHelpers(a, b) ({\
66  double __a_s = a.sum + a.crt;\
67  double __b_s = b.sum + b.crt;\
68  (__a_s > __b_s) - (__b_s > __a_s);\
69 })
70 
struct _numerical_state numerical_state_t
uint64_t seed_type
Numerical seed type.
Definition: numerical.h:36
double NeumaierSum(unsigned cnt, double addendums[cnt])
Definition: numerical.c:432
seed_type seed
Definition: numerical.h:43
this represents a partial Neumaier sum
Definition: numerical.h:55