FloatToMoney (open)

Casts a FLOAT value to a MONEY value.

Syntax

LOADLIB "wh::money.whlib";

MONEY FUNCTION FloatToMoney(FLOAT value)

Parameters

FLOAT value

The FLOAT value to be converted

Return value

MONEY

The MONEY value of value

Description

This function can be used to convert a FLOAT to a MONEY value. When the FLOAT value is too big or precise to fit into a MONEY, it flows over or precision is lost, so you should make sure the FLOAT value is in the MONEY range.

Examples

// The MONEY value will be 1.2345
MONEY m := FloatToMoney(1.2345);

// The MONEY value will be 1.23456. As a MONEY variable can have up
// to 5 decimals, the last decimals are lost.
MONEY m := FloatToMoney(1.23456789)