Skip to content

Random rounding mode#15

Draft
MinliLiao wants to merge 4 commits into
RIKEN-RCCS:developfrom
MinliLiao:rand_rounding
Draft

Random rounding mode#15
MinliLiao wants to merge 4 commits into
RIKEN-RCCS:developfrom
MinliLiao:rand_rounding

Conversation

@MinliLiao

@MinliLiao MinliLiao commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

This pull request adds a macro __RAPTOR_RANDOM_ROUNDING_MODE where if it were defined during compilation of RAPTOR, __RAPTOR_MPFR_DEFAULT_ROUNDING_MODE generates a new random MPFR rounding mode (between MPFR_RNDU and MPFR_RNDD) for each use.

This pull request also adds a macro __RATPTOR_USE_STOCHASTIC_ROUNDING where if it were defined during compilation of RAPTOR, a naive implementation of stochastic rounding is used for each MPFR operation. The rounding mode is randomly selected between MPFR_RNDU and MPFR_RNDD with the probability based on the proximity.

PS: The macros can be defined from the cmake command line with -DCMAKE_CXX_FLAGS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant