comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: Wraparound on multiply overflow
Date: Thu, 09 Aug 2001 18:23:40 +0200
Date: 2001-08-09T18:23:40+02:00	[thread overview]
Message-ID: <3B72B90C.FE5FC09B@nbi.dk> (raw)
In-Reply-To: 3B71AC13.F67BDC2@cadence.com

Paul:

> In C it is defined that the result of multiplying two unsigned integers
> is the mathematical result modulo the value (int_max + 1), where int_max
> is the maximum unsigned integer.

That kind of integers are called modular types in Ada. Have
a look at 3.5.4(4) and 3.5.4(36) in the Ada Reference Manual
(1995 edition).

> I know that Ada has modular types, but these don't work with multiply,
> do they?

You might want to RTFM. 4.5.5(1):

   "The multiplying operators [...] are predefined for EVERY
    specific integer type T:"

(my emphasis) and modular types are together with signed
integer types classified as integer types.

Jacob
-- 
"You've got to build bypasses!"



  reply	other threads:[~2001-08-09 16:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-08 21:16 Wraparound on multiply overflow Paul Graham
2001-08-09 16:23 ` Jacob Sparre Andersen [this message]
2001-08-10  8:25 ` Florian Weimer
2001-08-16  5:17 ` David Thompson
replies disabled

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