[TriLUG] tax forms and JavaScript

Matt Flyer via TriLUG trilug at trilug.org
Fri Jun 10 12:34:34 EDT 2016


1) Your interpretation is in agreement with the textbook definition of
whole numbers.

2) I don't see where it would be difficult to handle this, however,
asking if Javascript would have difficulty is like asking "how does the
computer know if a number is negative", where the answer is it doesn't.
  The data is just a number, or possibly a string and it is incumbent
upon the programmer to handle the input correctly.  For that matter, it
is incumbent upon the programmer to filter the data such that you
ensure that ONLY proper and safe values get sent to the server, which
is one of the things that Javascript is helpful for.  (Note, that the
server must likewise verify and filter the data, but that is beside the
point).

3)  As I said above, it is not Javascript's role to do this, but the
programmers.  Javascript provides library routines that assist with
this function, such as Math.floor, Math.ceil, and Math.round.
 Similarly, it provides functions for string to integer or float
conversion such as parseint and parsefloat. that will handle this
aspect of the solution.


   
On Fri, 2016-06-10 at 12:06 -0400, mr-trilug via TriLUG wrote:
> This is a query about JavaScript programming.
> 
> The NC-DOR D-400 web-fill form instructions assert: "Enter Whole
> U.S. 
> Dollars Only."
>      To me this means: do NOT enter a decimal and two digits,
> including 
> ".00."
>      To DOR it appears to mean enter with ".00", e.g. "xxxxxx.00".
> 
> Questions:
> 
>  1. Is my interpretation, "xxxxxxx" reasonable?
>  2. Would JavaScript have any difficulty in being programmed to read
>     both xxxxxxx. AND xxxxxxx.cc, including xxxxxx.00? Why should it
>     matter to JS?
>  3. If the answer to [2] is NO DIFFICULTY, would JavaScript just do
> the
>     proper calculations by default or would it need some extra code
> to
>     cope with numbers in different formats?
> 
> Thanks for comments.
> 
> M. Rulison
> 


More information about the TriLUG mailing list