Loading ...
Sorry, an error occurred while loading the content.

Re: Big and small numbers

Expand Messages
  • surgeproof
    The following code (in LB3) shows that numbers in the form 4.5e45 can be used (sort of). input x ; x input y ; y z=x/y print x print y print z end Enter
    Message 1 of 3 , Apr 30, 2002
    • 0 Attachment
      The following code (in LB3) shows that numbers in the form 4.5e45 can
      be used (sort of).


      input "x "; x
      input "y "; y

      z=x/y

      print x
      print y
      print z

      end


      Enter 4.5e45 for the x value
      Enter 1.5e30 for the y value

      The displayed results are:

      4.5e45
      1.5e30
      3.0e15

      However there appears to be no direct way to assign the value 4.5e45
      directly to a variable within the program. If this is really
      the way it works, direct use of exponential notation be a nice
      addition to the next update or full version.
    • bryan_davisuk
      ... 4.5e45 ... not true, there is a clumsy way of doing it read x read y data 12e16 data 7e14 print x print y print x*y
      Message 2 of 3 , Apr 30, 2002
      • 0 Attachment
        > However there appears to be no direct way to assign the value
        4.5e45
        > directly to a variable within the program. If this is really
        > the way it works, direct use of exponential notation be a nice
        > addition to the next update or full version.



        not true, there is a clumsy way of doing it

        read x
        read y
        data 12e16
        data 7e14

        print x
        print y
        print x*y
      • jshrimp.rm
        This seems to be a compiler issue as LB understands SCI Notation but the compiler does not. Till fixed enter SCI Notation as text and use the x=VAL( 4.5e45 )
        Message 3 of 3 , May 1, 2002
        • 0 Attachment
          This seems to be a compiler issue as LB understands SCI Notation but
          the compiler does not.
          Till fixed enter SCI Notation as text and use the x=VAL("4.5e45") as
          below. Compiler will like you better. After defined as a variable
          then it will work fine.

          Jay Shrimplin

          '------start---------
          print val("4.5e45")
          print val("1.5e30")

          print

          x= val("4.5e45")
          y= val("1.5e30")
          print x
          print y
          print x/y

          print
          print val("4.5e45")/val("1.5e30")
          print
          print
          print val("2e-4")*val("3")
          print val("2e-4")*val("3e-1")
          print val("2e-4")*val("3e-2")
          print val("2e-4")*val("3e-3")

          print
          print

          print val("2e4")*val("3")
          print val("2e4")*val("3e1")
          print val("2e4")*val("3e2")
          print val("2e4")*val("3e3")
          print val("2e4")*val("3e4")
          print val("2e4")*val("3e5")
          print val("2e4")*val("3e6")
          '------end-----------


          > However there appears to be no direct way to assign the value
          4.5e45
          > directly to a variable within the program. If this is really
          > the way it works, direct use of exponential notation be a nice
          > addition to the next update or full version.
        Your message has been successfully submitted and would be delivered to recipients shortly.