in reply to Money Regex

Correct me if I'm wrong, but after looking at your example cases, i would most likely suggest:
use POSIX; ... crashNburn() if (floor($cash*100) != $cash*100);

AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.

Replies are listed 'Best First'.
Re: Re: Money Regex
by I0 (Priest) on Feb 06, 2001 at 02:58 UTC
    This can fail depending on how $cash*100 rounds
    If your processor uses ANSI/IEEE 754-1985 floating point numbers, try floor(100*1.14)
      Except that there shouldn't be anything there to affect the rounding. Everything greater than the hundreth place should be zero as described in the examples.
      AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
        That's fine if FLT_RADIX on your machine is 10, but if your FLT_RADIX happens to be something like 2, the hundreth place may be inexact, except at .00 .25 .50 or .75