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

  • Home
  • SEARCH
  • 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 8995393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:36:51+00:00 2026-06-15T23:36:51+00:00

Addition mathematically holds the associative property: (a + b) + c = a +

  • 0

Addition mathematically holds the associative property:

(a + b) + c = a + (b + c)

In the general case, this property does not hold for floating-point numbers because they represent values in a finite precision.

Is a compiler allowed to make the above substitution when generating machine code from a C program as part of an optimization? Where does it exactly say in the C standard?

  • 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-15T23:36:52+00:00Added an answer on June 15, 2026 at 11:36 pm

    The compiler is not allowed to perform “optimizations”, which would result in a different value computed, than the one computed according to abstract machine semantics.

    5.1.2.3 Program execution

    [#1] The semantic descriptions in this International
    Standard describe the behavior of an abstract machine in
    which issues of optimization are irrelevant.

    [#3] In the abstract machine, all expressions are evaluated
    as specified by the semantics.

    [#13] EXAMPLE 5 Rearrangement for floating-point expressions
    is often restricted because of limitations in precision as
    well as range. The implementation cannot generally apply
    the mathematical associative rules for addition or
    multiplication, nor the distributive rule, because of
    roundoff error, even in the absence of overflow and
    underflow.

    In your example:

    (a + b) + c
    

    or even without the parentheses:

    a + b + c
    

    we have

       +
      / \
      +  c
     / \
     a  b
    

    and the compiler is required to generate code as if a is summed with b and the result is summed with c.

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

Sidebar

Related Questions

Ran across this NSString Addition and I hav no idea what it does or
In addition to this question: iPhone network performance , I would like to know
In addition to not being based on MooTools ( 1 , 2 ), and
In addition to this question: link i'm asking if i can retrieve data like
As addition to this question, I took Ladislav Mrnka's answer . The problem is
I made module addition and in this made three fields amount1_c , amount2_c and
In addition to this Can I 'frame' a web-app in an iPhone app I
In addition to this quite old post , I need something that will use
This is for an addition to a legacy iPhone app with the architecture already
In addition to the general res/layout folder I have a res/layout-v3 folder for backward

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.