We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

get location – fractions

Home Forums General Questions get location – fractions

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #59670
    bigmike814
    Customer

    Hello,

    I am working on a configurator and was wondering if anyone knows how to convert the output to feet and inches or even a fraction of a foot. For example, if my output is 12.25 I would like the annotation to display 12’4″ or 12 1/4′. Anyone had this struggle in the past that can help me?

    Thanks in advance,

    Michael

    #59671
    bigmike814
    Customer

    I figured it out so figured I better post the answer.

    Attachments:
    You must be logged in to view attached files.
    #59682
    Pandern
    Customer

    Hi,

    I believe the math is wrong in your solution and it will give an output that is way off. It is 39.37 inches in a meter so the correct math would be like this:

    feet = Math.floor(meters * 39.37)/12
    remainding inches = (meters * 39.37) mod 12 (use the puzzle remainder of to get the modulo operator)

    1 meter in your method returns 3'36" while the correct answer is 3'3.4". The error in the returned value is exponential. 12 meter would return the value 36'431.7" while correct would be 39'4.4"

    Se the images how I would do it with puzzles

    Attachments:
    You must be logged in to view attached files.
    #59685
    Pandern
    Customer

    Here are a couple of ways to get even more precise output with fractions:

    1 meter returns this string: 3'3 6/16"
    12 meter returns this string: 39'4 7/16"

    :)

    Attachments:
    You must be logged in to view attached files.
    #61005
    bigmike814
    Customer

    Thanks Pandern, I got it dialed it in. Thanks for your help. Cheers!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.