Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - Français

Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Aide de Scilab >> Fonctions Elémentaires > Virgule flottante > number_properties

number_properties

determine floating-point parameters

Syntax

pr = number_properties(prop)

Arguments

prop

string

pr

real or boolean scalar

Description

This function may be used to get the characteristic numbers/properties of the floating point set denoted here by F(b,p,emin,emax) (usually the 64 bits float numbers set prescribe by IEEE 754). Numbers of F are of the form:

sign * m * b^e

e is the exponent and m the mantissa:

$$
            m = d_1 \cdot b^{-1} + d_2 \cdot b^{-2} + \ldots + d_p \cdot b^{-p}
            $$

$d_i$ the digits are in [0, b-1] and e in [emin, emax], the number is said "normalized" if $d_1 \neq 0$. The following queries may be used:

prop = "radix"

then pr is the radix b of the set F

prop = "digits"

then pr is the number of digits p

prop = "huge"

then pr is the max positive float of F

prop = "tiny"

then pr is the min positive normalized float of F

prop = "denorm"

then pr is a boolean (%t if denormalized numbers are used)

prop = "tiniest"

then if denorm = %t, pr is the min positive denormalized number else pr = tiny

prop = "eps"

then pr is the epsilon machine ( generally ($\dfrac{b^{1-p}}{2}$) which is the relative max error between a real x (such than |x| in [tiny, huge]) and fl(x), its floating point approximation in F

prop = "minexp"

then pr is emin

prop = "maxexp"

then pr is emax

This function uses the lapack routine dlamch to get the machine parameters (the names (radix, digit, huge, etc...) are those recommended by the LIA 1 standard and are different from the corresponding lapack's ones).
Sometimes you can see the following definition for the epsilon machine : $eps = b^{1-p}$ but in this function we use the traditional one (see prop = "eps" before) and so $eps = \dfrac{b^{1-p}}{2}$ if normal rounding occurs, and $eps = b^{1-p}$ otherwise.

Examples

b = number_properties("radix")
eps = number_properties("eps")

See also

  • nearfloat — get previous or next floating-point number
  • log2 — logarithme en base 2
  • -0 — Processing of -0 versus 0
Report an issue
<< nextpow2 Virgule flottante round >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:50:19 CET 2020