cimag(3)

πŸ’– cimag β€” get the imaginary part of a complex number πŸ’–

okay bestie, so you know how complex numbers are like, a real part plus an imaginary part? yeah. this page is about grabbing that imaginary half. that's it, that's the whole job. it's giving "small but mighty". ✨


πŸ“š LIBRARY

Math library β€” you link it with -lm. don't forget her, she's not gonna link herself. πŸ’…


✨ SYNOPSIS ✨

#include <complex.h>

double cimag(double complex z);
float cimagf(float complex z);
long double cimagl(long double complex z);

🫢 DESCRIPTION

so these three functions return the imaginary part of the complex number z. that's it. that's the function. no drama, no plot twist, just vibes.

and fyi, this identity is literally always true:

z = creal(z) + I * cimag(z)

like… that's just what a complex number is. creal(z) gives you the real bit (cabs-girlies know), I * cimag(z) gives you the imaginary bit, add them up and boom, you got z back. math ate and left no crumbs. 🌈


🧡 ATTRIBUTES

if you're like "bestie what does attribute even mean here", go read attributes(7) for the whole explanation. no cap.

here's the tea for these specific functions:

  • cimag(), cimagf(), cimagl() β€” Thread safety: MT-Safe βœ…

so yeah, they're MT-Safe. thread-safe. go wild (responsibly). πŸ¦‹


🌸 VERSIONS

fun fact: GCC also supports __imag__. but heads up bestie β€” that one is a GNU extension, so it's not the standard flex. ⭐


πŸ‘‘ STANDARDS

  • C11
  • POSIX.1-2008

periodt. πŸ’…


πŸŽ€ HISTORY

  • glibc 2.1
  • C99
  • POSIX.1-2001

so she's been around a while. iconic behavior honestly. πŸ”₯


πŸ‘€ SEE ALSO


reminder: this page is about cimag, cimagf and cimagl. don't rock up trying to call cimag() on a plain double β€” she needs an actual complex number, bestie. πŸ’€

okay that's the whole page!! πŸ“ and for the cute lil sign-off: this one came from the Linux man-pages 6.20 era, dated 2026-02-08. mwah. πŸ’–βœ¨πŸŽ€

πŸ“¦ 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms