Problem Description
You are presented with a positive decimal number, denoted as 'x.' Your objective is to convert it into "simple exponential notation."
In this notation, if x = a·10b, where 1 ≤ a < 10, the representation takes the form "aEb." If b equals zero, the "Eb" part should be omitted. When 'a' is an integer, it must be written without a decimal point. Additionally, there should be no extraneous zeroes in 'a' and 'b.'
Problem Constraints
The length of the number will not exceed 106.
Input Format
The first argument is the positive decimal number X.
Output Format
Return the "simple exponential notation" of the given number X.
Example Input
Input 1:
.100
Input 2:
16
Example Output
Output 1:
1E-1
Output 2:
1.6E1
Example Explanation
For Input 1:
The given decimal number is 0.1. This is represented as "1E-1" in compact scientific notation since it can be expressed as 1 multiplied by 10 to the power of -1.
For Input 2:
The provided decimal number is 16. In compact scientific notation, this is represented as "1.6E1" as it can be expressed as 1.6 multiplied by 10 to the power of 1.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified.
Still have a question? Checkout Sample Codes for more details.