Results 1 to 5 of 5

Thread: Checking if a number is a whole number or not?

  1. #1
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Checking if a number is a whole number or not?

    Is there a way? Lmk if there is .

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    If it's an integer, it's a whole number. If it's an extended, using modulus to check the original number against a rounded number will work (the remainder has to be zero here).
    :-)

  3. #3
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I know a whole number is an Integer, but is there a way I can check if it's an integer?

  4. #4
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    SCAR Code:
    program New;

    var
       a:extended;
    begin
      a := 1.0;
      if Extended(round(a)) = a then
        writeln('yes')
      else
        writeln('no');
       
      if ceil(a) - a = 0.0 then
        writeln('yes')
      else
        writeln('no');
      if int(a) - a = 0.0 then
        writeln('yes')
      else
        writeln('no');
    end.

    Are ways to do it.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  5. #5
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Is there a way to Wildcard a number? I tried * but it doesn't work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Name to Number
    By smithsps in forum First Scripts
    Replies: 16
    Last Post: 03-06-2008, 10:39 PM
  2. random number 28+
    By ShowerThoughts in forum OSR Help
    Replies: 6
    Last Post: 10-13-2007, 03:40 PM
  3. Your number?
    By ub3r |<1||3r*1337* in forum News and General
    Replies: 4
    Last Post: 08-13-2006, 09:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •