EPIC Enhanced Programmable IRC-II Client

set floating_point_math

Synopsis

/set floating_point_math [on|off|toggle]

Default: off. With no value, set displays the current value. toggle reverses it; other values are rejected as invalid boolean settings.

Description

Controls whether numeric results converted to text retain a fractional part. When on, floating-point results can be represented with fractions. When off, those conversions discard the fractional part rather than rounding to the nearest integer.

This is not a switch that changes every arithmetic operation from integer to floating point. The expression evaluator already uses floating-point arithmetic for operations such as addition, multiplication, and division, while operations such as remainder and bitwise operations use integers. The setting affects conversion of results into the strings used by scripts, assignments, and output.

An intermediate fractional result can therefore remain available within an expression even when its final textual representation is truncated. Once a result is assigned or otherwise converted to text, discarded fractional information is not recovered by turning the setting on later.

Formatting and limits

Different numeric conversion paths use different formatting:

Thus floating_point_precision does not universally set expression-evaluator precision. Floating arithmetic is approximate, and conversion to text can lose precision even with this setting enabled. Functions that explicitly use integer results or their own formatting need not change behavior with this switch.

Changing the setting affects subsequent conversions, has no redraw callback, and sends no IRC request.

Example

/set floating_point_math on
/echo ${5.0 / 2.0}
/set floating_point_math off
/echo ${5.0 / 2.0}

The expression results are displayed as 2.5 and 2, respectively. Re-enable the setting if later script calculations require fractional results to survive textual conversion.

Source references