comp.lang.ada
 help / color / mirror / Atom feed
From: Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk>
Subject: Re: Saturated Arithmetic
Date: 1998/06/19
Date: 1998-06-19T00:00:00+00:00	[thread overview]
Message-ID: <358AA520.675C8EF@cl.cam.ac.uk> (raw)
In-Reply-To: 358A9962.2CE4EE98@elca-matrix.ch


Mats Weber wrote:
> What is a saturating type ?

Saturated/saturating arithmetic is a variant of integer or
fixed-point arithmetic in which

  T'Last + 1 = T'Last
  T'First - 1 = T'First

etc., i.e. where overflows and underflows of computations
result in the closest representable value, and not in a
wraparound or exception.

Such types are *very* widely used in digital signal processing.
If your result in an audio filter algorithm happens to be
slightly above 16#ffff#, then the output you want is 16#ffff# as
the closest possible approximation to the real result and you
clearly do not want a wraparound to 16#0000# or an exception or
extra code that has to take care of this in inner loops.

Most DSPs as well as the new Intel MMX instructions provide
hardware support for saturated arithmetic. I guess, adding
saturated integer and fixed point types to Ada0X would be a sensible
idea (at least if there will be a digital signal processing
special annex).

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




      reply	other threads:[~1998-06-19  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <358510A8.5E62@dmu.ac.uk>
     [not found] ` <EuMMDF.7rM@syd.csa.com.au>
     [not found]   ` <EunACp.E1H@ecf.toronto.edu>
     [not found]     ` <6m6vkp$8un@gurney.reilly.home>
1998-06-19  0:00       ` Hard real-time systems Robert I. Eachus
1998-06-19  0:00         ` Mats Weber
1998-06-19  0:00           ` Markus Kuhn [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox