Re: Remainder
- Posted by kbochert at copper.net Nov 08, 2003
- 678 views
On 8 Nov 2003 at 21:01, Pete Lomax wrote: > > > On Sat, 08 Nov 2003 10:17:44 -0800, kbochert at copper.net wrote: > > <snip> > > >How do you do this in EU?? > > HI Karl, Derek, > > I've just finished testing Derek's offering, and coded some 180 tests > from the IBM hursley test suite. It passes (to within 1e-6) all the > tests. I've also applied it to jbrown's fraclib routines, and they > pass with 100% accuracy, no need for a fudge check. Now if only > fraction types could be incorporated into the lanugage somehow... > > A copy of fraclib.e can be found on my website. > > Pete > http://palacebuilders.pwp.blueyonder.co.uk/euphoria.html > Without being able to understand all that code, I suspect that your use of fractions results in all remainders being done on integral arguments, and the standard fmod() works quite well there. I have only seen fmod()'s bad behavior occur with real, non-integral arguments that are multiples of one another (like: remainder (3.9, 1.3)) A really nice work-around!! (though I'm sure a fractions package has other reasons to exist) KtB