[M3devel] FloatMode

Jay K jay.krell at cornell.edu
Tue Jan 12 19:59:24 CET 2010


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.
 
 
I see these as three or possibly more separate areas.
 Integer overflow. 
 Integer divide by zero. 
 Floating point. 
 
 
Divide by zero in particular on NT/x86 and maybe other x86/AMD64 platforms is probably already "not silent", so not bad.
 
 
I'm not sure about unsigned/Word.T overflow, how that is supposed to be handled. In particular, signed overflow and unsigned overflow are slightly different, and unsigned/Word possibly suggests allowing silent overflow.
 
Again I really see quite a number of options here and programmer should indicate intent via choice of type or interface/function.
Fixed width, trap overflow, silent overflow, extent precision on overflow, etc.
 
 
I was talking to a friend about the integer/longint stuff.
 
 
 - Jay


________________________________
> From: hosking at cs.purdue.edu
> Date: Tue, 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, at 23:55, Jay K wrote:
>
> I thought FloatMode was only related to floating point.
> So I looked:
>
> "IntOverflow" = an integer operation produced a result whose
> absolute value is too large to be represented.
>
> "IntDivByZero" = 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 either.
>
> 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 on some platforms for some reason?
>
> Yes, that's the issue.
>
> For the floating point stuff:
>
> Probably like other per-platform code, this should be done in #ifdefed C.
>
> Agreed... does that mean you will bite? ;-)
>
>
> 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