Help.
I am fealing extreamly stupid righ now and cannot solve this simple problem (no code necessary just a pointer)
What i have is a set of numbers
1.3e-3
3.7e-5
102
46
1e-4
1e-12
all numbers are 10x larger or smaller then any other number in the group(i cannot even express myself correctly). What i need is to place them in the array depending on how meny decimal places they occupy given that if they are > 1 the an ofset by the largest number has to be takon in considereation:
table was updated $a[2] was missing , sorry, thnx choroba !!
$a[0] = 102; #1e2
$a[1] = 46; #1e1
$a[2] = 0; #1e0
$a[3] = 0; #1e-1
$a[4] = 0; #1e-2
$a[5] = 1.3e-3#1e-3
$a[6] = 1e-4 #1e-4
$a[7] = 1e-5 #1e-5
...
$a[14] = 1e-12 #1e-12
how do i do this without using those chaines of if-else blocks
thnx
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.