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 858251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:31:10+00:00 2026-05-15T08:31:10+00:00

If numeric expression contains operands (constants and variables) of different numeric types, are operands

  • 0

If numeric expression contains operands (constants and variables) of different numeric types, are operands promoted to larger types according to the following rules:

  1. if operands are of types byte, sbyte, char, short, ushort, they get converted to int type
  2. If one of the operands is int, then all operands are converted to int
  3. if expression also contains operands of types uint and int, then all operands are converted to long
  4. If one of operands is long, then all operands are converted to long
  5. if expression contains operands of type ulong and long, then operands are converted to float
  6. If one of the operands is float, then all operands are converted to float
  7. if one of operands is double, then all operands are converted to double

Assuming numeric expressions contains operands of different types, will all operands first get converted to a single numeric type, and only then will the runtime try to compute the result? For example, if variables b1 and b2 are of byte type, while i1 is of int type, will b1 and b2 get converted to int prior to computing (b1+b2):

int i2=(b1+b2)+i1
  • 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-05-15T08:31:11+00:00Added an answer on May 15, 2026 at 8:31 am

    The parentheses are of higher precedence than +, so the conversion would normally take place after b1 and b2 have been added. However, the + operator does not have an overload for bytes, so the bytes must first be promoted to ints.

    Further reading:

    • operator precedence
    • binary numeric promotion
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a regular expression ^[a-zA-Z+#-.0-9]{1,5}$ which validates that the word contains alpha-numeric characters
I've created a regular expression that matches any numeric value (with leading or trailing
I have an nvarchar SQL column which contains mostly numeric values. I'm trying to
I have a numeric textbox in C# .NET which is nothing more than a
MS Access allows the numeric type GUID (in German it's called 'Replikations-ID', so I
Why would someone use numeric(12, 0) datatype for a simple integer ID column? If
I'm passing some numeric arguments while creating a process (in VC++) I'm stuck at
Effectively I want to give numeric scores to alphabetic grades and sum them. In
I'm looking to add a numeric up / down control to a .Net StatusStrip.
Given a table (mytable) containing a numeric field (mynum), how would one go about

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.