Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can you please advise for convert decimal value in fraction using the 32nd ruler for measurement??

It would be grate if you can provide me coding for it.

Thank you!!
Posted
Comments
PIEBALDconsult 19-Jun-15 19:37pm    
Do you have a link to what the "32nd ruler for measurement" is?

1 solution

I guess you want to find the best fraction in 32nd of inch for a given value.
- Get your value: say 0.7
- Multiply by 32: 0.7 * 32 = 22.4
- round to closest integer: 22
your fraction is 22/32
after that you can reduce the fraction by dividing each part with the greatest common divider: GCD(22, 32) = 2
Reduced fraction is: (22/2) / (32/2) = 11/16
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900