---
title: "f32Lit(): function in Emit, TypeShade API reference"
description: "f32Lit, a function in Emit. Spell v as an f32 literal, in the form WGSL and GLSL share…"
url: https://typeshade.dev/api/f32lit/
language: en
---

# `f32Lit()`

Function in Emit

Spell v as an `f32` literal, in the form WGSL and GLSL share: an integer-looking value gets a .0 suffix so a float context never sees an integer literal.

`import { f32Lit } from 'typeshade'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
function f32Lit(v: number): string
```

## Parameters

**`v` `number`**

## Return value

`string`

## Exceptions

**[`SD0017`](https://typeshade.dev/reference/errors/sd0017/)**

[`SD0017`](https://typeshade.dev/reference/errors/sd0017/) if `v` is not finite. Neither WGSL nor GLSL has a NaN or Infinity literal, so `String(v)` would place an unparseable token in the module.

## Source

[`src/core/backends/wgsl/spelling.ts`, line 87](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/wgsl/spelling.ts#L87), at commit af54ddad5
