[ANNOUNCE] Test::Float -- compare numbers to specified precision

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
    Test::Float - Compare if two numbers are equal within a specified

      # Default precision
      use Test::Float;
      cmp_float( 1e-5, 2e-5, 'values within 1e-6'); # not ok
      # Specific precision
      use Test::Float within => 1e-5;
      cmp_float( 1e-5, 2e-5, 'values within 1e-5'); # ok

    Most programmers at one time or another are confronted with the issue of
    comparing floating-point numbers for equality. The canonical idiom is to
    test if the absolute value of the difference of the numbers is within a
    desired precision. This module provides such a function for use with
    Test::Harness. Usage is similar to other test functions described in
    Test::More. Semantically, the "cmp_float" function replaces this kind of

     ok ( abs($p - $q) <= $precision, '$p is equal to $q' ) or
         diag "$p is not equal to $q to within $precision";

    While there's nothing wrong with that construct, it's a pain to type it
    repeatedly in a test script. This module does the same thing with a
    single function call.

    By default, "use Test::Float" will compare equality with a precision of
    1e-6. (An arbitrary choice on my part.) To specific a different
    precision, provide a "within" parameter when importing the module with

     use Test::Float within => 1e-9;

     cmp_float( $p, $q, '$p and $q are equal' );

    This test compares equality within the precision specified during import
    (or the default of 1e-6). The test is true if the absolute value of the
    difference between $p and $q is less than or equal to the precision. If
    the test is true, it prints an "OK" statement for use in testing. If the
    test is not true, this function prints a failure report and diagnostic.

    Please report bugs using the CPAN Request Tracker at

     David A. Golden (DAGOLDEN)
     http://dagolden.com /

    Copyright (c) 2004 by David A. Golden

    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

    The full text of the license can be found in the LICENSE file included
    with this module.

    Test::More, Test::Harness, Test::Builder

Re: [ANNOUNCE] Test::Float -- compare numbers to specified precision

add the reduced broth.
Finally, put in the root vegetables and simmer for 15 minutes.
Allow to cool slightly.
Place the pie pan in 375 degree oven for a few minutes so bottom crust is not
   reduce oven to 325.
Fill the pie with stew, place top crust and with a fork, seal the crusts
   then poke holes in top.
Return to oven and bake for 30 minutes, or until pie crust is golden brown.

Sudden Infant Death Soup

SIDS: delicious in winter, comparable to old fashioned Beef and Vegetable Soup.
Its free, you can sell the crib, baby clothes, toys, stroller... and so easy to
procure if such a lucky find is at hand (just pick him up from the crib and
he?s good to go)!

SIDS victim, cleaned
cup cooking oil
whole cabbage
fresh green beans
stick butter
1 cup cooked pasta (macaroni, shells, etc.)

Remove as much meat as possible, cube, and brown in hot oil.
Add a little water, season, then add the carcass.
Simmer for half an hour keeping the stock thick.
Remove th

Site Timeline