Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trycf/14bea07bc4311e74b5c06cc93b1280ad to your computer and use it in GitHub Desktop.
Save trycf/14bea07bc4311e74b5c06cc93b1280ad to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
function isPositive(required numeric input, boolean debug=false) output=true {
var absValue = abs(arguments.input);
if( arguments.debug ){
writeDump({
"input"=arguments.input
, "absValue"=absValue
, "result"=(absValue == arguments.input)
, "result_when_cast_to_double"=(absValue == javaCast("double", arguments.input))
});
}
return (absValue == arguments.input);
}
testValue = "0.08263888888888889";
writeOutput("Should be true == #isPositive(testValue)#");
isPositive(testValue, true);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment