Jump to content

assigning infinite amount to variable


stijn0713

Recommended Posts

No there is no 'infinite' rvalue in PHP.

 

 

function unsigned($int)
{
   return ($int < 0) ? (~(int)$int) + 1 : (int)$int;
}
$i = 25;
$n = -55;
$i = unsigned($n) + 1;
if ( $i < unsigned($n) )
{
   // this effectively does what you ask for, but what's the point?
}

i have a 2 dim array where i divide column a by column b. I need the key of b where the division a/b is the closest to zero.

 

So i first check if b is > 0, (otherwise i can't divide), if not, i want to assign 'infinite' as result of the division. Because if i don't store anything, i don't know how to keep track of the key where i'm currently at.

 

So i assign each division to an array, and if b < 0, i tried to assign -log(0) (as 'infinite'). But if i check for the lowest value in that array than, it doesn't appear to work.

 

With this is mind, maybe it clears out the problem a little bit, because i don't see how your function could help me.

 

thanks in advance

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.