🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.theory
Article #2088

Re: Modulus (Re: hashing function for strings)

#2088
From: Joe Keane
Date: Fri, 23 Feb 1990 14:36
22 lines
1915 bytes
The main problem is that you're trying to assign an operator to one of many
possible different functions.  I have my favorites, but someone will always
want a different one from what you pick.

Let's say we just want to convert a floating point number to an integer.
There are a number of rounding possibilities, up, down, toward zero, away from
zero, and to nearest.  And if you're rounding to nearest, what do you do if
you're halfway in between?  Again you can go up, down, toward zero, away from
zero, or my favorite, pick the even one.

Just when you think you've got it down, some weird case shows up; for example,
should 1 mod -2 be 1 or -1?  I won't even get into 0 vs. -0 or infinities and
not-a-numbers.  Good thing IEEE and ANSI define the way these things should
work.  Trouble is, they don't always agree with each other.

Even in the BASIC on my HP-71 there are four functions to convert a floating
point number to an integer, and three functions to take remainders in
different ways.  I just looked in the Unix manual section RINT(3M) and there
are seven functions provided to convert a floating point number to an integer.

If you think this is all kid's stuff, try getting the branch cuts right in
your complex inverse hyperbolic functions.  Fun stuff.
Technical Details
Message-ID: <2069@osc.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!jarthur!elroy.jpl.nasa.gov!ames!pacbell!osc!jgk
References: <2367@castle.ed.ac.uk> <12077@goofy.megatest.UUCP> <Er$cfg@cs.psu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!jarthur!elroy.jpl.nasa.gov!ames!pacbell!osc!jgk
From: jgk@osc.COM (Joe Keane)
Newsgroups: comp.theory,comp.misc,comp.lang.misc
Subject: Re: Modulus (Re: hashing function for strings)
Summary: Implementing math is pretty hard sometimes.
Message-ID: <2069@osc.COM>
Date: 23 Feb 90 14:36:47 GMT
References: <2367@castle.ed.ac.uk> <12077@goofy.megatest.UUCP> <Er$cfg@cs.psu.edu>
Reply-To: jgk@osc.osc.COM (Joe Keane)
Followup-To: comp.theory
Organization: Object Sciences Corp., Menlo Park, CA
Lines: 22