csqrt(3)
π csqrt β complex square root, but make it cute
okay bestie so like. the manual name is csqrt and she is the math girlie for square roots, but for complex numbers β¨. her whole friend group is csqrt, csqrtf, and csqrtl π«Ά
π LIBRARY
Math library (libm, link it with -lm) β yes you have to actually link it, no cap. π
β¨ SYNOPSIS
#include <complex.h>
double complex csqrt(double complex z);
float complex csqrtf(float complex z);
long double complex csqrtl(long double complex z);
like. three of them. same vibe, different precision π¦
π DESCRIPTION
so these functions find the complex square root of z. iconic behaviour, honestly. π₯
but here's the tea β β there's a branch cut running along the negative real axis. and the way that works is:
csqrt(-1+eps*I)is gonna land close toIcsqrt(-1-eps*I)is gonna land close to-I
β¦as long as eps is a small positive real number. so like, you approach that negative real axis from above β you get one answer. from below β you get the other one. the discontinuity is just there, and she's not sorry π
that's the math, periodt.
πΈ ATTRIBUTES
ngl if you don't know what these words mean, go read attributes(7) β it's giving required reading π
csqrt(),csqrtf(),csqrtl()β Thread safety: MT-Safe π β so you can call her from multiple threads and she will not have a meltdown. obsessed.
(the original had a whole cute little table for this. this is the table. it's one row. she ate. π)
β STANDARDS
C11, POSIX.1-2008. certified and official bestie π
π§ HISTORY
- glibc
2.1β that's when she first showed up on the scene β¨ - And she's been around since
C99andPOSIX.1-2001, so like, a legacy icon fr fr π
π SEE ALSO
go hang out with her friends:
lowkey reminder: that branch cut is not a bug, it's a feature. don't come for her. π«Ά
csqrt(3) comes to you from Linux man-pages 6.20, dated 2026-02-08 β mwah, love that for her, that's the whole page bestie, go compute something slay π πβ¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-1.0-or-later
- Copyright 2002, Walter Harms <walter.harms@informatik.uni-oldenburg.de>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms