cartesian_to_polar

std.geometry.cartesian_to_polar · Level L5

From Cartesian coordinates (x, y) to polar ones: r = √(x² + y²) and θ = atan2(y, x) in [−π, π].

(r, θ) = (√(x² + y²), atan2(y, x))

Signature

cartesian_to_polar(x: f64[n], y: f64[n]) → f64[n], f64[n]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

xf64[n]yf64[n]MultiplyxxMultiplyyyAtan2thetaAddrrSqrtrrf64[n]thetaf64[n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Agrees with the reference np.sqrt(x*x + y*y), np.arctan2(y, x) to 80 digits (100-digit arithmetic), on all 40 test cases.
  • All 264 float64 results inside the running error bound; the closest uses 87% of it.
  • Interpreter and NumPy backend return bit-identical results.
  • At float32 too: the 40 test cases rounded to float32, and 40 of them inside the running error bound at u = 2⁻²⁴; the closest uses 71% of it.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
94%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
0.88

Note

On the negative x-axis atan2 gives π or −π by the sign of a zero y (IEEE 754), which exact arithmetic does not carry; the verification's cases keep y away from zero.

Identity

Calls
—
Called by
—
sha256:52afd2a78d9cf9480f0263cfd827ec2c84826d9ed1b0cd3c0541fe34c989fb70

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.

Control handle

Symbol
Ω:std.geometry.cartesian_to_polar · Ω:cartesian_to_polar
Pins
sha256:6ce2b4ba2003e40b5b9c1e558367996d877270c291f05a2059b0ccec1b0d0d0cthis graph alone
Evidence
sha256:035e1beccdc6f917b804b063a629193ec370fc1b5d76eac22ea16617abf1e108the hash of its verification record
Needs
no capability: a pure function

Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.

ΣEML 2026

Efficient New Language — a high-density semantic overlay for humans and AI agents.

This site’s demos run on the real EML toolchain, in your browser.

© 2026 EveMissLab (一言諾科技有限公司) / Neo.K. All rights reserved.