---
title: "recommendFp64Flavor(): function in Emulated f64, TypeShade"
description: "recommendFp64Flavor, a function in Emulated f64. Pick the df64 flavour a device needs for correct results, from whatever identifying signals a host has."
url: https://typeshade.dev/api/recommendfp64flavor/
language: en
---

# `recommendFp64Flavor()`

Function in Emulated `f64`

Pick the df64 flavour a device needs for correct results, from whatever identifying signals a host has.

`import { recommendFp64Flavor } from 'typeshade'`
`import { recommendFp64Flavor } from 'typeshade/runtime'`

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

## Syntax

```ts
function recommendFp64Flavor(s: Fp64FlavorSignals): Fp64Flavor
```

## Parameters

**`s` `Fp64FlavorSignals`**

the device signals the host was able to collect.

## Return value

`Fp64Flavor`

`'integer'` on an Apple or Metal-backed context, `'float'` everywhere else.

## Description

Pass the result as `EmitOptions.fp64Flavor` to `packModule()`, or as `createDevice({ fp64Flavor })` or `configure({ fp64Flavor })` to the call layer (change 0073).

The flavour differs by device because of one operation. The df64 multiply relies on error terms that are algebraically zero, and a compiler allowed to reassociate can cancel them. On Apple GPUs, where Metal runs underneath whether the path is WebGPU or WebGL2 through ANGLE, the shader compiler defaults to fast math and collapses that multiply at any large-magnitude cancellation, and no in-shader barrier prevents it. `sin` and `cos` are built on that multiply, so they inherit the same fragility there. An Apple signal therefore selects `'integer'`, which does the same arithmetic through integer primitives fast math cannot touch, and every other device gets `'float'`, which is correct on those devices and cheaper.

D3D11 through ANGLE gets `'float'` as well. Its compiler can fold very deep synthetic df64 expression trees, but the float flavour’s renormalisation holds on the chains that occur in practice, and compiling the fully inlined integer bodies there is expensive enough to reset the device.

This helper does not query a GPU, so the signals come from the caller: a WebGPU adapter’s `info`, a WebGL2 `UNMASKED_RENDERER_WEBGL` string, a user agent. All are optional, any single Apple signal selects `'integer'`, and passing none returns `'float'`. The call layer collects actual-device signals automatically for `createDevice()` and `configure()` (0085). Use this helper for fixed shader text or an explicit policy override.

## Examples

### Example

```ts
import { recommendFp64Flavor, emitModule } from 'typeshade'

const fp64Flavor = recommendFp64Flavor({ adapterInfo: adapter.info, userAgent: navigator.userAgent })
const wgsl = emitModule(MODULE, { fp64Flavor })
```

## In the guide

- [fp64](https://typeshade.dev/guide/internals/fp64/)

## See also

- [`isAppleGpu`](https://typeshade.dev/api/isapplegpu/)
- [`f64T`](https://typeshade.dev/api/f64t/)

## Source

[`src/core/fp64/flavor-select.ts`, line 108](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/fp64/flavor-select.ts#L108), at commit af54ddad5
