Narra

Reference

std/float

std/float

64-bit floats: conversion, square root, truncation, text (reading and printing) and PI.

narra
import * as Float from "std/float"

The guide teaches it in chapter 2, Values and types.

This page is generated by scripts/std/generate.nra from narrac query --json interface std/float. Do not edit it.

Constants

PI

narra
export const PI: f64

Functions

from

narra
export function from<T>(value: T): f64

Effects: none.

fromInt

narra
export function fromInt(value: int): f64

Effects: none.

sqrt

narra
export function sqrt(value: f64): f64

Effects: none.

toFixed

narra
export function toFixed(value: f64, digits: int): Option<string> uses alloc

Effects: alloc.

toString

narra
export function toString(value: f64): string uses alloc

Effects: alloc.

truncate

narra
export function truncate(value: f64): Option<int>

Effects: none.

parse

narra
export function parse(text: string): Result<f64, string> uses alloc

Effects: alloc.