Jump to content

Can someone confirm my math?


Nabeel

Recommended Posts

  • Administrators

For conversions... I suck at these...

// Convert units from gallons to lbs
        if(self::$unit == 'lbs')
        {
            $result->jeta = $result->jeta / 6.4; // 6.4 pounds per gallon
            $result->lowlead = $result->lowlead / 6.4; 
        }
        elseif(self::$unit == 'kg' || self::$unit == 'kgs')
        {
            $result->jeta = ($result->jeta / 6.4) * .45359;
            $result->lowlead = ($result->lowlead / 6.4) * .45359; 
        }

Basically I start with the fuel price, per gallon. Then to convert to price per lb, divide by 6.4. To KG, I convert to lbs, then multiply by .45 to get to kg.

This correct, seems right?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...