Post Reply 
newRPL: [UPDATED April 27-2017] Firmware for testing available for download
10-22-2015, 08:50 PM
Post: #78
RE: newRPL: [UPDATED Oct-19-2015] Firmware for testing available for download
(10-03-2015 06:15 PM)Claudio L. Wrote:  
(10-03-2015 01:22 PM)matthiaspaul Wrote:  - AFAIK newRPL already supports SI decimal prefixes, doesn't it? What about IEC binary prefixes, which are becoming more and more important?

Ki: 2^10 or 1024^1
Mi: 2^20 or 1024^2
Gi: 2^30 or 1024^3
Ti: 2^40 or 1024^4
Pi: 2^50 or 1024^5
Ei: 2^60 or 1024^6
Zi: 2^70 or 1024^7
Yi: 2^80 or 1024^8
newRPL allows you to to define for example:
8_bit 'B' UDEFINE --> This will define B (byte) as 8 bits, and don't allow automatic SI units
or, you might prefer the byte to be the base unit:
1 'B' UDEFINE
if you want the new unit to accept all SI prefixes:
1 '?B' UDEFINE ---> will do just that.

Problem is, for bytes it doesn't make a lot of sense to have 1_┬ÁB, so it's probably best if byte is defined without SI prefixes, then kB or KiB are each defined separately.
Actually, I think, prefixes are so fundamental, the system should ideally support them both (decimal per SI/ISO and binary per IEC/IEEE/ISO) by default. For flexibility, perhaps the ? syntax could be expanded by adding some kind of "attributes" to it so that the system will support on a unit by unit basis:

- no unit prefixes (f.e. 'u' UDEFINE)
- all decimal and binary prefixes (f.e. '?u' UDEFINE)
- only decimal prefixes (f.e. 'x?u' UDEFINE)
- only binary prefixes (f.e. 'i?u' UDEFINE)
- only decimal prefixes with positive exponents (f.e. '+?u' UDEFINE or '+x?u' UDEFINE)
- only decimal prefixes with negative exponents (f.e. '-?u' UDEFINE or '-x?u' UDEFINE)
- decimal with positive exponents only as well as binary prefixes (f.e. '+i?u' UDEFINE or '+xi?u' UDEFINE)

Ideas for other special case attributes:

- allow percent and permille as unit prefixes (f.e. '%?u' UDEFINE)
- absolute / relative unit conversion as with temperatures (would need some additional notation to specify conversion factors)
- allow to specify a "preferred" target prefix to be used in results (would need some system to resolve conflicting preferences for different units). The system would still allow to convert into something specific, but would default to preferred units otherwise (f.e. 'm?m' UDEFINE would return results in mm, even if given in cm or m etc. or 'Gi+x?B' UDEFINE would return results in GiB even if given in GB, whereas 'G+xi?B' UDEFINE would return results in GB even if given in GiB.)

(The syntax is just a rough proposal to illustrate the idea, nothing "finished".)

Greetings,

Matthias


--
"Programs are poems for computers."
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL: [UPDATED Oct-19-2015] Firmware for testing available for download - matthiaspaul - 10-22-2015 08:50 PM



User(s) browsing this thread: 3 Guest(s)