perl - Compare size of change rather than number -


i need compare values list represent log magnitudes of change:

      '1.3118   2.07985',       '1.18887  0.990066',       '2.63964  2.31757',       '0.828566 1.03155',       '-0.895715    -0.993696',       '1.24353  1.35931',       '1.2916   1.03409',       '-0.747429    -1.18246',       '1.30936  1.20244',       '1.40537  1.27763',       '-1.07762 -0.978337',       '0.755268 0.837232',       '0.919512 1.09517', 

for each row, want make comparison , store value greatest magnitude of change. example have (thanks on question regex value comparison) comparison:

if ($condition1_match > $condition2_match) {     push @largest_change, $condition1_match; } 

would rightly value -0.895715 smaller -0.993696. want write comparison recognises -0.993696 higher fold change -0.895715

you use absolute values:

if (abs $condition1_match > abs $condition2_match) {     push @largest_change, $condition1_match; } 

and of course other way round, also:

elsif (abs $condition1_match < abs $condition2_match) {     push @largest_change, $condition2_match; } 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -