Talk:Point operator

From Esolang
Jump to navigation Jump to search

Workable point operator.

There is a way of having a point operator that works with integers. You just make the part after the point an exponent.

Some examples:

Point operator Decimal
123.0 123.0
123.1 12.3
123.2 1.23
123.3 0.123
123.-1 1230
123.-4 1230000

Here is an idea that enilKoder thought of:

Integers with trailing zeros as the second operand will have their trailing zeros be leading zeros in the decimal.
Before my idea, passing 5 as the second operand produces the same result as passing 50, 500, 5000, etc.; 432 same as 4320, 43200, etc.; etc.
Examples:

Point operator Decimal representation
123.45 123.45
931.704 123.704
8.300 8.003
2864.200487000 2864.000200487

def("signature") {} defEnd("From enilKoder" }{ signature() (talk) 17:26, 27 March 2019 (UTC)

Leading zeroes

This needn't be so big a stumbling block noting that many languages don't allow strings of digits to represent non-zero integers. For example, in Python 3, 01 throws an error. A parser could detect that a string of digits begins with a zero and know not to treat it like an integer. If it is to work with the operator, then 0001 should represent a floating point 0.001 in human notation. Thus 1.0001 in point op notation would be 1 + 0001/10 = 1 + 0.001/10 = 1 + 0.0001 = 1.0001. (QED) Hence for a number "0X" where X is any number, including numbers with additional leading zeros, the parser should interpret it as X/10. IFcoltransG (talk) 00:46, 17 January 2020 (UTC)