[pure-lang-svn] SF.net SVN: pure-lang:[559] pure/trunk/lib
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-08-21 21:58:52
|
Revision: 559 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=559&view=rev Author: agraef Date: 2008-08-21 21:59:02 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Move inf, nan and the corresponding predicates to primitives.pure. Modified Paths: -------------- pure/trunk/lib/math.pure pure/trunk/lib/primitives.pure Modified: pure/trunk/lib/math.pure =================================================================== --- pure/trunk/lib/math.pure 2008-08-21 13:51:39 UTC (rev 558) +++ pure/trunk/lib/math.pure 2008-08-21 21:59:02 UTC (rev 559) @@ -18,10 +18,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* IEEE floating point infinities and NaNs. */ - -const inf = 1.0e307 * 1.0e307; const nan = inf-inf; - /* Random number generator. This uses the Mersenne twister, in order to avoid bad generators present in some C libraries. Returns pseudo random ints in the range -0x80000000..0x7fffffff. */ @@ -586,8 +582,3 @@ not (doublep x || doublep (re x) || doublep (im x)); inexactp x = numberp x && (doublep x || doublep (re x) || doublep (im x)); - -/* Check for inf and nan values. */ - -infp x = case x of x::double = x!==nan && x-x===nan; _ = 0 end; -nanp x = case x of x::double = x===nan; _ = 0 end; Modified: pure/trunk/lib/primitives.pure =================================================================== --- pure/trunk/lib/primitives.pure 2008-08-21 13:51:39 UTC (rev 558) +++ pure/trunk/lib/primitives.pure 2008-08-21 21:59:02 UTC (rev 559) @@ -62,6 +62,15 @@ tuplep (x,xs) = 1; tuplep _ = 0 otherwise; +/* IEEE floating point infinities and NaNs. */ + +const inf = 1.0e307 * 1.0e307; const nan = inf-inf; + +/* Predicates to check for inf and nan values. */ + +infp x = case x of x::double = x!==nan && x-x===nan; _ = 0 end; +nanp x = case x of x::double = x===nan; _ = 0 end; + /* Compute a 32 bit hash code of a Pure expression. */ extern int hash(expr*); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |