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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:40:39+00:00 2026-05-30T16:40:39+00:00

I’m developing an Android game. At the moment I’m writing code that should calculate

  • 0

I’m developing an Android game. At the moment I’m writing code that should calculate the best route between two objects, using the A* algorithm. Inside the algorithm i’m using doubles to calculate everything.

When running time consuming algorithms on my computer the time difference between calculating with Integers and Doubles is almost zero (maybe a few nanoseconds).

Question one:

Can this behavior also seen on Android phones? I know my computer has multiple ALU’s one for integers on for floating points etc. But how about phones? Android phones can be very different when it comes down to hardware. I only have two test phones, but today there are hundreds of phones available on the market, which means that running tests on two of my phones would not give me reliable data, at least that’s what I think.

Question two:

For my game it doesn’t matter allot if I switch to Integers, the calculated route maybe less perfect but that doesn’t bother me. So is it worth switching to integers? Or would switching to integers break the algorithm? Does anyone have experience with this?

  • 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-30T16:40:40+00:00Added an answer on May 30, 2026 at 4:40 pm

    As a general rule of thumb, integer arithmetic is faster than floating point arithmetic because it is simpler to implement. (With floating point, the hardware has to deal with both the mantissa and exponent parts, and (AFAIK) it cant do this in parallel.)

    However, the performance ratio is going to vary from one hardware implementation to the next, and it is hard to make predictions that are any better than guessing. (For a start, it depends on marketing strategies and performance vs battery life tradeoffs.)


    But to be honest, I’d be focusing more on which of integer and floating point is going to work best with your game’s algorithms. If they require one and you use the other, then you are in for a lot of pain (unnecessary coding, testing, bug fixing, etc).

    Or do you guys think switching to integers will break the algorithm?

    It could do. It could also make them a lot more complicated. It all depends on the nature of the algorithms. Certainly, you are in for a lot of recoding and retesting.

    Personally, I’d only contemplate doing this if the game was simply too slow even after I’d tried profiling and tuning the performance hotspots. And I’d only do it if I was prepared to take the risk that the re-coding effort might achieve no benefit … or worse.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
I am writing an app with both english and french support. The app requests
I'm having trouble keeping the paragraph square between the quote marks. In firefox the

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.