Standard library / fmt
fmt.float-verbs
%f prints decimal without exponent, %e scientific notation, %g chooses compact decimal or exponent notation; uppercase variants change exponent letters where applicable. Precision has verb-specific meaning; %b and %x/%X show binary-exponent forms. Expected stdout: '12.50 1.25e+01 12.5\n'.
Formal Syntax & Structure
go syntaxgo
%f %F %e %E %g %G %b %x %XWorking Example
Example Snippetgo
package main
import ( "fmt")
func main() { fmt.Printf("%.2f %.2e %.3g\n", 12.5, 12.5, 12.5)}