Created
August 27, 2014 03:50
-
-
Save drboyer/6a7f21c16873506769d5 to your computer and use it in GitHub Desktop.
Truncates a floating point number to an integer in GrADS scripting language.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Take a floating-point (decimal) number as a parameter and returns a truncated integer (with no decimal point) | |
function int(num) | |
outnum = '' | |
i = 1 | |
while(i < strlen(num)) | |
char = subwrd(num,i) | |
if(char = '.') | |
break | |
else | |
outnum = outnum%subwrd(num,i) | |
i = i+1 | |
endif | |
endwhile | |
return outnum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment