Title: wp_fuzzy_number_match
Published: November 12, 2019
Last modified: May 20, 2026

---

# wp_fuzzy_number_match( int|float $expected, int|float $actual, int|float $precision = 1 ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#wp--skip-link--target)

Checks if two numbers are nearly the same.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#description)󠁿

This is similar to using `round()` but the precision is more fine-grained.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#parameters)󠁿

 `$expected`int|floatrequired

The expected value.

`$actual`int|floatrequired

The actual number.

`$precision`int|floatoptional

The allowed variation.

Default:`1`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#return)󠁿

 bool Whether the numbers match within the specified precision.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#source)󠁿

    ```php
    function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) {
    	return abs( (float) $expected - (float) $actual ) <= $precision;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/functions.php#L9054)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/functions.php#L9054-L9056)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_image_matches_ratio()](https://developer.wordpress.org/reference/functions/wp_image_matches_ratio/)`wp-includes/media.php` |

Helper function to test if aspect ratios for two images match.

  | 
| [image_resize_dimensions()](https://developer.wordpress.org/reference/functions/image_resize_dimensions/)`wp-includes/media.php` |

Retrieves calculated resize dimensions for use in [WP_Image_Editor](https://developer.wordpress.org/reference/classes/wp_image_editor/).

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_fuzzy_number_match/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_fuzzy_number_match%2F)
before being able to contribute a note or feedback.