Skip to main content
๐ŸŽ“ Claude Code Masterclass Learn AI-assisted development on Udemy โ€” plus the companion book on Leanpub & Amazon. Start Learning
RISC-V floating-point and numerical computing discussion at RISC-V Summit Europe 2026
RISC-V

RISC-V Floating-Point Extensions: F, D, Q and More

How RISC-V does floating-point โ€” the F, D, and Q extensions, the f registers, rounding modes, and lightweight options like Zfh and Zfinx for small cores.

LB
Luca Berton
ยท 3 min read

Floating-point is where a lot of real computing happens โ€” graphics, signal processing, scientific code, and machine learning all lean on it. RISC-V handles it with the same philosophy it brings to everything else: a small mandatory base plus optional, composable extensions you add only when you need them. Here is how RISC-V floating-point fits together.

RISC-V floating-point and numerical computing discussion at the Summit

Floating-Point as an Extension

In the RISC-V world, even floating-point is optional. The base integer ISA has no FP at all โ€” perfect for a tiny controller that never needs it. When you do need real numbers, you add one or more floating-point extensions. This keeps small cores small while letting bigger chips scale up, which is exactly the modularity that makes RISC-V so adaptable.

The Precision Ladder: F, D, Q

The core FP extensions are named by precision, each building on the last:

ExtensionPrecisionWidth
FSingle32-bit
DDouble64-bit
QQuad128-bit

All follow the IEEE 754 standard, so results match what you would expect on other platforms. The common G shorthand (as in RV64GC) bundles the general-purpose set, which includes both F and D โ€” the combination most application software assumes.

The f Registers and Rounding Modes

When a core implements F/D/Q, it gains a separate bank of 32 floating-point registers (f0โ€“f31), distinct from the integer file. Floating-point arguments travel in these registers (fa0โ€“fa7) under a hard-float ABI. RISC-V also exposes the IEEE rounding modes (round-to-nearest, toward zero, up, down) via a control register and per-instruction fields, plus exception flags for inexact, overflow, and invalid operations โ€” everything numerical code needs to be correct and reproducible.

# double add: fa0 = fa0 + fa1
fadd.d  fa0, fa0, fa1

Hard-Float vs Soft-Float

What if a core has no FP hardware? Code still compiles โ€” the compiler emits soft-float library routines that emulate floating-point with integer instructions. It is slower, but it runs anywhere. With FP hardware present, you use hard-float and operations execute natively. This choice is baked into the ABI (for example lp64d selects LP64 with double-precision hard-float), so all linked objects must agree.

Lightweight Options: Zfh and Zfinx

RISC-V keeps adding smaller options for cost-sensitive designs:

  • Zfh โ€” half-precision (16-bit) FP. Half precision is a workhorse of AI inference and graphics, where full precision is wasted.
  • Zfinx โ€” puts floating-point values in the integer registers, eliminating the separate f register file to save silicon area on tiny cores.

These reflect RISC-Vโ€™s habit of offering exactly the right amount of capability for a given budget rather than forcing one heavy standard on everyone.

Beyond Scalar: Vectors

For throughput-heavy numerical work, scalar FP gives way to the Vector extension (RVV), which applies floating-point operations across whole arrays at once โ€” the foundation for high-performance and HPC workloads on RISC-V.

The Bottom Line

RISC-V treats floating-point the way it treats everything: modular and optional. Add F, D, or Q for single, double, or quad precision; reach for Zfh when half precision is enough and Zfinx when silicon area is precious; choose hard-float or soft-float to match your hardware. It is all IEEE 754, so your numbers behave โ€” and you only pay, in transistors and power, for the precision you actually use. That right-sizing is precisely why RISC-V scales from a sensor to a supercomputer.


Part of my RISC-V series. See also ISA extensions explained and the vector extension.

Frequently Asked Questions

What are the F, D, and Q extensions in RISC-V?

They are the floating-point extensions, named by precision. F adds single-precision (32-bit) IEEE 754 floating-point, D adds double-precision (64-bit), and Q adds quad-precision (128-bit). Each is optional and builds on the previous one, so a core can implement just what its workload needs. The popular G shorthand includes both F and D.

What is the difference between hard-float and soft-float on RISC-V?

Hard-float means the hardware has floating-point units and f registers, so FP operations run as native instructions. Soft-float means there is no FP hardware, so the compiler emits library routines that emulate floating-point with integer instructions. Soft-float is slower but lets code run on minimal cores; the choice is part of the ABI.

What is Zfh and why does it matter?

Zfh is the half-precision (16-bit) floating-point extension. Half precision saves memory and bandwidth and is widely used in machine-learning inference and graphics, where full precision is unnecessary. RISC-V also offers Zfinx, which puts floating-point values in the integer registers to save area on very small cores.

#RISC-V #floating-point #extensions #ISA #IEEE 754
Share:

๐Ÿ“ฌ Don't miss the next one

Get AI & Cloud insights delivered weekly

Join engineers getting practical tips on AI, Kubernetes, Ansible, and Platform Engineering.

Subscribe Free โ†’
Luca Berton โ€” AI & Cloud Advisor, Docker Captain

Luca Berton

AI & Cloud Advisor ยท Docker Captain ยท KubeCon Speaker

18+ years in enterprise infrastructure. Author of 8 technical books, creator of Ansible Pilot (1M+ YouTube views, 648K site users). Former Red Hat engineer. Speaker at KubeCon EU 2026 and Red Hat Summit 2026.

Free 30-min AI & Cloud consultation

Book Now