fend is an arbitrary-precision unit-aware calculator. If you haven’t already, head to https://printfn.github.io/fend to use the online version, or click here to learn how to install fend on your computer.
You can check your version of fend at any time by typing
version
. If you are using the command-line interface, you
can also run fend --version
.
You can use fend without installing by visiting https://printfn.github.io/fend.
If you want to install the fend command-line application, you have the following options:
On Windows, you can install fend with a standard Windows installer package (MSI), which you can download here.
Alternatively you can install fend via winget
:
winget install fend
Or using Chocolatey:
choco install fend
fend is available on Homebrew:
brew install fend
fend can also be installed via MacPorts:
sudo port install fend
fend is available on the AUR:
yay -Syu aur/fend-bin
You can also build it from source with:
yay -Syu aur/fend
fend is available in the official Void Linux package repository:
xbps-install fend
fend is available in the official AOSC OS package repository:
oma install fend
fend is available on pkgx:
pkgx fend
fend is available in nixpkgs:
nix-env -iA nixpkgs.fend
Or using nix-shell
:
nix-shell -p fend
You can download the latest stable binaries for Windows, macOS and Linux here.
Binaries are available for:
If you have an up-to-date installation of Rust, you can install
fend
like so:
rustup update
cargo install fend
If you already have an older version of fend installed, this will automatically update to the latest version.
Once you have installed fend, you can launch an interactive REPL by
typing fend
in your terminal:
$ fend
> 1 ft to cm
30.48 cm
>
You can write numbers as integers or with a decimal point. Feel free
to use ,
or _
as a digit separator:
> 1234
1234
> 2.54
2.54
> 1,000,000
1000000
To write numbers in binary, octal or hexadecimal, add a
0b
, 0o
or 0x
prefix:
> 0x9 + 0x2
0xb
> 0b1000_0001
0b10000001
You can write in any other base (between 2 and 36 inclusive) by
writing <base>#<number>
. Here is an example of
senary (base 6):
> 6#100 in decimal
36
> 36 to base 6
100
There is no difference between to
, as
or
in
to convert between bases, formats or units.
You can also use e
to for exponential notation, like
so:
> 1e10
10000000000
> 3e8
300000000
> 1.5e-6
0.0000015
> 1E3
1000
i
can be used for complex numbers:
> i * i
-1
> (2 + 3i) * i
-3 + 2i
You can specify recurring digits by writing them in parentheses, like so:
> 0.(3)
approx. 0.3333333333
> 0.(3) to fraction
1/3
> 0.0(15)
approx. 0.0151515151
> 0.0(15) to fraction
1/66
fend supports the standard operators +
, -
,
*
, /
, ^
and !
, with
the usual order of operations:
> 1 + 3 * 4
13
> 3^2
9
> (1 + 3) * 7
28
> 2pi
approx. 6.2831853071
> 5!
120
You can use =
to declare variables:
> a = 1
1
> a
1
> a + 8
9
> a = 4 kg; b = 2; a * b^2
16 kg
Bitwise operators are also supported. &
is used for
bitwise AND, |
for bitwise OR, and xor
for
bitwise XOR, since ^
is already used for exponentiation.
Left and right bitshifts can be done with <<
and
>>
.
The operator precedence for these is the same as in C, with bitshifts
having the highest precedence, followed by &
, then
xor
, and finally |
which has the lowest
precedence.
> 1 & 1
1
> 0xff & 0x100
0x0
> 0xff & 0xcb
0xcb
> 0b0011 | 0b0101
0b111
> 0b0011 xor 0b0101
0b110
> 1 << 2
4
> 7 >> 1
3
These are all the supported operators:
Operators | Precedence | Associativity |
---|---|---|
Literals, Identifiers, Parentheses | highest | N/A |
of |
right | |
! |
left | |
^ , ** |
right | |
* , / , per , function
application (e.g. sin 2 ), mod |
left | |
mixed fractions (e.g. 1 2/3 ), implicit sums (e.g.
5 feet 10 inches ) |
N/A | |
+ , - , to , as ,
in |
left | |
<< , >> |
left | |
& , and |
left | |
xor |
left | |
| , or |
left | |
choose , nCr |
left | |
permute , nPr |
left | |
\ . , : , => |
left | |
= |
left | |
; |
lowest | left |
The most recent calculation result is stored in a special variable
_
(or ans
):
> 5 * 10
50
> _ + 5
55
> _ * 2
110
> ans * 2
220
fend supports many units, such as kg
, lb
,
N
, lightyear
, etc. You can interchangeably use
to
, as
and in
to convert between
units.
> 5'10" to cm
177.8 cm
> 1 mile to km
1.609344 km
> 1 GiB to bytes
1073741824 bytes
> 1m to kg
Error: cannot convert from m to kg: units are incompatible
Temperature units are handled differently to other units, because celsius (°C) and fahrenheit (°F) don't start at zero. Namely, absolute zero (0 kelvin) corresponds to -273.15 °C or -459.67 °F. This means that conversions between °C, °F and kelvin (K) need to differentiate between converting absolute temperatures and differences of temperatures.
If you use the to
keyword to convert a plain temperature
explicitly, fend will perform an absolute conversion. Here are
some examples:
> 0 °C to °F
32 °F
> 100 °C to °F
212 °F
> 0 kelvin to °F
-459.67 °F
If, on the other hand, you add or subtract values with different temperature scales, fend performs relative conversions, like so:
> 0 °C + 1 kelvin
1 °C
> 0 kelvin + 9°F
5 kelvin
Additionally, conversions between more complex units (such as joules
per degree celsius, i.e. J / °C
) will always be
relative:
> 100 J/K to J/°C
100 J / °C
> 100 J/K to J/°F
approx. 55.5555555555 J / °F
fend has support for D&D-style dice syntax. For example,
d6
refers to a standard 6-sided die.
> roll d6
4
> roll d20 # 20-sided die
17
> roll 2d6 # sum of two 6-sided dice
7
> 2d6 # view the probability distribution
2: 2.78% #####
3: 5.56% ##########
4: 8.33% ###############
5: 11.11% ####################
6: 13.89% #########################
7: 16.67% ##############################
8: 13.89% #########################
9: 11.11% ####################
10: 8.33% ###############
11: 5.56% ##########
12: 2.78% #####
> roll(d20 + d6 + 4) # arithmetic operations
14
fend also has built-in syntax for dates:
> @1970-01-01
Thursday, 1 January 1970
> @2000-01-01 + 10000 days
Wednesday, 19 May 2027
fend has a number of predefined functions:
sqrt
, cbrt
for square roots and
cube rootssin
,
cos
, tan
, asin
,
acos
, atan
, sinh
,
cosh
, tanh
, asinh
,
acosh
, atanh
abs
ln
, log
(or
log10
), log2
e^x
): exp
real
, imag
,
arg
Here are some examples of these functions:
> sin(1°)
approx. 0.0174524064
> asin 1
approx. 1.5707963267
> exp 2
approx. 7.3890560989
> abs (1 + i)
approx. 1.4142135619
Many constants are available, including:
pi
: approx. 3.1415926535e
: approx. 2.7182818284c
: 299792458 m/s (speed of light)planck
: 6.62607015e-34 J s (Planck constant)boltzmann
: 1.380649e-23 J / K (Boltzmann constant)avogadro
: 6.02214076e23 / mol (Avogadro constant)electroncharge
, electronmass
,
protonmass
, etc.You can define your own lambda functions using either
\ .
, :
or =>
:
> \x.x
\x.x
> (\x.x) 5
5
> (\x.2x) 5
10
> (x: x to lb to 2 dp) (60 kg)
132.27 lbs
The notation λx.x
is also supported.
Even the Y
Combinator can be defined as
\f.(\x.f (x x)) \x.f(x x)
.
fend supports a few different output formats. It tries to choose an
appropriate format automatically based on the given number, but you can
change it using the to
operator. These are the currently
supported formats:
auto
: This is the default format, which prints most
numbers as decimals. For example, 1/4
is printed as
0.25
, while 1/3
becomes
approx. 0.3333333333
. Approximate values like π or 1/3 are
printed to 10 decimal places in this format.exact
: In this format numbers are printed as exact
values whenever possible. 1/3
is shown as a fraction, and
multiples of π are also shown directly without being approximated as
decimals.float
: In this format, the value is always printed as a
"decimal" (albeit not necessarily in base 10), with arbitrary precision.
Recurring
digits are represented using parentheses. For example,
1/3
is shown as 0.(3)
to indicate the
repeating 3
s.fraction
(or frac
): In this format, any
non-integer value is printed as its simplest fraction (i.e. the fraction
with the lowest possible denominator). For example, 0.25
becomes 1/4
.mixed_fraction
(or mixed_frac
): Numbers
larger than 1 are shown as mixed fractions, so 4/3
is
written as 1 1/3
.<n> sf
: Numbers are shown with the given number
of significant figures. For example pi to 3 sf
becomes
approx. 3.14
.<n> dp
: This format shows the number as a
decimal, with up to the given number of digits after the decimal point.
Recurring digits will also be shown normally. For example,
1/3 to 5 dp
becomes 0.33333
.The @noapprox
attribute can be used to hide the
approx.
annotation in the output:
> pi to 6 dp
approx. 3.141592
> @noapprox pi to 6 dp
3.141592
fend supports string literals, which can be enclosed in either single or double quotes. Strings are always encoded in UTF-8. Either type supports all the same escape sequences, which are as follows:
\\ backslash (\)
\" double quote (")
\' single quote (')
\a bell (0x07)
\b backspace (0x08)
\e escape (0x1b)
\f form feed (0x0c)
\n line feed (0x0a)
\r carriage return (0x0d)
\t (horizontal) tab (0x09)
\v vertical tab (0x0b)
\x ASCII escape sequence, e.g. \x7e for '~'
\u Unicode escape sequence, e.g. \u{3c0} for 'π'
\^ ASCII control character escape sequence,
e.g. \^H for backspace (0x08)
\z This causes fend to ignore any following whitespace characters
Here are some examples of using strings:
> "This is pi: \u{3c0}"
This is pi: π
> 'pi = ' + (pi to string)
pi = approx. 3.1415926535
> 'A' to codepoint
0x41
You can see the debug representation of a value in fend by writing
@debug
at the start of your calculation. For example, you
can type:
> @debug 1+1
2 (unitless) (base 10, auto, simplifiable)
The CLI version of fend supports a configuration file.
The location of this file differs based on your operating system:
$XDG_CONFIG_HOME/fend/config.toml
(usually
$HOME/.config/fend/config.toml
)$HOME/.config/fend/config.toml
\Users\{UserName}\.config\fend\config.toml
You can always confirm the path that fend uses by typing
help
. You can also see the default configuration file that
fend uses by running fend --default-config
.
You can override the config path location using the environment
variable FEND_CONFIG_DIR
.
fend stores its history file in
$HOME/.local/state/fend/history
by default, although this
can be overridden with the FEND_STATE_DIR
environment
variable.
Cache data is stored in $HOME/.cache/fend
by default.
This can be overridden with the FEND_CACHE_DIR
environment
variable.
These are the configuration options currently available, along with their default values:
# Choose whether or not colors should be enabled. Possible
# values are 'never', 'auto' (default) or 'always'
enable-colors = 'auto'
# Maximum number of calculations to store in fend's
# history file
max-history-size = 1000
# The characters that are shown as the prompt when
# using fend interactively
prompt = '> '
# Change 'C' and 'F' to refer to coulomb and farad
# instead of degrees celsius and degrees fahrenheit
coulomb-and-farad = false
# What to do if this configuration file contains unknown
# settings. These are the possible values:
# * 'warn': print a warning on startup if there are any
# unknown config settings (default)
# * 'ignore': ignore any unknown configuration settings
unknown-settings = 'warn'
# Whether to enable internet access. This is required for
# currency conversions, where fend makes a request to
# the UN treasury or the European Central Bank website
# to download up-to-date exchange rates.
enable-internet-access = true
# Data source for currency exchange rates. fend supports
# the following options:
# * `UN` retrieves data from the UN treasury
# (endpoint: https://treasury.un.org/operationalrates/xsql2XML.php)
# * `EU` retrieves data from the EU central bank
# (endpoint: https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml)
# * 'disabled' will disable loading of exchange rate data
exchange-rate-source = "EU"
# Decimal and thousands separator style. This can be used to switch
# between e.g. 1,234.56 and 1.234,56.
#
# Possible values:
# * `default`: uses the default
# * `dot`: uses dots as decimal separator and commas as the thousands
# separator. This is commonly used in English.
# * `comma`: uses commas as decimal separator and dots as the thousands
# separator. This is common in European languages.
decimal-separator-style = "default"
# This section controls the colors that are used by
# fend. Make sure the `enable-colors` setting is
# turned on for this to work.
#
# Color options:
# foreground: the foreground color to use
# bold: whether or not to show text in bold font
# underline: whether or not to underline text
#
# Valid colors are:
# * 'black', 'red', 'green', 'yellow', 'blue',
# 'magenta', 'cyan' or 'white'
# * '256:n' (where `n` is a number between 0 and 255).
#
[colors]
number = {}
string = {}
identifier = { foreground = 'white' }
keyword = { foreground = 'blue', bold = true }
built-in-function = { foreground = 'blue', bold = true }
date = {}
other = {}
# You can define custom units via a `custom-units` array. If there's
# a unit you would like to see added to fend, please consider making
# a pull request to add it to the built-in unit definitions.
#
# Example syntax:
# ```
# [[custom-units]]
# singular = 'mile'
# plural = 'miles' # plural name can be omitted if it is
# # the same as the singular name
# definition = '1609.344 meters'
# attribute = 'allow_long_prefix'
# ```
#
# If the singular and plural names are the same, you can omit
# the `plural` setting.
#
# The `attribute` setting is optional. It can be set
# to one of these values:
# * 'none': this unit cannot be used with prefixes (default)
# * 'allow-long-prefix': allow prefixes like
# 'milli-' or 'giga-' with this unit
# * 'allow-short-prefix': allow abbreviated
# prefixes like 'm' or 'G' (for 'milli' and 'giga' respectively)
# * 'is-long-prefix': allow using this unit
# as a long prefix with another unit
# * 'alias': always expand this unit to its definition
#
# Here are some more examples of how you could define custom units:
#
# ```
# [[custom-units]]
# singular = 'milli'
# definition = '0.001'
# attribute = 'is_long_prefix'
#
# [[custom-units]]
# singular = 'byte'
# plural = 'bytes'
# definition = '!' # an exclamation mark defines a new base unit
# attribute = 'allow_long_prefix'
# ```
You can use fend
programmatically using pipes or
command-line arguments:
$ echo "sin (pi/4)" | fend
approx. 0.7071067811
$ fend "sqrt 2"
approx. 1.4142135619
The return code is 0 on success, or 1 if an error occurs during evaluation.
You can also specify filenames directly on the command-line, like this:
$ cat calculation.txt
16^2
$ fend calculation.txt
256
By default, fend will automatically try to read in files, or fall back to evaluating expressions. This behavior can be overridden with these command-line options:
-f
(or --file
): read and evaluate the
specified file-e
(or --eval
) evaluate the specified
expressionFor example:
$ cat calculation.txt
16^2
$ fend calculation.txt
256
$ fend -f calculation.txt
256
$ fend -e calculation.txt
Error: unknown identifier 'calculation.txt'
Or:
$ fend 1+1
2
$ fend -f 1+1
Error: No such file or directory (os error 2)
$ fend -e 1+1
2
-f
and -e
can be specified multiple times,
in which case fend will evaluate each specified expression one after the
other. Any variables defined in earlier expressions can be used by later
expressions:
$ fend -e "a = 5" -e "2a"
10
Trailing newlines can be omitted by prefixing the calculation with
@no_trailing_newline
, like so:
$ fend @no_trailing_newline 5+5
10
text
as a synonym for string
(e.g.
5 to text
)gf
(gram-force), pond
and
variations thereofat
unit (technical atmosphere, equivalent to
kgf/cm^2
)Torr
unit (equivalent to 101325/760 Pascals)kat
/katal
unit of catalytic
activityr
/q
/R
/Q
prefixes for ronto
, quecto
, ronna
and quetta
respectivelysqcm
, cm2
,
cbcm
and cm3
for common length unitsCmd
+k
/
Ctrl
+k
or Ctrl
+l
to
clear the web UI outputquetta
prefix (equivalent to 10^30)decimal-separator-style = "comma"
in
~/.config/fend/config.toml
, and it changes e.g.
1.23
to 1,23
, or 1,234.00
to
1.234,00
.15400 to roman
is X̅V̅CD
. Numerals with an
overline are 1000 times larger, so V̅
is 5,000,
X̅
is 10,000 etc. Note that these numbers may not be
displayed correctly if your terminal doesn't have full Unicode
support.2^1023
, e.g. log2 10^1234
now
works correctly.light_speed
/lightspeed
unit,
equivalent to the existing constant c
0
regardless of units in some situations,
e.g. 1 km + 0
. This works because zero is the additive
identity.123 to words
returns
one hundred and twenty-three
. This supports numbers up to
10^66 - 1
(vigintillions).ton_of_tnt
unit (approx. 4 gigajoules)linux-x64
binary has been renamed to
linux-x86_64-gnu
for consistency/claritykgoe
and toe
(kilogram/tonne of
oil equivalent)fib 6
is 8,
fib 7
is 13)SQRT
or EXP
4 mod (1k)
or 4k xor 5
sol
(Martian day)%
for modulo as an alternative to
mod
. Since %
is also used for percentages, the
way the operator is interpreted depends on context: 5 % 2
or (348*34)%(293-1)
is parsed as modulo, whereas
5%
or 5% + 3
continues to be treated as a
percentage.electron_mass
, proton_mass
and neutron_mass
shaku
, tsubo
and
tatami
e^27.2
Add function mean
(or average
) to
compute the mean value of probability distributions (by haykam821). For example:
> mean(d6)
7
> average(1d20 + 5)
15.5
Add units nibble
(4 bits) and U
(rack
units, equal to 1.75 inches
)
Serialised variables are now compatible between 32-bit and 64-bit platforms
Fix bug where calculating very large roman numerals could crash the application
45 to roman
becomes XLV
)≠
as an alias for !=
(by @haykam821)<>
as another alias for !=
Add ==
and !=
operators for equality
and inequality (by @frectonz)
For example:
> 2 metres == 200 cm
true
> 4 kg == 2 lbs
false
The fend CLI now uses native-tls
by default, instead
of rustls
. On Windows this uses SChannel (via the
schannel
crate), on macOS it uses Secure Transport via the
security-framework
crate, and on Linux it links to OpenSSL
with the openssl
crate. You can continue using
rustls
by compiling with the
--no-default-features --features rustls
flags. See the
CLI's Cargo.toml
for further details.
floor
, ceil
and round
functions (by @frectonz)97 to character
(by @mat-1)fend-core
etc.) (by @albertlarsan68)sqrt(milli)
.Change unit simplification and unit aliasing to be simpler and
more consistent. Units like %
and million
are
now simplified unless you explicitly convert your result to one of those
units. fend will now also simplify certain combinations of units, such
as volts / ohms
becoming amperes
.
For example:
> 5%
0.05
> 46 million
46000000
> 0.5 to %
50%
> 34820000 to million
34.82 million
> (5 volts) / (2 ohms)
2.5 amperes
> 3 feet * 125 kg * s^-2
114.3 newtons
Please open an issue if you encounter any bugs or unexpected behavior.
Rename Windows installer artifacts (MSI files) to also include
the version number, e.g.
fend-1.4.0-windows-x64.msi
.
Replace nanorand
dependency with rand
,
which is better supported and fixes compilation errors on
FreeBSD.
pkgx
package (by @michaelessiet)x86_64-unknown-linux-musl
binaryCustom units can now be defined in the
~/.config/fend/config.toml
configuration file. For
example:
[[custom-units]]
singular = 'fortnight'
plural = 'fortnights' # plural form is optional, defaults
# to singular if not specified
definition = '14 days'
attribute = 'allow-long-prefix' # this makes it possible to combine this
# unit with prefixes like 'milli-' or 'giga-'
See the default config file for more examples.
You can now tab-complete greek letters in the CLI, e.g.
\alpha
becomes α (by @Markos-Th09)
You can now use the of
operator to write e.g.
5% of 100
(by @fa993)
Add CGS units (by @Markos-Th09)
exchange-rate-source
option. (by @Markos-Th09)Mpc
)native-tls
will cause fend to use the operating system's
built-in TLS implementation. The rustls
feature, which is
enabled by default, will keep the existing native Rust implementation.
When both features are disabled, such as when compiling with
--no-default-features
, network connectivity will not be
available and currency conversions will not work. (by @eatradish)windows-sys
instead of winapi
jin
and gongjin
(by @eatradish)Variable names with underscores can now be correctly referenced
Combined abbreviated units are now parsed case-insensitively:
> 100 kwh
100 kWh
> 64 KB
64 kB
Add a new configuration option
enable-internet-access
(defaults to
true
)
Add tbs
unit as an abbreviation for
tablespoons
Add thou
unit, representing a thousandth of an
inch
bin
alias for binary (by @xfnw)Add @no_trailing_newline
attribute, which causes
fend to not print a trailing newline after the calculation.
$ fend @no_trailing_newline 5+5
10
@2023-01-08 - 5 days
)Add operators for permutations and combinations (by @frectonz)
n permute k
or n nPr k
: compute the number
of k
-permutations of n
n choose k
or n nCr k
: number of
k
-combinations of n
Add @noapprox
attribute to hide the
approx.
annotation in the output:
> pi
approx. 3.1415926535
> @noapprox pi
3.1415926535
Add @plain_number
attribute, to remove
approx.
and any units. This is especially useful in
automated scripts.
> 5 m / (3 s)
approx. 1.6666666666 m / s
> @plain_number 5 m / (3 s)
1.6666666666
Add a new date literal syntax, e.g.
@2000-01-01
Improve visual feedback when using the Telegram bot (by @miki-tebe)
Add new SI prefixes quecca, ronna, ronto and quecto (by @frectonz)
Add support for 256 (8-bit) colors in the CLI configuration
Change !debug
to @debug
for consistency
and improved shell script interoperability
and
and or
keywords as alternatives to
the &
and |
bitwise operators_
in fend-web (stores the previous answer)&
: bitwise AND|
: bitwise ORxor
: bitwise XOR (^
is already used for
exponentiation)<<
: left shift>>
: right shift10 EUR to USD
fend calculation.txt
will read and evaluate the contents of
calculation.txt
. Multiple files can be specified, as well
as combinations of files and expressions.#!/usr/bin/env fend
) no longer result in
parse errors--
to force fend to interpret arguments
literally, e.g. fend -- -V
is interpreted as
-1 volts
instead of showing the version numberwinget
)fend-wasm-nodejs
NPM package5% * 80kg
is now 4 kg
kn
for knots
rad
for radians
(e.g.
10 RPM to rad/s
)feet
(e.g.
5 foot 5 to cm
)mC
or
µF
sqmm
unit for square millimeterspoint
unit for typographical points (i.e. 1/72
inch)5'1
: fend
will now automatically interpret that as 5'1"
echo "1+1" | fend
kmh
and km/h
for kilometers per
hourh
to
planck
λx.x
(in addition to
the previous lambda notations \x.x
, x:x
and
x => x
)fend
more convenient
on the command line~/.config/fend/config.toml
for its configuration file, and
store history in ~/.local/state/fend/history
. You can run
fend help
to see which paths fend uses, and override them
via the FEND_CONFIG_DIR
and FEND_STATE_DIR
environment variables if necessary.enable-colors
config option, or via the
NO_COLOR
environment variable. CLICOLOR
and
CLICOLOR_FORCE
environment variables are also respected.
See https://bixense.com/clicolors/ and https://no-color.org for more
info.max-history-size
config option to control how
many history entries are saved by default.armv7-gnueabihf
and aarch64
architectures.ternary
and senary
Improve command-line argument parsing, including support for multiple arguments
The most recent calculation result is now stored in a special
variable _
(or ans
):
> 5 * 10
50
> _ + 5
55
> _ * 2
110
> ans * 2
220
fend-wasm-web
NPM packagestone
unit('2020-05-04' to date) + 500 days
fend-wasm-web
NPM package available,
built with the --target web
option()
types in the CLI and in
fend-wasm
mAh
)Add support for D&D-style dice syntax. For example,
d6
refers to a standard 6-sided die.
> roll d6
4
> roll d20 # 20-sided die
17
> roll 2d6 # sum of two 6-sided dice
7
> 2d6 # view the probability distribution
2: 2.78% #####
3: 5.56% ##########
4: 8.33% ###############
5: 11.11% ####################
6: 13.89% #########################
7: 16.67% ##############################
8: 13.89% #########################
9: 11.11% ####################
10: 8.33% ###############
11: 5.56% ##########
12: 2.78% #####
> roll(d20 + d6 + 4) # arithmetic operations
14
Fix lux
unit definition
Remove the ->
conversion syntax: use
to
instead
C
and F
as
coulomb and farad instead of degrees celsius and degrees fahrenheithorsepower
, lumen
,
lux
, decare
etc.atmosphere
, mmHg
,
inHg
, dB
, mil
and morea = 4; b = 10; a * b
is 40
)mixed_frac
as an alias for
mixed_fraction
£
symbol for GBP$
and £
before the associated
number, e.g. $100/4
is $25
k
, M
, G
and
T
suffixes for numbers (e.g. 5k
is
5000
)mod
(e.g. 5 mod 2
is
1
)phi
is
approx. 1.6180339886
)true
, false
, and a not()
functionsqm
and sqft
units for square meters
and square feet respectivelyconfig.toml
file. Refer to the default
config.toml
file here.Case-insensitive units: you can now write
5 Meters
Experimental date support:
You can create a date object like so:
> "2021-05-20" to date
Thursday, 20 May 2021
No other date-related functionality has been implemented yet, including no times/timezones, durations, date arithmetic or different date formats.
fend now parses single and double quotes as feet and inches (instead of as string literals) in more situations, so you can once again write:
> 1.2192 m to '
4'
The CLI program can now read options from a config file. Type
help
to find out where it is stored. The
config.toml
file can contain the following options:
prompt = '> '
color = false
Terminal color support: this is disabled by default, so you'll
need to create a config file containing color = true
first.
Added a conjugate
function that computes the complex
conjugate of a number: e.g. conjugate(i)
is
-i
.
Improve consistency around error messages
b
as shorthand for bits (including e.g.
Gb/s
)0d
number prefix100 km/hr * 36 seconds
becomes 1 km
)mass of earth
)square
and cubic
functionsThis build was only released on NPM.
!debug 1
)1E3
is 1000
)in
as an alias for to
(so you can now
write 3.14 in binary
)log()
function as shorthand for
log10()
kWh
unit definitionLICENSE.md
files as part of the package on crates.ioversion
command to get the current fend
version-sin pi
and 3 sin pi
without
parenthesessin^-1
becomes
asin
to sf
to convert numbers to a fixed number of
significant figuressin
and
cos
exacttau
(τ
), equal to 2π
x to exact
will now convert x
to an exact
representation whenever possible, including using multiples of πcis
as a shorthand for
cos θ + i * (sin θ)
to mixed_fraction
)2+3)*(1+2
is
15
)0.(3)
is equal to 1/3
).1
\x.x
)to
and as
1/x
(e.g.
/ second
, 64^/2
)+
in exponential notation (e.g.
1.5e+2
),
as a digit separator (e.g.
1,048,576
)to
log10()
and log2()
!
)Initial release: