[llvm-branch-commits] [llvm] [Dexter] Add ability to check float values within a range (PR #204161)

Orlando Cazalet-Hyams via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 24 02:13:28 PDT 2026


================
@@ -518,3 +519,110 @@ def representer(dumper, data: "Label"):
     def register_yaml(loader):
         yaml.add_constructor("!label", Label.constructor, loader)
         yaml.add_representer(Label, Label.representer)
+
+
+class Float:
+    """Used to match against float values that may have an approximate range.
+    There are four possible representations for a !float node, with/without a list of values and with/without a range:
+    - `!float <value>` - checks for an exact match using floating point equality, e.g. !float 10 will match 10.0.
+    - `!float <value>+-<range>` - checks for a match within the given range, e.g. !float 10 +- 0.2 will match any
+                                  value in the range [9.8, 10.2].
----------------
OCHyams wrote:

Possibly worth clarifying that `+` and `-` are not valid by themselves

https://github.com/llvm/llvm-project/pull/204161


More information about the llvm-branch-commits mailing list