LisaacTM Platform

NUMERIC


Generic number.
Inherit/Insert Summary
parent_object No developed.
 
Features
one
Neutral element for * and /.
zero
Neutral element for + and -.
Functions
in_range to
sign
Sign of Current (0 -1 or 1).
 
binary operator :
Infix '-'
Infix '*'
Infix '/'
? {other/=0}
Infix '+'
 
Unary operator
Prefix '+'
Prefix '-'
 
Compatibility Binary operator
Infix '-#'
Infix '*#'
Infix '/#'
Infix '+#'
Infix '>#'
Infix '<#'
Infix '<=#'
Infix '>=#'
Infix '==#'
 
Test binary operator :
Infix '>'
Infix '<'
Infix '<='
Infix '>='
Infix '=='
 
Switch case :
when then
when value equals Self, execute block You can chain "when ... then ..." between them like :
bar.when 1 then { // code }.when 2 then { // code 2 }
when or then
when value1 or value2 equal Self, execute block
when to then
Execute block when Self is in range of first_value to last_value
 
Looping.
to do
Classical loop from Self to limit_up
downto do
Classical backward loop from Self to limit_up
to by do
Classical loop from Self to limit_up stepping step
downto by do
Classical backward loop from Self to limit_up stepping step
to until do
Classical loop from Self to limit_up until test is TRUE
 
Conditionnal.
if else
Ternary C operator. Example: 3.if (a>b) else 4 (Python like) <=> in C : (a>b) ? 3 : 4
 
Function :
abs
Absolute value of Self.
min
Minimum between value of Self and other
max
Maximum between value of Self and other
 
Conversion for other type.
to_string
Convert the decimal view of self into a new allocated STRING. For example, if self is -1 the new STRING is -1.
to_boolean
TRUE if Self not zero
append_in
Append in the buffer the equivalent of to_string. No new STRING creation during the process.
to_string_format
Same as to_string but the result is on s character and the number is right aligned.
append_in format
Append the equivalent of to_string_format at the end of str. Thus you can save memory because no other STRING is allocate for the job.
append_in format with
Append the equivalent of to_string_format at the end of str. Thus you can save memory because no other STRING is allocate for the job.
 
Print
print
Print
print_format
Print with format size s
print_format with
Print with format size s replacing blank character by c
 
Conversions with tests
bound_test to
 
- To unsigned integers
to_uinteger_8
[ -? {bound_test (UINTEGER_8.minimum) to (UINTEGER_8.maximum)}; ]
to_uinteger_16
to_uinteger_32
to_uinteger_64
to_uinteger_big
to_uinteger
to_uinteger_cpu
 
- To signed integers
to_integer
to_integer_8
to_integer_16
to_integer_32
to_integer_64
[ -? {bound_test (INTEGER_64.minimum) to (INTEGER_64.maximum)}; ]
to_integer_big
 
- To unsigned fixed reals
to_ureal_16_16
to_ureal_24_8
to_ureal_26_6
 
- To signed fixed reals
to_real_16_16
to_real_24_8
to_real_26_6
 
- To float reals
to_real
to_real_32
to_real_64
to_real_80
 
Convertion format without test.
to_raw_integer
to_raw_uinteger
to_raw_uinteger_8
to_raw_uinteger_16
to_raw_uinteger_32
to_raw_uinteger_64
to_raw_uinteger_cpu
to_raw_integer_8
to_raw_integer_16
to_raw_integer_32
to_raw_integer_64
to_raw_real
to_raw_ureal_16_16
to_raw_ureal_24_8
to_raw_ureal_26_6
to_raw_real_16_16
to_raw_real_24_8
to_raw_real_26_6
to_raw_real_32
to_raw_real_64
to_raw_real_80
 

Inherit/Insert Detail

parent_object

.../base/number/low_level/numeric.li line #11

Section:
Inherit

Profile:
- SelfSELFparent_object : OBJECT

Features

one

.../base/number/low_level/numeric.li line #19

Section:
Public

Profile:
- SelfSELFone : SELF

Description:
Neutral element for * and /.

zero

.../base/number/low_level/numeric.li line #21

Section:
Public

Profile:
- SelfSELFzero : SELF

Description:
Neutral element for + and -.
Functions

in_range to

.../base/number/low_level/numeric.li line #27

Section:
Public

Profile:
- SelfSELFin_range   low : SELF  to   up : SELFBOOLEAN

sign

.../base/number/low_level/numeric.li line #30

Section:
Public

Profile:
- SelfSELFsign : INTEGER

Description:
Sign of Current (0 -1 or 1).

binary operator :

Infix '-'

.../base/number/low_level/numeric.li line #50

Section:
Public

Profile:
- SelfSELF- ' Left 80  other : SELFSELF

Infix '*'

.../base/number/low_level/numeric.li line #52

Section:
Public

Profile:
- SelfSELF* ' Left 100  other : SELFSELF

Infix '/'

.../base/number/low_level/numeric.li line #54

Section:
Public

Profile:
- SelfSELF/ ' Left 100  other : SELFSELF

Description:
? {other/=0}

Infix '+'

.../base/number/low_level/numeric.li line #56

Section:
Public

Profile:
- SelfSELF+ ' Left 80  other : SELFSELF

Unary operator

Prefix '+'

.../base/number/low_level/numeric.li line #62

Section:
Public

Profile:
- + ' SelfSELFSELF

Prefix '-'

.../base/number/low_level/numeric.li line #64

Section:
Public

Profile:
- - ' SelfSELFSELF

Compatibility Binary operator

Infix '-#'

.../base/number/low_level/numeric.li line #70

Section:
Public

Profile:
- SelfSELF-# ' Left 80  other : INTEGERSELF

Infix '*#'

.../base/number/low_level/numeric.li line #72

Section:
Public

Profile:
- SelfSELF*# ' Left 100  other : INTEGERSELF

Infix '/#'

.../base/number/low_level/numeric.li line #74

Section:
Public

Profile:
- SelfSELF/# ' Left 100  other : INTEGERSELF

Infix '+#'

.../base/number/low_level/numeric.li line #76

Section:
Public

Profile:
- SelfSELF+# ' Left 80  other : INTEGERSELF

Infix '>#'

.../base/number/low_level/numeric.li line #78

Section:
Public

Profile:
- SelfSELF># ' Right 60  other : INTEGERBOOLEAN

Infix '<#'

.../base/number/low_level/numeric.li line #80

Section:
Public

Profile:
- SelfSELF<# ' Right 60  other : INTEGERBOOLEAN

Infix '<=#'

.../base/number/low_level/numeric.li line #82

Section:
Public

Profile:
- SelfSELF<=# ' Right 60  other : INTEGERBOOLEAN

Infix '>=#'

.../base/number/low_level/numeric.li line #84

Section:
Public

Profile:
- SelfSELF>=# ' Right 60  other : INTEGERBOOLEAN

Infix '==#'

.../base/number/low_level/numeric.li line #86

Section:
Public

Profile:
- SelfSELF==# ' Right 60  other : INTEGERBOOLEAN

Test binary operator :

Infix '>'

.../base/number/low_level/numeric.li line #92

Section:
Public

Profile:
- SelfSELF> ' Right 60  other : SELFBOOLEAN

Infix '<'

.../base/number/low_level/numeric.li line #94

Section:
Public

Profile:
- SelfSELF< ' Right 60  other : SELFBOOLEAN

Infix '<='

.../base/number/low_level/numeric.li line #96

Section:
Public

Profile:
- SelfSELF<= ' Right 60  other : SELFBOOLEAN

Infix '>='

.../base/number/low_level/numeric.li line #98

Section:
Public

Profile:
- SelfSELF>= ' Right 60  other : SELFBOOLEAN

Infix '=='

.../base/number/low_level/numeric.li line #100

Section:
Public

Profile:
- SelfSELF== ' Right 60  other : EBOOLEAN

Switch case :

when then

.../base/number/low_level/numeric.li line #111

Section:
Public

Profile:
- SelfSELFwhen   value : SELF  then   block :{}SELF

Description:
when value equals Self, execute block You can chain "when ... then ..." between them like :
bar.when 1 then { // code }.when 2 then { // code 2 }

when or then

.../base/number/low_level/numeric.li line #120

Section:
Public

Profile:
- SelfSELFwhen   value1 : SELF  or   value2 : SELF  then   block :{}SELF

Description:
when value1 or value2 equal Self, execute block

when to then

.../base/number/low_level/numeric.li line #127

Section:
Public

Profile:
- SelfSELFwhen   first_value : SELF  to   last_value : SELF  then   block :{}SELF

Description:
Execute block when Self is in range of first_value to last_value

Looping.

to do

.../base/number/low_level/numeric.li line #140

Section:
Public

Profile:
- SelfSELFto   limit_up : SELF  do   blc :{ SELF; }

Description:
Classical loop from Self to limit_up

downto do

.../base/number/low_level/numeric.li line #150

Section:
Public

Profile:
- SelfSELFdownto   limit_down : SELF  do   blc :{ SELF; }

Description:
Classical backward loop from Self to limit_up

to by do

.../base/number/low_level/numeric.li line #159

Section:
Public

Profile:
- SelfSELFto   limit_up : SELF  by   step : SELF  do   blc :{ SELF; }

Description:
Classical loop from Self to limit_up stepping step

downto by do

.../base/number/low_level/numeric.li line #168

Section:
Public

Profile:
- SelfSELFdownto   limit_down : SELF  by   step : SELF  do   blc :{ SELF; }

Description:
Classical backward loop from Self to limit_up stepping step

to until do

.../base/number/low_level/numeric.li line #177

Section:
Public

Profile:
- SelfSELFto   limit_up : SELF  until   test :{ BOOLEAN}  do   blc :{ SELF; }

Description:
Classical loop from Self to limit_up until test is TRUE

Conditionnal.

if else

.../base/number/low_level/numeric.li line #191

Section:
Public

Profile:
- SelfSELFif   test : BOOLEAN  else   other : SELFSELF

Description:
Ternary C operator. Example: 3.if (a>b) else 4 (Python like) <=> in C : (a>b) ? 3 : 4

Function :

abs

.../base/number/low_level/numeric.li line #206

Section:
Public

Profile:
- SelfSELFabs : SELF

Description:
Absolute value of Self.

min

.../base/number/low_level/numeric.li line #218

Section:
Public

Profile:
- SelfSELFmin   other : SELFSELF

Description:
Minimum between value of Self and other

max

.../base/number/low_level/numeric.li line #230

Section:
Public

Profile:
- SelfSELFmax   other : SELFSELF

Description:
Maximum between value of Self and other

Conversion for other type.

to_string

.../base/number/low_level/numeric.li line #246

Section:
Public

Profile:
- SelfSELFto_string : STRING

Description:
Convert the decimal view of self into a new allocated STRING. For example, if self is -1 the new STRING is -1.

See:
append_in to save memory.

to_boolean

.../base/number/low_level/numeric.li line #257

Section:
Public

Profile:
- SelfSELFto_boolean : BOOLEAN

Description:
TRUE if Self not zero

append_in

.../base/number/low_level/numeric.li line #261

Section:
Public

Profile:
- SelfSELFappend_in   buffer : STRING

Description:
Append in the buffer the equivalent of to_string. No new STRING creation during the process.

to_string_format

.../base/number/low_level/numeric.li line #265

Section:
Public

Profile:
- SelfSELFto_string_format   s : SELFSTRING

Description:
Same as to_string but the result is on s character and the number is right aligned.

Require:
s size large enough for Self

Ensure:
s >= of size of stringed Self

See:
append_in_format to save memory.

append_in format

.../base/number/low_level/numeric.li line #285

Section:
Public

Profile:
- SelfSELFappend_in   str : STRING  format   s : INTEGER

Description:
Append the equivalent of to_string_format at the end of str. Thus you can save memory because no other STRING is allocate for the job.

append_in format with

.../base/number/low_level/numeric.li line #293

Section:
Public

Profile:
- SelfSELFappend_in   str : STRING  format   s : INTEGER  with   char : CHARACTER

Description:
Append the equivalent of to_string_format at the end of str. Thus you can save memory because no other STRING is allocate for the job.

Require:
str not null

Require:
s >= of size of stringed Self

Ensure:
size of str is equal to former str size plus s

Print

print

.../base/number/low_level/numeric.li line #318

Section:
Public

Profile:
- SelfSELFprint 

Description:
Print

print_format

.../base/number/low_level/numeric.li line #326

Section:
Public

Profile:
- SelfSELFprint_format   s : SELF

Description:
Print with format size s

print_format with

.../base/number/low_level/numeric.li line #334

Section:
Public

Profile:
- SelfSELFprint_format   s : SELF  with   c : CHARACTER

Description:
Print with format size s replacing blank character by c

Conversions with tests

bound_test to

.../base/number/low_level/numeric.li line #346

Section:
Public

Profile:
- SelfSELFbound_test   low : INTEGER_64  to   up : UINTEGER_64BOOLEAN

- To unsigned integers

to_uinteger_8

.../base/number/low_level/numeric.li line #356

Section:
Public

Profile:
- SelfSELFto_uinteger_8 : UINTEGER_8

Description:
[ -? {bound_test (UINTEGER_8.minimum) to (UINTEGER_8.maximum)}; ]

to_uinteger_16

.../base/number/low_level/numeric.li line #362

Section:
Public

Profile:
- SelfSELFto_uinteger_16 : UINTEGER_16

to_uinteger_32

.../base/number/low_level/numeric.li line #368

Section:
Public

Profile:
- SelfSELFto_uinteger_32 : UINTEGER_32

to_uinteger_64

.../base/number/low_level/numeric.li line #374

Section:
Public

Profile:
- SelfSELFto_uinteger_64 : UINTEGER_64

to_uinteger_big

.../base/number/low_level/numeric.li line #380

Section:
Public

Profile:
- SelfSELFto_uinteger_big : UINTEGER_BIG

to_uinteger

.../base/number/low_level/numeric.li line #385

Section:
Public

Profile:
- SelfSELFto_uinteger : UINTEGER

to_uinteger_cpu

.../base/number/low_level/numeric.li line #391

Section:
Public

Profile:
- SelfSELFto_uinteger_cpu : UINTEGER_CPU

- To signed integers

to_integer

.../base/number/low_level/numeric.li line #401

Section:
Public

Profile:
- SelfSELFto_integer : INTEGER

to_integer_8

.../base/number/low_level/numeric.li line #403

Section:
Public

Profile:
- SelfSELFto_integer_8 : INTEGER_8

to_integer_16

.../base/number/low_level/numeric.li line #409

Section:
Public

Profile:
- SelfSELFto_integer_16 : INTEGER_16

to_integer_32

.../base/number/low_level/numeric.li line #415

Section:
Public

Profile:
- SelfSELFto_integer_32 : INTEGER_32

to_integer_64

.../base/number/low_level/numeric.li line #421

Section:
Public

Profile:
- SelfSELFto_integer_64 : INTEGER_64

Description:
[ -? {bound_test (INTEGER_64.minimum) to (INTEGER_64.maximum)}; ]

to_integer_big

.../base/number/low_level/numeric.li line #427

Section:
Public

Profile:
- SelfSELFto_integer_big : UINTEGER_BIG

- To unsigned fixed reals

to_ureal_16_16

.../base/number/low_level/numeric.li line #437

Section:
Public

Profile:
- SelfSELFto_ureal_16_16 : UREAL_16_16

to_ureal_24_8

.../base/number/low_level/numeric.li line #443

Section:
Public

Profile:
- SelfSELFto_ureal_24_8 : UREAL_24_8

to_ureal_26_6

.../base/number/low_level/numeric.li line #449

Section:
Public

Profile:
- SelfSELFto_ureal_26_6 : UREAL_26_6

- To signed fixed reals

to_real_16_16

.../base/number/low_level/numeric.li line #459

Section:
Public

Profile:
- SelfSELFto_real_16_16 : REAL_16_16

to_real_24_8

.../base/number/low_level/numeric.li line #465

Section:
Public

Profile:
- SelfSELFto_real_24_8 : REAL_24_8

to_real_26_6

.../base/number/low_level/numeric.li line #471

Section:
Public

Profile:
- SelfSELFto_real_26_6 : REAL_26_6

- To float reals

to_real

.../base/number/low_level/numeric.li line #481

Section:
Public

Profile:
- SelfSELFto_real : REAL

to_real_32

.../base/number/low_level/numeric.li line #483

Section:
Public

Profile:
- SelfSELFto_real_32 : REAL_32

to_real_64

.../base/number/low_level/numeric.li line #488

Section:
Public

Profile:
- SelfSELFto_real_64 : REAL_64

to_real_80

.../base/number/low_level/numeric.li line #493

Section:
Public

Profile:
- SelfSELFto_real_80 : REAL_80

Convertion format without test.

to_raw_integer

.../base/number/low_level/numeric.li line #517

Section:
Public

Profile:
- SelfSELFto_raw_integer : INTEGER

to_raw_uinteger

.../base/number/low_level/numeric.li line #519

Section:
Public

Profile:
- SelfSELFto_raw_uinteger : UINTEGER

to_raw_uinteger_8

.../base/number/low_level/numeric.li line #521

Section:
Public

Profile:
- SelfSELFto_raw_uinteger_8 : UINTEGER_8

to_raw_uinteger_16

.../base/number/low_level/numeric.li line #523

Section:
Public

Profile:
- SelfSELFto_raw_uinteger_16 : UINTEGER_16

to_raw_uinteger_32

.../base/number/low_level/numeric.li line #525

Section:
Public

Profile:
- SelfSELFto_raw_uinteger_32 : UINTEGER_32

to_raw_uinteger_64

.../base/number/low_level/numeric.li line #527

Section:
Public

Profile:
- SelfSELFto_raw_uinteger_64 : UINTEGER_64

to_raw_uinteger_cpu

.../base/number/low_level/numeric.li line #529

Section:
Public

Profile:
- SelfSELFto_raw_uinteger_cpu : UINTEGER_CPU

to_raw_integer_8

.../base/number/low_level/numeric.li line #531

Section:
Public

Profile:
- SelfSELFto_raw_integer_8 : INTEGER_8

to_raw_integer_16

.../base/number/low_level/numeric.li line #533

Section:
Public

Profile:
- SelfSELFto_raw_integer_16 : INTEGER_16

to_raw_integer_32

.../base/number/low_level/numeric.li line #535

Section:
Public

Profile:
- SelfSELFto_raw_integer_32 : INTEGER_32

to_raw_integer_64

.../base/number/low_level/numeric.li line #537

Section:
Public

Profile:
- SelfSELFto_raw_integer_64 : INTEGER_64

to_raw_real

.../base/number/low_level/numeric.li line #539

Section:
Public

Profile:
- SelfSELFto_raw_real : REAL

to_raw_ureal_16_16

.../base/number/low_level/numeric.li line #541

Section:
Public

Profile:
- SelfSELFto_raw_ureal_16_16 : UREAL_16_16

to_raw_ureal_24_8

.../base/number/low_level/numeric.li line #543

Section:
Public

Profile:
- SelfSELFto_raw_ureal_24_8 : UREAL_24_8

to_raw_ureal_26_6

.../base/number/low_level/numeric.li line #545

Section:
Public

Profile:
- SelfSELFto_raw_ureal_26_6 : UREAL_26_6

to_raw_real_16_16

.../base/number/low_level/numeric.li line #547

Section:
Public

Profile:
- SelfSELFto_raw_real_16_16 : REAL_16_16

to_raw_real_24_8

.../base/number/low_level/numeric.li line #549

Section:
Public

Profile:
- SelfSELFto_raw_real_24_8 : REAL_24_8

to_raw_real_26_6

.../base/number/low_level/numeric.li line #551

Section:
Public

Profile:
- SelfSELFto_raw_real_26_6 : REAL_26_6

to_raw_real_32

.../base/number/low_level/numeric.li line #553

Section:
Public

Profile:
- SelfSELFto_raw_real_32 : REAL_32

to_raw_real_64

.../base/number/low_level/numeric.li line #555

Section:
Public

Profile:
- SelfSELFto_raw_real_64 : REAL_64

to_raw_real_80

.../base/number/low_level/numeric.li line #557

Section:
Public

Profile:
- SelfSELFto_raw_real_80 : REAL_80