Percent! datatype

1. Abstract

Percent! values represent float! values expressed as percentages.

Percent! is a member of the following typesets: number!, scalar!

2. Creation

Percent! values can be created using literal syntax, or at runtime by using a make constructor or to conversion.

>> 100%
== 100%

>> 12.2%
== 12.2%

>> .76%
== 0.76%
>> make percent! 1
== 100%

>> make percent! .1
== 10%

>> make percent! .01
== 1%
>> to percent! 1
== 100%

>> to percent! .1
== 10%

>> to percent! .01
== 1%

3. Literal syntax

<percent-literal> ::= <integer-literal>% | <float-literal>%

4. Comparisons

All comparators can be applied on percent!: =, ==, <>, >, <, >=, <=, =?. In addition, min, and max are also supported.

5. Testing values

Use percent? to check if a value is of the percent! datatype.

>> percent? 42%
== true

Use type? to return the datatype of a given value.

>> type? 42%
== percent!

6. Predefined words

6.1. Functions

percent?, to-percent

results matching ""

    No results matching ""