Jump to content

Recommended Posts

that would be % command :

 

$a = 26 % 10 // $a  =  6 
$a = 675 % 10 // $a = 5     

 

 

 

why whis comand dosn't work?

 

  if (0.0101< $a<=0.2000)

{

}

 

i don't think you could do whole in one that should be :

 

   if ( $a > 0.0101  &&  $a <= 0.2000)    //  $$ mean and , you can use  and too .
{
}

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/85159-dividing-a-number/#findComment-434468
Share on other sites

if (isset ($b))

{

if ($b=='rgbs' OR $b=='dlbs' || $b=='odbs' || $b=='xmbs' || $b=='xdeal' ||$b=='RGBS' || $b=='DLBS' || $b=='ODBS' || $b=='XMBS' || $b=='XDEAL' )

{

 

  if ($a<=0.0100)

         

                }

  if (0.0101< $a AND $a<= 0.2000)

 

$h=number_format($xmax % 10, 4, '.', '')

$xmax=number_format($xmax-$h; 4, '.', '')

 

 

 

                }

  if (0.2001<$a AND $a<=1.0000)

         

                }

  if (1.0001<$a AND $a<=5.0000)

         

                }

 

  if (5.0001<$a AND $a<=20.0000)

         

                }

  if (20.0000<$a)

         

                }

 

}

 

 

    }

 

 

this is what i have until now, it is complicated, not tehnical but work,

 

i will have 3 numbers, x xmin xmax, 

 

  xmin=x-15/100*x

  xmax=x+15/100*x

 

 

and those steps:   

x <0.0100        here x, xmin , xmax can grow with 0.0001

0.0101<x<0.2000  here x, xmin , xmax can grow with 0.0010

0.2001<x<1,0000  here x, xmin , xmax can grow with 0.0100

1.0001<x<5.0000  here x, xmin , xmax can grow with 0.0500

5.0001<x<20.0000  here x, xmin , xmax can grow with 0.1000

x<20.0000            here x, xmin , xmax can grow with 0.5000

 

 

the big problem is when for example

 

x= 0.1900

because xmax will go into the other step,

 

i'm working on it :)

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/85159-dividing-a-number/#findComment-434496
Share on other sites

if (0.0101< $a AND $a<= 0.2000)

 

$h=number_format($xmax % 10, 4, '.', '')

$xmax=number_format($xmax-$h; 4, '.', '')

 

 

    if ($xmax >0.2000)

{

      $h1=number_format($xmax % 10, 4, '.', '')

  $xmax=($xmax-$h1) /10

  $h2=number_format($xmax % 10, 4, '.', '')

  $xmax=(($xmax-$h2) /10)*100

 

 

}  

 

 

if ($xmin <= 0.101)

 

 

{

 

 

 

}

 

something like this i think it will work, still working on it

Link to comment
https://forums.phpfreaks.com/topic/85159-dividing-a-number/#findComment-434502
Share on other sites

if (0.0101< $x AND $x<= 0.2000)

 

if ($xmax <= 0.2000)

{

$xmax=$xmax*10000;

$h=$xmax % 10;

$xmax=$xmax - $h;

$xmax=$xmax/10000;

$xmax= number_format($xmax, 4, '.', '');

}

 

 

if ($xmin >0.0101)

{

$xmin=$xmin*10000;

$j=$xmin % 10;

$xmin=$xmin-$j;

$xmin=$xmin/10000;

$xmin= number_format($xmin, 4, '.', '');

}  

 

    if ($xmax >0.2000)

{

 

  $xmax=$xmax*10000;

      $h1=$xmax % 10;

  $xmax=($xmax-$h1) /10;

  $h2=$xmax % 10;

  $xmax=(($xmax-$h2) /10)*100;

  $xmax=$xmax/10000;

  $xmax= number_format($xmax, 4, '.', '');

 

}  

 

 

if ($xmin <= 0.101)

 

 

{

}

 

}

 

i've done this;

 

when all of $x, $xmin and $xmax are between 0.0101 and 0.2000 all it's ok,

but when $x is  0.1900 i get:

MAX  0.2300  good

x 0.1900  good

MIN 0.1421  bad

 

Link to comment
https://forums.phpfreaks.com/topic/85159-dividing-a-number/#findComment-434572
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.