Provided by: bcal_1.9-2_amd64

**NAME**

bcal - Storage expression calculator.

**SYNOPSIS**

bcal[-cN][-fFORMAT][-sbytes][-m][-b][-d][-h][expression][N[unit]]

**DESCRIPTION**

bcal(Byte CALculator) is a command-line utility to help with numerical calculations and expressions involving data storage units, addressing, base conversion etc.Features* evaluate arithmetic expressions involving storage units * convert to IEC/SI standard data storage units * REPL mode with the last valid result stored for reuse * show the address in bytes * show address as LBA:OFFSET * convert CHS to LBA and vice versa * show binary, decimal and hex representation of a number * custom sector size, max heads/cylinder and max sectors/track * minimal dependenciesbcalfollows Ubuntu's standard unit conversion and notation policy. Only 64-bit operating systems are supported. Refer to:https://wiki.ubuntu.com/UnitsPolicy

**OPERATIONAL** **NOTES**

1.REPLmode:bcalenters the REPL mode if no arguments are provided. Storage unit conversion and expression evaluation are supported in this mode. The last valid result is stored in the variabler. 2.Expression: An expression must be within double quotes. Inner spaces are ignored. A unit can be added to, subtracted from or divided by another unit. A unit can be multiplied or divided by positive integers. 3.N[unit]:Ncan be a decimal or '0x' prefixed hex value.unitcan be B/KiB/MiB/GiB/TiB/kB/MB/GB/TB following Ubuntu policy. Default is byte. As all of these tokens are unique,unitis case-insensitive. 4.Numericrepresentation: Decimal and hex are recognized in expressions and unit conversions. Binary is also recognized in other operations. 5.Syntax: Prefix hex inputs with '0x', binary inputs with '0b'. 6.Precision: 128 bits if__uint128_tis available or 64 bits for numerical conversions. Floating point operations uselongdouble. Negative arguments are unsupported. 7.Fractionalbytesdonotexist, because they can't be addressed.bcalshows the floor value of non-integerbytes. 8.CHSandLBAsyntax: - LBA: 'lLBA-MAX_HEAD-MAX_SECTOR' [NOTE: LBA starts with 'l' (case ignored)] - CHS: 'cC-H-S-MAX_HEAD-MAX_SECTOR' [NOTE: CHS starts with 'c' (case ignored)] - Format conversion arguments must be hyphen separated. - Any unspecified value, including the one preceding the first '-' to the one following the last '-', is considered '0' (zero). 9.Defaultvalues: - sector size: 0x200 (512) - max heads per cylinder: 0x10 (16) - max sectors per track: 0x3f (63) 10.bcvariables: scale = 5, ibase = 10.bcis not called in minimal output mode.

**OPTIONS**

-c=NShow decimal, binary and hex representation of positive integerN.-f=FORMATConvert CHS to LBA or LBA to CHS.FORMATis hyphen-separated representation of LBA or CHS. LBA: lLBA-MAX_HEAD-MAX_SECTOR (starts with 'l') CHS: cC-H-S-MAX_HEAD-MAX_SECTOR (starts with 'c') Omitted values, (other than MAX_HEAD and MAX_SECTOR) are considered 0. Default MAX_HEAD: 16, default MAX_SECTOR: 63.-s=bytesSector size in bytes. Default value is 512.-mShow minimal output (e.g. decimal bytes).-bShow sizes of basic data types on the system in bytes.-dEnable debug information and logs.-hShow program help and exit.

**EXAMPLES**

1. Evaluate arithmetic expression of storage units$bcal"(5kb+2mb)/3"$bcal"5tb/12"$bcal"2.5mb*3"$bcal"(2giB*2)/2kib"2. Convert storage capacity to other units and get address, LBA.$bcal20140115b$bcal0x1335053B$bcal0xaabbcckb$bcal0xdefGibNote that the units are case-insensitive. 3. Convert storage capacity, set sector size to 4096 to calculate LBA.$bcal0xaabbcckb-s40964. Convert LBA to CHS.$bcal-fl500$bcal-fl0x600-18-0x7e$bcal-fl0x300-0x12-0x7e5. Convert CHS to LBA.$bcal-fc10-10-10$bcal-fc0x10-0x10-0x10$bcal-fc0x10-10-2-0x12$bcal-fc-10-2-0x12$bcal-fc0x10-10--0x126. Show binary, decimal and hex representations of a number.$bcal-c20140115$bcal-c0b1001100110101000001010011$bcal-c0x1335053

**AUTHORS**

Arun Prakash Jana <engineerarun@gmail.com>

**HOME**

https://github.com/jarun/bcal

**REPORTING** **BUGS**

https://github.com/jarun/bcal/issues

**LICENSE**

Copyright © 2016-2018 Arun Prakash Jana <engineerarun@gmail.com> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.