Re: getting a number range from user input.. (weight)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Im thingking of putting the fixed value into an array and compare thru
< and > and get the fixed rate.


On Fri, 05 Nov 2004 14:38:17 +1100, Devraj Mukherjee
<lugs@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Well, I dont know if there is a function that can do this in PHP, but
> you could always split the number using the dot, and then compare the
> number that follows to make the decision.
> 
> (I am sure you knew that)
> 
> Devarj
> 
> 
> 
> 
> Louie Miranda wrote:
> > OK, here is what it should do.
> >
> > I have a fixed range of weights from .5 to 20.0 Kg (kilogram) and for
> > each weight it has a succeeding value, i cannot jump or just round off
> > the numbers. So i need a range detector to do it.
> >
> > Because for each of the item below:
> >
> >
> >>weight   value
> >>.5            9.45
> >>1.0         10.71
> >>1.5         11.97
> >>2.0         13.23
> >
> >
> > I must get the exact value, so let say for example. I have 1.3 it
> > should fall under 1.5 the idea i had was to do this, so i can detect
> > where the number should fall..
> >
> > range:
> > .0000 => .5
> > 1.001 => 1
> > 1.501 => 2
> > 2.001 => 2.5
> > 2.501 => 3
> > 3.001 => 3.5
> >
> > and so on..
> >
> > But i dont know how to do this on PHP
> >
> > Louie
> >
> > On Thu, 4 Nov 2004 20:23:53 -0700, Vail, Warren <warren.vail@xxxxxxxxxx> wrote:
> >
> >>Not sure I completely understand what you are trying to do.  In your
> >>problem, seems to me that both 1.3 and 1.6 would fall under 2.0 and neither
> >>of them would fall under 1.0.  You must be using some logic that I am not
> >>getting.  Can you be a little more specific?
> >>
> >>Warren Vail
> >>
> >>
> >>
> >>
> >>-----Original Message-----
> >>From: Louie Miranda [mailto:lmiranda@xxxxxxxxx]
> >>Sent: Thursday, November 04, 2004 7:09 PM
> >>To: php-general@xxxxxxxxxxxxx
> >>Subject:  getting a number range from user input.. (weight)
> >>
> >>How can i match a range of numbers from a given input?
> >>i tried round() but it rounds off the numbers to the next number, so that
> >>will be wrong.
> >>
> >>My example below show 4 examples of what my db tables looks like.
> >>
> >>weight   value
> >>.5            9.45
> >>1.0         10.71
> >>1.5         11.97
> >>2.0         13.23
> >>
> >>How can i get the range of:
> >>
> >>.1 to fall under .5 and
> >>1.3 to fall under 1.0 and
> >>1.6 to fall under 2.0
> >>
> >>and so on.. any ideas?
> >>
> >>--
> >>Louie Miranda
> >>http://www.axishift.com
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> >
> >
> 
> -- 
> ----------------------------------------------------------------------
> Devraj Mukherjee, Eternity Technologies Pty. Ltd. Australia
> Host: Debian (Sarge) 3.1 Kernel 2.4.27-1-686 / GCC version 3.3.5
> Target: LPD7A400 (ARM9) LogicPD eval. board / ARM GCC 3.3 GlibC 2.3.2
> LAMP environment specs. Apache: 2.0.52 PHP: 5 MySQL: 4.0.21
> ----------------------------------------------------------------------
> 


-- 
Louie Miranda
http://www.axishift.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux