COSPI(3)
💖 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)returns1.cospi(±n/2)returns0for positive integersn.cospi(n)returns1for even integersn.cospi(n)returns-1for odd integersn.cospi(±∞)returns anNaNand raises anFE_INVALIDexception.cospi(NaN)returns anNaNand raises anFE_INVALIDexception.
🔗 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
- Copyright (c) 2017 Steven G. Kargl <kargl@FreeBSD.org>
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms