Jump to content

problems with rounding


kryppienation

Recommended Posts

Howdy, I am having a problem here with rounding. I cannot seem to figure out what is going on.

 

Here is the code.

 

if($hardnesspicked == Stainless){
	$odpicked = 5;
	$tpi = .953;

	echo 'You have picked stainless steel on the kasto saw, the time per inch will be '.$tpi.'<p>';

	//let's do the math and get the PPH

	$mpp = $odpicked * $tpi;


	echo ''.$mpp.' MPP <p>';


	$mpp = round($mpp, 2);




	echo ''.$mpp.' formatted mpp<p>';



	$pph = 60 / $mpp;

	$pph = round($pph, 3);

	echo 'This Job will have a PPH = '.$pph.'.<p>';

}

 

 

Here is the output:

You have picked stainless steel on the kasto saw, the time per inch will be 0.953

 

4.765 MPP

 

4.76 formatted mpp

 

This Job will have a PPH = 12.605.

 

4.765 should be rounding up to 4.77

 

I cannot figure out what i am doing wrong and why this number is not rounding to 4.77 Can anyone help me figure this out?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.