Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 0b9806f6 authored by Hans Boehm's avatar Hans Boehm
Browse files

Support pasting of scientific notation numbers

Bug: 21470972

Support pasting of numbers using scientific notation with 'E'.  This
is intentionally very restricted to dodge ambiguities with the
constant e.  We only accept a scientific notation constant if it is

1) Contained within a single pasted text element.
2) Uses capital 'E' to introduce the exponent.
3) Does not contain an explicit '+' in the exponent.

We do currently use the same notion of 'digit' as elsewhere, i.e.
Character.isDigit(), which might be too general.

For consistency, and to make sure that we can recognize machine
generated output, this also adds a few more aliases for text input
of arithmetic operators.

For consistency, always use 'E' internally for scientific notation as
well.

We ensure that a pasted numeric string is not concatenated with
a pre-existing constant.  This is a judgment call, but it means
that pasting a previous calculator result gets similar treatment
whether or not we are still running the same calculator instance.

We support limited editing on exponents.  Once an exponent is deleted,
the only way to restore it is via pasting.  The 10^x button
produces similar results, though with different operator precedence
behavior.

Change-Id: I2d0f3dceb641cdad327fd3c3540b5eea38030146
parent a8f47d36
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment