Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8900227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:03:24+00:00 2026-06-15T01:03:24+00:00

In most cases double and decimal type update on 64 bit system is an

  • 0

In most cases double and decimal type update on 64 bit system is an atomic operation cause these types are 64 bit. (decimal is 128bit so this is wrong, thanks for comments)

But when I update double? and decimal? type on 64 bit system will it be atomic? What is the size of double? and decimal?

I understand that atomicity is not guaranteed though I still interested if such update will be atomic in general scenario.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:03:25+00:00Added an answer on June 15, 2026 at 1:03 am

    In most cases double and decimal type update on 64 bit system is atomic operation cause these types are 64 bit.

    No, decimal is 128 bit to start with. Also note that running on a 64-bit computer doesn’t necessarily mean you’re running the 64-bit CLR. It’s not clear what you mean by “system” here.

    So you shouldn’t even assume atomicity for decimal. Even on a 64-bit CLR, I wouldn’t want to rely on the atomicity of double, partly as it will depend on alignment. The C# specification explicitly states (section 5.5 of the C# 4 spec):

    Reads and writes of other types, including long, ulong, double, and decimal, as well as user-defined types, are not guaranteed to be atomic.

    So that makes the nullable side kinda pointless, but…

    But when I update double? and decimal? type on 64 bit system will it be atomic? what is the size of double? and decimal?

    Nullable<T> is basically a T field and a bool field. So the storage will be more than 64 bits for double, and more than 128 bits for decimal. The exact storage will quite possibly depend on the context, but basically I wouldn’t expect atomicity for operations with these types.

    As others have said, you almost certainly don’t want to rely on anything that’s not guaranteed. Personally I’d almost always try to avoid lock-free coding in general. Try to use higher-level abstractions that are provided by the CLR/BCL teams and proven to be safe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the most accurate way I can do a multiply-and-divide operation for 64-bit
In most cases, I've been setting an event class handler that will apply to
In most cases if I want to create an optional feature in C, I
Preface: I'm know that in most cases using a volatile field won't yield any
Dealing with Java - which the option you prefer in the most cases -
I learned, that it is (at least in most cases) a good propgramming style
I refactor some classes from standard SQL to JPA/ORM usage. In most cases the
I'm using WiX 3 to setup my Web Application and most of the cases
In most cases, validation methods I've overridden execute twice each time the parent field
This is an issue that's left me scratching my head. Most of the time,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.