form validation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lasse Reichstein Nielsen

    #16
    Re: Binary operators and number representation

    Thomas 'PointedEars' Lahn <PointedEars@nu rfuerspam.de> writes:
    [color=blue][color=green][color=darkred]
    >>> No, binary operators convert their operands to 32 bit signed Integers[/color]
    >>
    >> ..."semantic" :)[/color]
    >
    > What exactly are you trying to say?[/color]

    Perhaps that the specification doesn't say that it converts to an
    integer machine *format*, just that it converts it to an integer
    *number* in a range representable by 32 bits.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Dr John Stockton

      #17
      Re: form validation

      JRS: In article <40ABE748.405@P ointedEars.de>, seen in
      news:comp.lang. javascript, Thomas 'PointedEars' Lahn
      <PointedEars@nu rfuerspam.de> posted at Thu, 20 May 2004 01:01:28 :
      [color=blue]
      >No, binary operators convert their operands to 32 bit signed Integers prior
      >to operation (i.e. they treat them as Integers), but the operation returns
      >IEEE-754 doubles as well. (Those doubles have of course a fractional part
      >of 0, but they are still _not_ Integers.)[/color]


      I hope you don't mean that.

      IEEE Doubles are binary floats.

      In IEEE Doubles, all & only those numbers which are powers of two have a
      zero fractional part.

      You should have written that :-
      (Those doubles, when expressed in common decimal, have of course
      a fractional part of 0, but they are still _not_ Integers.)



      Programmers need to be continuously aware of the actual type that they
      are working with, and of its implications.



      For example, in another language, I have recently become of a library
      routine that is supposed to do Banker's Rounding.

      Aside: We should think, for the FAQ, about Banker's Rounding,
      in which a.bc5 rounds to x.yz *with z even*.

      For rounding to two places, it calculates 1.0/10^2 (by iteration),
      divides the number by that, rounds to integer, multiplies by that.

      But 10^-2, nominally 0.01, cannot be rendered exactly as a Double.

      It has been observed that the supplied function incorrectly rounds
      literal 1.875 to 1.87 (contrary to what the Help file says); and that
      changing the algorithm to use multiplication by (exact) 100, rounding,
      division fixes the error.

      The routine in FAQ 4.6 uses the proper arithmetic.

      Note : it was written on the presumption that, since M & N are numbers
      of places, generally supplied as literals, they would be positive. The
      case of M<=0 is equivalent to that of M=0, and may give a deprecated
      format; N=0 gives a deprecated but tolerable format, and N<0 gives a
      wrong value.


      <FAQENTRY> in 4.6, after "successful ly", insert ", for M>0, N>0" - or
      such other adjustment as appeals.

      --
      © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
      <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
      <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

      Comment

      • Thomas 'PointedEars' Lahn

        #18
        Re: Binary operators and number representation

        Lasse Reichstein Nielsen wrote:
        [color=blue]
        > Thomas 'PointedEars' Lahn <PointedEars@nu rfuerspam.de> writes:[color=green][color=darkred]
        >>>> No, binary operators convert their operands to 32 bit signed Integers
        >>> ..."semantic" :)[/color]
        >>
        >> What exactly are you trying to say?[/color]
        >
        > Perhaps that the specification doesn't say that it converts to an
        > integer machine *format*, just that it converts it to an integer
        > *number* in a range representable by 32 bits.[/color]

        And how you suggest the binary AND should be computed
        if the operands are not in a machine format?


        PointedEars

        Comment

        • Lasse Reichstein Nielsen

          #19
          Re: Binary operators and number representation

          Thomas 'PointedEars' Lahn <PointedEars@nu rfuerspam.de> writes:
          [color=blue]
          > And how you suggest the binary AND should be computed
          > if the operands are not in a machine format?[/color]

          Ofcourse they are. It just don't have to be an *integer* format.
          (It can be, and probably is, but the standard doesn't say that
          it has to).

          /L
          --
          Lasse Reichstein Nielsen - lrn@hotpop.com
          DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
          'Faith without judgement merely degrades the spirit divine.'

          Comment

          • Thomas 'PointedEars' Lahn

            #20
            Re: Binary operators and number representation

            Lasse Reichstein Nielsen wrote:
            [color=blue]
            > Thomas 'PointedEars' Lahn <PointedEars@nu rfuerspam.de> writes:[color=green]
            >> And how you suggest the binary AND should be computed
            >> if the operands are not in a machine format?[/color]
            >
            > Ofcourse they are. It just don't have to be an *integer* format.[/color]

            Name a CPU that does not use integer registers for binary operations.


            PointedEars

            Comment

            Working...