home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5351 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: soap.news.pipex.net!pipex!usenet
  2. From: m.hendry@dial.pipex.com (Mathew Hendry)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Fastest datatype?
  5. Date: Wed, 13 Mar 96 10:15:54
  6. Organization: Private node.
  7. Distribution: world
  8. Message-ID: <19960313.4B9168.9AD8@ak145.du.pipex.com>
  9. References: <83.6643T702T1298@academy.bastad.se>
  10. NNTP-Posting-Host: ak145.du.pipex.com
  11. X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
  12.  
  13. Sten Jansson (sten@academy.bastad.se) wrote:
  14. : I've heard that float is faster than integer. Is that true?
  15.  
  16. No, floating point arithmetic is almost always slower than integer arithmetic,
  17. whether the floating point functions are implemented in hardware or emulated
  18. by integer instructions.
  19.  
  20. If you mean "is emulated floating point faster than floating point implemented
  21. in hardware?" then the answer is "depends". Emulated floating point can be
  22. very fast indeed if you are prepared to sacrifice some precision and / or use
  23. large amounts of memory to store lookup tables. Whether you get a win from
  24. this or not depends on the relative speeds of the available integer and
  25. floating point hardware.
  26.  
  27. As an example, many JPEG codecs around use emulated floating point arithmetic
  28. in their algorithms. Some precision is sacrificed in doing this, but the
  29. effects are generally not noticable. Run on a 68030 system, this works out
  30. faster than using a 68881 / 68882 to do the arithmetic (these FPUs are very
  31. slow by modern standards). On a 68040 or 68060, on the other hand, you lose
  32. by using integer, as the floating point units on these CPUs have been very
  33. heavily optimised. Horses for courses.
  34.  
  35. -- Mat.
  36.  
  37.