Skip to content

Commit

Permalink
manage floating values
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGuarracino committed May 5, 2024
1 parent 02227ae commit 87510bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions partition-before-pggb
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,13 @@ if [[ $block_length == false ]]; then
fi

if [[ $hg_filter_ani_diff == false ]]; then
if [[ $map_pct_id -ge 90 ]]; then
# Convert map_pct_id to a format that bc can handle if it's not already a decimal
map_pct_id_decimal=$(printf "%.2f" "$map_pct_id")

# Using bc for floating-point comparison
if [[ $(echo "$map_pct_id_decimal >= 90" | bc) -eq 1 ]]; then
hg_filter_ani_diff=30
elif [[ $map_pct_id -lt 90 && $map_pct_id -ge 80 ]]; then
elif [[ $(echo "$map_pct_id_decimal >= 80 && $map_pct_id_decimal < 90" | bc) -eq 1 ]]; then
hg_filter_ani_diff=10
else
hg_filter_ani_diff=0
Expand Down
8 changes: 6 additions & 2 deletions pggb
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,13 @@ if [[ $block_length == false ]]; then
fi

if [[ $hg_filter_ani_diff == false ]]; then
if [[ $map_pct_id -ge 90 ]]; then
# Convert map_pct_id to a format that bc can handle if it's not already a decimal
map_pct_id_decimal=$(printf "%.2f" "$map_pct_id")

# Using bc for floating-point comparison
if [[ $(echo "$map_pct_id_decimal >= 90" | bc) -eq 1 ]]; then
hg_filter_ani_diff=30
elif [[ $map_pct_id -lt 90 && $map_pct_id -ge 80 ]]; then
elif [[ $(echo "$map_pct_id_decimal >= 80 && $map_pct_id_decimal < 90" | bc) -eq 1 ]]; then
hg_filter_ani_diff=10
else
hg_filter_ani_diff=0
Expand Down

0 comments on commit 87510bc

Please sign in to comment.