Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Time granularity #3

Open
luizinhosuraty opened this issue Jan 9, 2019 · 0 comments
Open

Time granularity #3

luizinhosuraty opened this issue Jan 9, 2019 · 0 comments

Comments

@luizinhosuraty
Copy link
Contributor

Description

Our current time granularity is nanoseconds.
We use an uint64, thus we can go up to 584 years in simulation time.
However, this can cause some rounding when our simulation needs a lower granularity

Proposal

There are some approaches that can be taken:

  • put the granularity to picoseconds, but then we can reach a maximum value of 0.58 years simulation time.

  • dynamically select the time granularity and remain with the uint64. (more complex)

  • use the 128 bits uint for picoseconds. However, this option is not standardized yet. Only GCC offers this option for a few architectures.

  • use double for time. A good candidate, just need to make sure that we don't get penalized by float point arithmetic performance. (We also need to pay attention to epsilon precision)

Links / references

https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html

https://en.cppreference.com/w/cpp/language/types

https://stackoverflow.com/questions/3676567/integer-vs-double-arithmetic-performance

http://nicolas.limare.net/pro/notes/2014/12/12_arit_speed/

https://en.wikipedia.org/wiki/Machine_epsilon

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant