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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:05:53+00:00 2026-06-12T00:05:53+00:00

Possible Duplicate: How to convert floats to human-readable fractions? I have a floating point

  • 0

Possible Duplicate:
How to convert floats to human-readable fractions?

I have a floating point value say 0.595781 which I would like to get as close to as possible using a quotient that uses only integer numerator and denominator values which are both limited in range from 0 to 1023 (10-bits).

The intuitive way to do this (at least to start off) would be use 595/1000 which provides 0.555 a fairly close match (the error is 0.040781).

But there is a better match of 597/1002 which is 0.595808 (an error of 0.0000273). There may be better matches also. I came to the second quotient by playing about with the numerator and denominator values close to their original values in an irrerative way.

I then wondered if there was a way given all the criteria to get the numerator and denominator integer values directly.

In case your wondering the two integer values are required to setup the baud rate generator for an Infineon XE167G device.

Any ideas would be appreciated.
Regards

  • 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-12T00:05:54+00:00Added an answer on June 12, 2026 at 12:05 am

    If you are using 16-bit integers, you could just have numerator = 59578 and denominator just hold a power factor of 10, for instance 5. So the answer would be 59578/(10^5).

    With this approach you would at least keep 4 places of precision.
    Just a thought…

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

Sidebar

Related Questions

Possible Duplicates: How to convert floats to human-readable fractions? Convert decimal to fraction in
Possible Duplicate: 32-bit to 16-bit Floating Point Conversion How do I convert between 32-bit
Possible Duplicate: How to convert MDB to SQLite in Android I have an MS
Possible Duplicate: How to convert List<Integer> to int[] in Java? I have an ArrayList
Possible Duplicate: How can I convert a string to boolean in JavaScript? I have
Possible Duplicate: C# Cannot convert from IEnumerable<Base> to IEnumerable<Derived> I have D1 and D2
Possible Duplicate: Converting .NET DateTime to JSON How can I convert a date value
Possible Duplicate: Precision of Floating Point Can you compare floating point values exactly to
Possible Duplicate: Convert multidimensional array into single array I have this array: Array (
Possible Duplicate: Convert to absolute value in Objective-C As i am playing with 2d

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.