# Since Chromium 148, Math.tanh Reveals the Underlying OS

A new signal in browser fingerprinting: Math.tanh

- **Source:** [Hacker News (news.ycombinator.com)](https://brifing.si/source/13c923cd-6d99-442b-9b8b-1181f4d8cd91)
- **Published:** 2026-07-12
- **Topic:** [Software & Engineering](https://brifing.si/c/engineering)
- **Original article:** <https://scrapfly.dev/posts/browser-math-os-fingerprint/>
- **On Brifing:** https://brifing.si/s/3cf0a47e-c924-4b43-8b8e-b5813f70222c

## Math.tanh and OS Relationship

Since Chromium 148, the Math.tanh function has become usable in browser fingerprinting due to OS-specific bit differences. This results in different outputs on Linux, macOS, and Windows.

## Source of Bit Differences

The results of the Math.tanh function depend on the OS's math library. Linux uses glibc, macOS uses libsystem_m, and Windows uses UCRT. These libraries create differences in the last bits of the results.

## Examples of Differences

The call Math.tanh(0.8) yields 0.6640367702678491 on Linux, 0.664036770267849 on macOS, and 0.6640367702678489 on Windows. These minor differences can be used to detect the OS.

## Pre-Chromium 148 Situation

Before Chromium 148, V8 computed Math.tanh internally, producing the same result across all OSes. This made OS detection impossible.

## V8's Changing Behavior

Starting with Chromium 148, V8 began computing Math.tanh using the platform's std::tanh function. This change revealed OS-specific bit differences.

## CSS vs JavaScript Difference

CSS trigonometric functions and JavaScript Math functions follow different code paths. CSS functions can produce different results by using the OS's math library.

## Two Math Libraries in macOS

On macOS, scalar libsystem_m and Accelerate framework's vector routines produce different results. This makes choosing the correct library challenging.

## Architectural Differences

ARM and x86 architectures behave differently regarding fused-multiply-add and NaN sign propagation. These differences can cause bit-level deviations in mathematical calculations.

## Security Vulnerability

Math.tanh revealing the OS creates a new security vulnerability in browser fingerprinting. This poses a risk to user privacy.

## Browser Matching Difficulty

Services like Scrapfly struggle to mimic Math.tanh's bit differences. This makes it harder to emulate real browsers.

## IEEE 754 and Mathematical Calculations

The IEEE 754 standard defines how double-precision numbers are stored but does not require functions like sin, cos, and tanh to be correctly rounded. This leads to different math libraries producing different results.

## Conclusion and Importance

Math.tanh revealing the OS provides a new tool in browser fingerprinting. This issue becomes significant for user privacy and security.

## Sources covering this story

- https://scrapfly.dev/posts/browser-math-os-fingerprint/ — 

---

_Summary written by Brifing from the original reporting. Copyright in the original article belongs to its publisher; read the full piece at the link above._
