COSPI(3)

📦
version 15.1 · 2 versions
, in freebsd 15.1

💖 NAME 💖

okay bestie, welcome to COSPI(3) from the Library Functions Manual — the half–cycle cosine functions are here and they are iconic 💅

cospi, cospif, cospil — half–cycle cosine functions. That's the whole NAME vibe: these are the half–cycle cosine girlies.

📚 LIBRARY 📚

Math Library (libm, -lm). libm girlies, no cap.

✨ SYNOPSIS ✨

Here's the exact include + signatures, bestie — copy-paste energy only:

#include <math.h>

double
cospi(double x);

float
cospif(float x);

long double
cospil(long double x);

🌸 DESCRIPTION 🌸

Okay so the cospi(), cospif(), and cospil() functions compute the cosine of π × x. and measure angles in half-cycles. Half-cycles, not full cycles — iykyk.

🎀 RETURN VALUES 🎀

The cospi(), cospif(), and cospil() functions return cos(π × x). If |x| ≥ 2^(p - 1) where p is the floating–point precision of x, then the returned value is 1 and it has no significance. No significance means no significance, bestie — don't build your whole personality on that result.

🦋 SPECIAL VALUES 🦋

vibe check on the special values:

  • cospi(±0) returns 1.
  • cospi(±n/2) returns 0 for positive integers n.
  • cospi(n) returns 1 for even integers n.
  • cospi(n) returns -1 for odd integers n.
  • cospi(±∞) returns an NaN and raises an FE_INVALID exception.
  • cospi(NaN) returns an NaN and raises an FE_INVALID exception.

🔗 SEE ALSO 🔗

Go read these too, iykyk:

👑 AUTHORS 👑

The half–cycle trignometric functions were written by Steven G. Kargl <kargl@FreeBSD.org>. Respect the author, bestie.

🌈 STANDARDS 🌈

The standards sentence is literally this, weird commas and all:

These functions conform to , to ISO/IEC TS 18661-4, "Information technology — Programming languages, their environments, and system software interfaces — Floating–point extensions for C" — Part 4: Supplementary functions, and to .

mwah 💋 — this page is a Debian joint dated November 16, 2025, and it's the COSPI(3) manual page. byeee 🫶

📦 where this page comes from
  • freebsd 15.1: base 15.1
  • 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms