New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiprecision get_constant_one_over_epsilon() not thread safe #67

Closed
mkorpar opened this Issue Aug 16, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@mkorpar
Copy link

mkorpar commented Aug 16, 2018

template <class T>
const T& get_constant_one_over_epsilon()
{
   static const bool is_init = false;
   static T result;
   if (is_init == false)
   {
      typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
      result = static_cast<ui_type>(1u);
      eval_divide(result, std::numeric_limits<number<T> >::epsilon().backend());
   }

   constant_initializer<T, &get_constant_one_over_epsilon<T> >::do_nothing();

   return result;
}

is_init is never set to true.

@jzmaddock

This comment has been minimized.

Copy link
Collaborator

jzmaddock commented Aug 16, 2018

Not sure what happened there, none of that initialization code was quite right. Should all be consistent and fixed now.

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