INPUT /  OUTPUT /  LANGUAGE






inf tag

Category: ephemeral logic tag

Produces or tests for the value inf. This value corresponds to infinity and is often produced as a result of division by zero, although may be used in other places too.

Samplue usage

<inf> — produces the value inf itself.

<inf 52.5> — tests the value 52.5 and produces false since that value is not inf.

Fields

Primary field

Category: vector field

Optional. If specified, contains a list of 1 or more values to test for inf.

Behavior

The inf tag, when used without any field values, may be used to express the literal value inf anywhere it is required.

When at least one primary field value is specified, the tag functions in a different way: it tests values for being exactly the value inf.

Example

The following example tests if the result of a division in a financial formula is inf. If it is, it notifies the user that they have entered the wrong value.

<table
    <tabRow {Net profit},         {$}, <profit:input>>
    <tabRow {Initial investment}, {$}, <invst:input>>
></p>
<button {Calculate ROI} onClick=
    <roi:div|num profit,invst>,
    <if <inf roi>
        then={Investment can't be zero!</n>}
        else={Return on investment is <roi></n>}
    >
>

The example works as follows:

Sample console output when the user enters an incorrect numerical value:

Net profit$
100
Initial investment$
0

Calculate ROI
Investment can't be zero!