C++ square root command........

Sharky Forums


Results 1 to 4 of 4

Thread: C++ square root command........

  1. #1
    Hammerhead Shark m316foley's Avatar
    Join Date
    Nov 2000
    Posts
    2,706

    Post C++ square root command........

    whats the square root command in c++?

    ------------------
    Amd Athlon 1.4ghz Soon To Be @ 1.6ghz
    Asus A7m266
    2-80gig WD Hard drives
    512megs of DDR Ram
    Gainward Geforce 3 Powerpack @ 220/515
    Soundblaster Live Platinum 5.1
    3Com EtherLink 10/100 3CR990-TX-97
    Creative Blaster v.92 Modem
    Sony Trinitron 21inch Monitor
    Plextor 24X Burnproof Cd-Writer
    Pioneer 16X DVD Drive
    Klipsch Promedia 5.1 Surround Sound
    Sony 3.5inch Floppy Drive
    Windows 2000 Pro - Of Course...
    -------------------------
    *HAVE A NICE DAY*
    Amd Athlon Mobile 2600+ (200 X 12.5 @ 1.7)
    Asus A7N8X-Deluxe (Not Rev. 2)
    2-80gig WD Hard drives
    Corsair XMS pc3200 - 512megs
    Saphire Radeon 9800pro
    Soundblaster Live Platinum 5.1
    3Com EtherLink 10/100 3CR990-TX-97
    Creative Blaster v.92 Modem
    Sony Trinitron 21inch Monitor
    Plextor 24X Burnproof Cd-Writer
    Pioneer 16X DVD Drive
    Klipsch Ultras 5.1 Surround Sound
    Sony 3.5inch Floppy Drive
    Windows 2k of course...
    -------------------------
    Bart: Hey! Why is it killing my toys?
    Lisa: They must have programed it to destroy the competition.
    Bart: Sort of like Microsoft!
    -------------------------
    *HAVE A NICE DAY*

  2. #2
    Catfish
    Join Date
    Jun 2001
    Posts
    130

    Post

    In C it was

    #include <math.h>
    double sqrt(double num);

    where the square root is returned. If num is negative, an error occurs. This should still be valid in C++.
    AMD 1.2GHz Athlon 266FSB w/GlobalWin CAK38
    Asus A7M266
    Kingston PC2100 2x 256MB
    IBM 75GXP ATA100 7200RPM 45GB
    Creative 12x DVD
    Yamaha 4x4x16x CD-RW
    Matrox G400 Millenium
    Matrox Rainbow Runner TV-Tuner/Capture Card
    SB Live! 5.1 Platinum
    Creative Dxr3 Decoder Card
    3Com 3C905B 10/100 NIC
    Mitsubishi 900u
    Antec PP403X 400W PSU
    In-Win Q500

  3. #3
    Texan Dragon Moderator Galen of Edgewood's Avatar
    Join Date
    Sep 2000
    Location
    Ft Irwin, CA
    Posts
    5,602

    Post

    1st of all, congrats on Genetic!

    driver's suggestion would work. Another option is also in math.h

    double pow( double x, double y );

    Just raise x to .5 and you'd get the same thing. This might be a good command to know if you need to raise things to powers.

    ------------------
    Dragon of the OC Crusaders

    The race is not always to the swift, nor the battle to the strong, but that's the way to bet.
    -- Damon Runyon

    [This message has been edited by Galen of Edgewood (edited November 30, 2001).]
    Dragon of the OC Crusaders

    Break the rules and you're snack food for this dragon...

  4. #4
    Reef Shark
    Join Date
    Feb 2001
    Location
    Minot, ND
    Posts
    387

    Post

    But the real question is, which one is fast?

    ------------------
    <A HREF="http://home.columbus.rr.com/bio/benchmarks.htm" TARGET=_blank>-=T'bird 1000=- | -=768 Crucial PC133=- | -=GeForce2 MX 32mb eVGA=-
    -=Abit KT7a-Raid=- | -=40gb ata/100 WD=- | -=Sound Blaster Live!=-</A>
    My Site -=[http://hzrd.us]=-
    Puter #1
    Athlon XP 2600+ @ 2.2GHz 11.5x190 | 2x512mb Corsair c2 3200 | Radeon 9800 Pro |Asus a7nx8 | WD 120GB/ Seagate SATA 120GB x 2


    Puter #2
    T'bird 1000@1224 | 768 Crucial PC133 | GeForce2 MX 32mb eVGA | Abit KT7a-Raid | 40gb ata/100 WD | Sound Blaster Live!

Posting Permissions

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