50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
= Expr
|
|
Expressions calculator
|
|
:authors: Celestino Amoroso
|
|
:docinfo: shared
|
|
:encoding: utf-8
|
|
:toc: right
|
|
:toclevels: 4
|
|
//:toc-title: Indice Generale
|
|
:icons: font
|
|
:icon-set: fi
|
|
:numbered:
|
|
//:table-caption: Tabella
|
|
//:figure-caption: Diagramma
|
|
:docinfo1:
|
|
:sectlinks:
|
|
:sectanchors:
|
|
:source-highlighter: rouge
|
|
// :rouge-style: ThankfulEyes
|
|
:rouge-style: gruvbox
|
|
// :rouge-style: colorful
|
|
//:rouge-style: monokay
|
|
|
|
toc::[]
|
|
|
|
== Expr
|
|
_Expr_ is a GO package capable of analysing, interpreting and calculating expressions.
|
|
|
|
=== Data types
|
|
_Expr_ supports numerical, string, relational, and boolean expressions.
|
|
|
|
==== Numbers
|
|
Numbers can be integers (GO int64) and float (GO float64). In mixed operations involving integers and floats, integers are automatically promoted to floats.
|
|
|
|
.Arithmetic operators
|
|
[cols="1,2,4,4"]
|
|
|===
|
|
| Symbol | Operation | Description | Examples
|
|
|
|
| `+` / `-` | _change sign_ | Change the sign of values | `-1` [-1], `-(+2)` [-2]
|
|
|
|
| `+` | _sum_ | Add two values | `-1 + 2` [1], `4 + 0.5` [4.5]
|
|
|
|
| `-` | _subtracion_ | Subtract the right value from the left one | `3 - 1` [2], `4 - 0.5` [3.5]
|
|
|
|
| `*` | _product_ | Multiply two values | `-1 * 2` [-1], `4 * 0.5` [2.0]
|
|
|
|
|===
|
|
|
|
==== String
|