[M3devel] FloatMode

Mika Nystrom mika at async.async.caltech.edu
Tue Jan 12 20:28:07 CET 2010


Jay K writes:
>
>Maybe. But I don't want to prevent anyone else from stepping in.
>And I want to bring up more platforms.
>My integer implementation might be inefficient.
>=20
>=20
>I see these as three or possibly more separate areas.
> Integer overflow.=20
> Integer divide by zero.=20
> Floating point.=20
>=20
>=20
>Divide by zero in particular on NT/x86 and maybe other x86/AMD64 platforms =
>is probably already "not silent"=2C so not bad.
>=20
>=20
>I'm not sure about unsigned/Word.T overflow=2C how that is supposed to be h=
>andled. In particular=2C signed overflow and unsigned overflow are slightly=
> different=2C and unsigned/Word possibly suggests allowing silent overflow.

Word.T never overflows.  Tons of code depends on this!

Also a lot of machines don't have integer flags, don't forget that.  (Alpha
and MIPS come to mind, although MIPS has an "add-with-exception" instruction.)

     Mika

>=20
>Again I really see quite a number of options here and programmer should ind=
>icate intent via choice of type or interface/function.
>Fixed width=2C trap overflow=2C silent overflow=2C extent precision on over=
>flow=2C etc.
>=20
>=20
>I was talking to a friend about the integer/longint stuff.
>=20
>=20
> - Jay
>
>
>________________________________
>> From: hosking at cs.purdue.edu
>> Date: Tue=2C 12 Jan 2010 13:33:59 -0500
>> To: jay.krell at cornell.edu
>> CC: m3devel at elegosoft.com
>> Subject: Re: [M3devel] FloatMode
>>
>>
>>
>> On 11 Jan 2010=2C at 23:55=2C Jay K wrote:
>>
>> I thought FloatMode was only related to floating point.
>> So I looked:
>>
>> "IntOverflow" =3D an integer operation produced a result whose
>> absolute value is too large to be represented.
>>
>> "IntDivByZero" =3D integer "DIV" or "MOD" by zero.
>> \end{quote}
>>
>>
>> This part of it should be easy to implement for all architectures.
>> The entire thing probably isn't too difficult either on many platforms ei=
>ther.
>>
>> However...I was surprised by this.
>> I thought the real "intent" in Modula-3 to not have this be configurable
>> and endeavor for overflow and divide by zero to always immediately
>> raise an exception? The only "out" is that it might not get implemented o=
>n some platforms for some reason?
>>
>> Yes=2C that's the issue.
>>
>> For the floating point stuff:
>>
>> Probably like other per-platform code=2C this should be done in #ifdefed =
>C.
>>
>> Agreed... does that mean you will bite? =3B-)
>>
>>
>> http://msdn.microsoft.com/en-us/library/e9b52ceh(VS.80).aspx
>> http://kernel.org/doc/man-pages/online/pages/man3/fetestexcept.3.html
>> etc.
>>
>> - Jay
>>
>> 		 	   		  =



More information about the M3devel mailing list