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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:29:34+00:00 2026-06-06T16:29:34+00:00

First off, I know there are many different easier/reliable ways to perform what I

  • 0

First off, I know there are many different easier/reliable ways to perform what I am about to ask, but that is not the point of my question.

I am attempting to compare two sets of integers as if they were fractions. What I mean by this is suppose I have a 2d array:

int array[2][2];

array[0][0] = 2;
array[0][1] = 3;
array[1][0] = 1;
array[1][1] = 50;

How I want to treat these numbers is that the number in:

array[0][0] = 2 <— is the numerator

array[0][1] = 3 <— is the denominator

Or just 2/3 in this case. What I want to do is then compare the two fractions;

if(2/3 < 1/50){
  //blah blah blah code here
}

The caveat here is that I can not convert the numbers to floating point numbers to retain their accuracy or create a temporary floating point placeholder. Is there any way to compare these using only integer values?

I also don’t know exactly what I should tag for this question, if you think of something let me know and I’ll tag it.

  • 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-06T16:29:38+00:00Added an answer on June 6, 2026 at 4:29 pm

    Cross multiply the two numerators by one another’s denominators

    IE

    2/3 vs 1/50th: multiply 50 and 1 by 3 and multiply 2 and 3 by 50.

    Then you can compare the numerator without having to convert to a float.

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

Sidebar

Related Questions

First off, I know there are ways to make it so that text can
First off, I know that there are similar questions on SO, but I have
I know I can read off /proc/[id]/maps but I'm not sure if the first
First off: I know that AES is a block cipher and not a hashing
First off I want to start off saying that I don't know anything about
First off, I know the title is generic and not fitting. I just couldn't
First off, I know that this question begs the other question - should the
First, I know there are methods off of the generic List<> class already in
first off I'm going to say I don't know a whole lot about theory
First off all I know: Premature optimization is the root of all evil But

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.