---
title: "Round a number to a specified precision"
description: "Round numbers to a specific precision in TypeScript."
date: "2025-10-02"
tags: ["typescript","math","rounding","frontend"]
canonical: "/snippets/typescript/number/round-to-precision"
---

import { Code } from '@astrojs/starlight/components'
import Source from './round-to-precision.ts?raw'

## Round a number to a specified precision

<Code code={Source} lang="ts" title="round-to-precision.ts" wrap />
