## `Pref::floatFormat` -- representation of floating point numbers

#### Introduction

`Pref::floatFormat` controls the representation of floating point numbers.

#### Call(s)

`Pref::floatFormat( <modus>)`

#### Parameters

`modus` | - | the kind of representation as character `"e"`, `"f"`, `"g"` or `"h"`, or `NIL`

#### Returns

the previously defined representation

#### Related Functions

`DIGITS`, `Pref::trailingZeroes`, `print`

#### Details

- The argument of `Pref::floatFormat` can be one of `"e"`, `"f"`, `"g"` and `"h"`. These are the standard `C`-command `printf` switches.
- The meaning is:
  "e"
    exponential representation
  "f"
    decimal representation without exponents
  "g"
    mix between `"e"` and `"f"`, only numbers less than `2^-32` will be displayed with exponential representation
  "h"
    hexadecimal representation
- The default value is `"g"` (see examples).
- A call of `Pref::floatFormat` without arguments returns the current value. The argument `NIL` resets the default value, which is `"g"`.

#### Example 1

The default display:

    >> Pref::floatFormat(NIL):
       12345.67890, 0.00012345

                              12345.6789, 0.00012345

The exponential representation:

    >> Pref::floatFormat("e"):
       12345.67890, 0.00012345

                              1.23456789e4, 1.2345e-4

The mixed representation:

    >> Pref::floatFormat("g"):
       12345.67890, 0.00000000012345

                           12345.6789, 0.00000000012345

Hexadecimal display:

    >> Pref::floatFormat("h"):
       12345.67890, 0.00012345

          0x0.CE6B7318FC50481*2^(0x00000E),

             0x0.81725B672EE3425A*2^(-0x00000C)

#### Changes

- The character `"h"` can be used instead of `"x"` to switch to hexadecimal representation.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000