Skip to content

Commit 04a3dd4

Browse files
committed
cap rates to a minimum of 0.1
With lower rates than 0.1, the algorithm to calculate the allowed kcal values can takes a very long time to run, and the plot also explodes in the y axis. Print a warning in that case, and cap the value to a minimum of 0.1.
1 parent b70e78a commit 04a3dd4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/nom/config.rb

+5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ def get key
4545
raise "Unknown configuration option '#{key}'"
4646
end
4747

48+
if key == "rate" and @config["rate"] < 0.1
49+
puts "Warning: rates smaller than 0.1 are not supported, capping to 0.1"
50+
0.1
51+
end
52+
4853
if @defaults[key][2] == Float
4954
v.to_f
5055
elsif @defaults[key][2] == Date

0 commit comments

Comments
 (0)