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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:17:25+00:00 2026-05-31T03:17:25+00:00

I have 7 integers, and one calculation. Calculating maximumY should equal -3940 but instead

  • 0

I have 7 integers, and one calculation. Calculating maximumY should equal -3940 but instead produces 1724869434.

Why is this?

in1 = 1000;
in2 = 1000;
in3 = 100;
in4 = 100;
in5 = 100;
in6 = 1000;
in7 = 100;
duration / 1000 = 24;
frequency1 / 1000 = 5
frequency2 / 1000 = 5
frequency3 / 1000 = 10
frequency4 / 1000 = 24
frequency5 / 1000 = 2
frequency6 / 1000 = 2
frequency7 / 1000 = 4

int cal1 = in1 + (in1 * (duration / 1000) / (frequency6 / 1000));
int cal2 = in1 + (in2 * (duration / 1000) / (frequency7 / 1000));
int cal3 = out1 +(out1 * (duration / 1000) / (frequency1 / 1000));
int cal4 = out2 +(out2 * (duration / 1000) / (frequency2 / 1000));
int cal5 = out3 +(out3 * (duration / 1000) / (frequency3 / 1000));
int cal6 = out4 +(out4 * (duration / 1000) / (frequency4 / 1000));
int cal7 = out5 +(out5 * (duration / 1000) / (frequency5 / 1000));

maximumY = (cal1) + (cal2) - (cal3) - (cal4) - (cal5) - (cal6) - (cal7);
  • 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-31T03:17:27+00:00Added an answer on May 31, 2026 at 3:17 am

    You can use long provided you want to perform integer arithmetic.

    Otherwise I would use double with appropriate rounding, or BigDecimal.

    You could simplify your code

    long cal6 = out4 +(out4 * (duration / 1000) / (frequency4 / 1000));
    

    is

    long cal6 = out4 +(out4 * 24 / (24));
    

    or

    long cal6 = out4 * 2;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is related to this one but I think should be asked separately.
Possible Duplicate: Packing 4 Integers as ONE BYTE? I have four integers { a
I have a file called Student.h which have the static integers in this way:
I have an integer variable ( time ) in one view controller whose value
I have two maps of type Map<Long, Integer>, one named oldValues representing the old
I'm using C# and I have many integers. I was wondering if there was
In my C# source code I may have declared integers as: int i =
I have a list of integers, List<Integer> and I'd like to convert all the
I have to use unsigned integers that could span to more than 4 bytes,
I have an array of integers: int[] number = new int[] { 2,3,6,7 };

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.