Re: Inexactitude and node-list-ref

Subject: Re: Inexactitude and node-list-ref
From: Brandon Ibach <bibach@xxxxxxxxxxxxxx>
Date: Mon, 5 Apr 1999 19:47:13 -0500
Quoting Chris Maden <crism@xxxxxxxxxxx>:
> The math that I'm using to determine which <member> to handle causes
> Jade to complain:
> 
> jade:/usr/local/prod/sgml/dsssl/db2mif.dsl:2262:33:E: 2nd argument for
> primitive "node-list-ref" of wrong type: "0" not an exact integer
> 
> The Standard notes that for inexact input, some of the functions I'm
> using may return an inexact number.  Unfortunately, Jade doesn't
> implement inexact->exact, so I seem to be stuck.  Can anyone suggest a
> workaround, or even a cleaner algorithm?
> 
   Without actually checking the spec for which functions return
inexact results given exact arguments (feeling a bit lazy at the
moment), I think the problem is right here:

>       ((rows (ceiling (/ mem-len
>                          cols)))
> 
   The value of "rows" gets used in a lot of places, thus "infecting"
a lot of other values with inexactness.  Perhaps something like:
	(+ (quotient mem-len cols)
	   (if (< 0 (modulo mem-len cols)) 1 0)))

would work for the value of "rows".  Again, I'd have to check the
spec, but I would think that quotient and modulo would both return
exact values for exact arguments.
   On a more general level, doesn't Jade have an exactness predicate?
If so, that could be used in debugging code to find the source of a
value's inexactness, such that you could rewrite the appropriate
expression(s) to eliminate the inexact value.
   If you prefer the approach of turning an inexact value back into an
exact one, I would think a function such as ceiling should do so, but
perhaps not.  Is there another such function that can "filter" a value
back into exactness without really affecting the actual value?

-Brandon :)


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread