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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:41:32+00:00 2026-05-27T19:41:32+00:00

I am making a calculator on C#. I have to use float because, when

  • 0

I am making a calculator on C#.
I have to use float because, when I divide numbers, I get an answer less than 0.
but, I want the calculator to begin the new calculation with the answer i already got, So i wrote:

 a = Convert.ToInt64(answer);

but, it doesn’t help, it converts the answer to int64 too.
I think, I will be able to do with pointers, but I don’t know how.

So how can I copy the value of answer to ‘a’ (the Input), without converting answer?

    Int64 a; //1st Input
    Int64 b; //2nd Input
    float answer;
    char d;
    bool pressed;
   private void button11_Click(object sender, EventArgs e)
    {
        if (d == '+') answer = a + b;
        if (d == '-') answer = a - b;
        if (d == '*') answer = a * b;
        if (d == '/') answer = a / b;
        textBox1.Text = a.ToString() + d + b.ToString() + '=' +answer.ToString();
        a = Convert.ToInt64(answer);
        b = 0;
    }

sorry, for the lack of the whole source code, if anybody want’s me to add them too just tell me 🙂

  • 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-27T19:41:33+00:00Added an answer on May 27, 2026 at 7:41 pm

    Couple of observations that may help:

    1. Your inputs probably shouldn’t be Int64 in the first place, as it is unlikely the user will work only in whole numbers, especially once they start using division.
    2. Your answer and your inputs should be the same type, this will remove your casting issues.
    3. Float is imprecise and may not be the best option. If you need better accuracy than Float can allow, you may try Decimal. (if you are unaware of the limitations of floating point arithmetic, Google for it)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm making a calculator and need to get my buttons to work but i
I am a beginner in C# , and making a calculator . But i
I'm making use of an ARM Cortex-A8 based processor and I have several places
I'm making a simple RTS game. I want it to run very fast because
i have to build some financial data report, and for making the calculation, there
Making an adobe flex ui in which data that is calculated must use proprietary
Making my first steps with NHibernate, I'm trying to have it creating my Tables
I am making an all-in-one calculator (I guess). Here is my code (I know
I have a few specific places in my code where I use specific pixel
well at school every week we are making a calculator each week on a

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.