How can I display a value in decimal feet as “Feet and Inches”. eg 8’ 7/16"
I am making an oil tank monitoring system for a friend who has a small oil well lease in Texas and he wants to use Feet and Inches as the display option so as not to confuse his local guy.
The software actually has Meters, Feet and Inches as display options (why everyone is not all metricated these days sure makes our programming tasks more elaborate)
I am trying to come up with a way to display the reading but getting strange things like 2/5" which is not ideal. I’d like to round this to the nearest 1/16"
Converting back from feet and inches input was easy enough.
Would they not be happy with feet+decimal_inches? Working out fractional inches is a real pain. I don’t think I have ever seen this on a computer program. How do you decide what the denominator should be! You would have to have a list of preferred values and select the one that gave the most accurate result.
The former is very similar to converting decimal latitudes to degree+minutes+seconds. There are loads of examples of this on the net.
I have it as decimal feet and inches already but the client asked for it to be shown as feet and fraction of inches. The values internally are all decimal, it was just the display he wanted changed.
@ Jason. I am getting an error with Math.Round and it states there is no overloaded option that takes to parameters. Round for me only takes 1 parameter.
Is that code full NET or NETMF?
I also don’t have the System.Linq or System.Collections.Generic that shows in your listing.
The code was a good start and as I needed FEET and INCHES displayed, I reworked it and I know have a reading to the nearest 1/4". 1/16" was just too fine.