Instruction
FSIN
Replaces ST(0), an angle in radians of magnitude below 2^63, with its sine; C2 reports an operand out of range.
- Extensions
- Forms
- 1 (1 Legacy)
- Data
- Intel XED v2026.08.23
FSIN replaces ST(0), an angle in radians, by its sine. FCOS takes the cosine, FSINCOS both (the sine in ST(1), the cosine on top), and FPTAN the tangent; they share FSIN’s range and its reduction of the angle.
Range
The angle must be smaller than 2^63 in magnitude. Otherwise FSIN sets C2 and leaves ST(0) as it was, with no exception: Zen 5 did so for 2^63 and computed a result for the next smaller number. Code that may see larger angles tests C2 after FSIN (FNSTSW) and reduces the angle itself, by a multiple of 2 * pi, before trying again. Infinities are invalid operations: IE, and with the exception masked the QNaN indefinite.
Accuracy, and the x87’s pi
Within its range FSIN reduces the angle by multiples of an internal pi of 66 bits, which Intel’s manual calls Pi, and only then approximates the sine. So what it computes is the sine of x * pi / Pi, whose period is 2 * Pi, not 2 * pi. Intel’s manual promises an error below 1 ulp (1.5 when not rounding to nearest) only for angles already reduced, and suggests reducing them in software to below about 3 * pi / 4. Near a nonzero multiple of pi, where the sine is small, the 66 bits run out: for pi rounded to 64 bits, Zen 5 returned exactly -2^-64, where the true sine is about -5.017 * 10^-20, 8 percent away. For reduced arguments the page’s pseudocode checks Zen 5’s results within 1 ulp (1.5 when not rounding to nearest), and the worst of its 27 recorded results was 0.47 ulp to nearest and 0.74 in the other modes.
From C
GCC 14 and Clang 23 at -O2 compile sinl(x) on a long double to a
call of the library. GCC emits fsin for it only with
-funsafe-math-optimizations (part of -ffast-math); Clang 23 calls
sinl even then. Neither uses it for sin on a double, which lives
in an SSE register.
Speed
AMD’s Zen 5 guide lists FSIN, like the other transcendental instructions, as microcoded. Intel’s optimization manual suggests that software implementations, in SSE or SSE2 where 80 bits are not needed, can be faster than the x87’s transcendentals (Sections 3.9.1 and 3.9.4).
Forms
| Instruction | Encoding | Requires |
|---|---|---|
FSIN
FSIN | D9 FE | FPU |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
x = st0
big = not less(abs(x), 2 ** 63) # |x| >= 2^63 (or no number)
if empty(st0):
underflow() # IE, SF, C1 = 0
st0 = INDEFINITE
c2 = 0
elif big and is_finite(x):
c1 = 0 # out of range: ST(0) stays
c2 = 1
else:
st0 = sin(x) # within 1 ulp (1.5 when not
c2 = 0 # rounding to nearest); Zen 5's 27
# recorded results: 0.47 at most to
# nearest, 0.74 in the other modes
c0 = c3 = UNDEFINED # Zen 5 keeps them
# sin(x) is the sine of x * pi / Pi, where Pi is the 66-bit pi by
# which the processor reduces x: near a multiple of pi the result is
# far from the sine of x (FSIN of pi rounded to 64 bits is -2^-64)Run on AMD Zen 5 (EPYC 9645): 48 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
FSIN | ||
ST(0) | implicit | read, write |
x87 status word | implicit | write |
Flags
| C0 | C1 | C2 | C3 |
|---|---|---|---|
| All forms | |||
| U | M | M | U |
Attributes
What else XED records about the forms. How to read.
- All forms
- may abort a TSX transaction
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
| ISA set | CPUID | Processors |
|---|---|---|
X87 | FPU | Every x86-64 processor in XED’s model and Zen 3 to Zen 6 |
More x87 instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s
-marchfeature sets and AMD’s Processor Programming References, which the page of each processor cites. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2A, page 3-380 (FSIN)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
- AMD64 Architecture Programmer's Manual, Volume 5: 64-Bit Media and x87 Floating-Point Instructions (26569, rev. 3.16, November 2021), Wayback Machine copy of AMD's PDF
- Intel 64 and IA-32 Architectures Optimization Reference Manual, Volume 1 (248966-051, October 2026)
- Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The text is our own.