From 0f074e47029ec0312e236aa78c8fe05da9e31af2 Mon Sep 17 00:00:00 2001 From: alosslessdev Date: Thu, 5 Nov 2026 12:33:44 -0500 Subject: [PATCH] dax: note that Excel agrees on left-associative exponentiation (#2228) --- crates/dax/README.md | 4 ++-- crates/dax/src/ast.rs | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/dax/README.md b/crates/dax/README.md index 9db3384f4..cf5be4694 100644 --- a/crates/dax/README.md +++ b/crates/dax/README.md @@ -219,8 +219,8 @@ operator was written. `IN` is a comparison at the same level as `=`, so `1 + 2 I Microsoft's operator reference states that operators of equal precedence are ordered from left to right, and `^` shares no tier with another operator, so a chain groups left: `2^3^2` is `(2^3)^2` = -64. (Excel's worksheet engine answers 512 for the same text; this crate follows DAX.) Unary minus -binds looser than `^`: `-2^2` parses as `-(2^2)`. +64, the value Excel and Power Pivot produce as well. Unary minus binds looser than `^`: `-2^2` parses +as `-(2^2)`. ## Data types and static inference diff --git a/crates/dax/src/ast.rs b/crates/dax/src/ast.rs index 7c7bd9ae4..69fd8147c 100644 --- a/crates/dax/src/ast.rs +++ b/crates/dax/src/ast.rs @@ -231,8 +231,7 @@ impl BinaryOp { /// DAX binary operators all associate to the left. Microsoft's operator reference puts `^` in /// its own precedence tier and states that operators of equal precedence are ordered from left - /// to right, so `2^3^2` is `(2^3)^2` = 64. (Excel's worksheet engine groups the chain the other - /// way and answers 512; this crate implements DAX.) + /// to right, so `2^3^2` is `(2^3)^2` = 64 — the same value Excel and Power Pivot produce. pub const fn is_left_associative(self) -> bool { true }