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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:11:26+00:00 2026-05-13T12:11:26+00:00

Im having a trouble with the flex calculation, im trying to transform a pixel

  • 0

Im having a trouble with the flex calculation, im trying to transform a pixel value to mm and reversing it.

Starting out with 69.8:

Calculating MM to pixel from: 69.8 mm
69.8*300 = 20940
20940 / 2.54 = 8244.094488188975
8244.094488188975 / 10 = 824.4094488188975

And calculating back:

Calculating pixel to MM from: 824.4094488188975
824.4094488188975/300 = 2.7480314960629917
2.7480314960629917 * 2.54 = 6.979999999999999
6.979999999999999 * 10 = 69.79999999999998

We wanted 69.8 but ended up with 69.79999999999998.
I tracked the proccess using simple windows calc and the first place it wents wrong is at 20940 / 2.54 = 8244.094488188975 wich should be 8244,094488188976.

Anny help on this would be great.

  • 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-13T12:11:26+00:00Added an answer on May 13, 2026 at 12:11 pm

    Ok, this is not as much a Flex question as it is about general programming. Have you ever wondered how exactly are numbers stored in the computer? The details are more in the real of mathematics, but I’ll try to put it simple. You know that there is an infinite number of different Real numbers (eg. like points on a continuous line), but in your computer you store everything as zeroes and ones, and a limited amount of them (32 or 64 “bits”). So now we have a problem – how to represent an unlimited amount of numbers in limited space. The idea used in the floating-point number (ones that can have values withe a “dot” like 1.03 or 4.2232) is that, because you can’t have them all, you round the number to the closest one you have.

    It’s a bit like remembering how much sugar someone puts in his coffee, you don’t remember that he likes to have 1.1232 table spoons of sugar, because the table spoon is just not that good in measuring the exact amount of stuff on it. You round it to one and it works fine most of the time.

    So with floating point numbers a similar idea stands, with an extra twist – the numbers are much more dense near 0 than away from it, where the “empty space” between them get’s really big. For example if you subtract 10000 from the maximal value a number can get it will still be the same, because there is no number as close to it that it makes a difference when looking for the closest one.

        trace (Number.MAX_VALUE == Number.MAX_VALUE-10000);
        //  returns "true"
        trace (200000 == 200000 - 10000);
        //  returns "false"
    

    So your problem comes from assuming that numbers are totally precise while they aren’t, you always get things rounded. The Number in as3 adheres to the double-precision IEEE-754 standard, and that’s how it decides which number it has and which it rounds.

    Look at this:

    trace (8244.094488188976);
    // returns "8244.094488188975"
    

    Further reading:

    Floating point

    IEEE_754-2008

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

Sidebar

Related Questions

I'm having trouble figuring out what my Flex Project is expecting from my PHP
I'm trying to port an existing AJAX app to Flex, and having trouble with
I'm having trouble finding any resource for adding ctrl-z undo capability to a Flex
I am having some trouble with the flex Tree control. I have a control
I'm new to Flex, and I've been trying to figure out how to use
Having trouble getting this syntax right: SELECT DISTINCT id FROM metadata WHERE (meta_key =
Having trouble with this -- a couple of other related posts out there, but
I'm having trouble vertical aligning text inside cells in a DataGrid in Flex. I
I'm having trouble accessing the value of the root node of an XML variable
I'm having trouble figuring out how to merge two of my projects. -- I've

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.