Skip to content

Commit

Permalink
Added unility funcs to remove dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
KronosTheLate committed Nov 17, 2021
1 parent 9805441 commit 9d1cc69
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/UtilityFunctions.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
geometric_mean(a::Number, b::Number) = (a*b)

function find_under_and_over(a::Number, possible_values::Array)
possible_series_sorted = sort(possible_values)
i, j = 1, 2
while !(possible_series_sorted[i] a possible_series_sorted[j])
i+=1; j+=1
end
return possible_series_sorted[i], possible_series_sorted[j]
end

function norm_to_between_100_and_1000(val::Number; return_OOM=true)
power_of_10 = 0.0
while val > 1000
val/=10; power_of_10 += 1
end
while val < 100
val*=10; power_of_10 += -1
end
if return_OOM
return val, power_of_10
else
return val
end
end

0 comments on commit 9d1cc69

Please sign in to comment.