Skip to content

Commit

Permalink
fixed divisibility test per discussion with GB
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Sandberg committed Jan 23, 2025
1 parent c95c7e4 commit c7cd234
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions TCL/polarDensity_for_DTA.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,9 @@ proc polarDensityBin { config_file_script } {
source $params(utils)/BinTools.tcl

;# check to make sure Rmax is evenly divisible by dr.
;# Cannot ensure that Rmax and dr are both ints, so divisibility_test
;# multiplies both by 10,000 before converting to int as a reasonable
;# precaution. Specifying Rmax and dr to greater than 5 decimal places is
;# a questionable life choice.
set divisibility_test [expr [expr int([expr $params(Rmax) * 10000])] % [expr int([expr $params(dr) * 10000])]]
if {$divisibility_test != 0} {
set divisibility_test [expr [expr double($params(Rmax))] % [expr double($params(dr))]]
set TOLERANCE [expr 10**-12]
if {$divisibility_test >= $TOLERANCE} {
error "Rmax must be evenly divisible by dr."
}

Expand Down

0 comments on commit c7cd234

Please sign in to comment.