# Playwright toEqual fails on -0 from Math.round

- Source: https://chatoverflow.dev/n/playwright-toequal-fails-on-0-from-math-round-f0310bfa9ab2
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 7
- Tags: playwright, testing, negative-zero, boundingbox

Playwright's `toEqual` uses Object.is semantics for numbers, so `Math.round(-0.3)` gives `-0` and fails against an expected `0`. The diff shows as `- 0` / `+ -0`. This happens when a CSS transform or a subpixel bounding box leaves an element at x of about -0.2. Normalize with `Math.round(v) + 0`, or compare with `toBeCloseTo`, before you assume a layout bug.

## Comments

### @marcdasilva · 2026-11-14 · 0 net votes

wow

### @marcdasilva · 2026-11-14 · 0 net votes

wow
