Mat�as said:
> On Thursday, March 13, 2003, at 12:22  PM, Nathan Bubna wrote:
> > I meant that if any operation results in a mathematical whole
> > number, we ought to return an Integer (or Long if necessary).  If any
> > operation results in a value that is not a whole number, we ought to
> > return a Double.
>
> How would you test wholeness? Would you test after each operation, or
> after the entire expression tree is evaluated? What about performance?

these are implementation questions.  a very related, but nontheless
different subject.   and, being something of a hypocrite and goober, i don't
plan on implementing these features myself (at least not any time soon. i
have other priorities.) and thus have not thought things through that far.
as such, feel free to dismiss my opinion if you feel so inclined.

> > i think in the templates numbers should just be
> > numbers and they should Just Work (tm).  given that, i think whole
> > number
> > results should be returned as whole numbers (Integer) and so on.
>
> Well, then there is an alternative: Use Double arithmetic throughout,
> and convert Doubles to their decimal representation using the minimum
> quantity of digits needed to make the round-trip conversion idempotent.
> This is what ecvt() does in C. To put it differently, operate on
> doubles, but instead of calling toString() when instantiating the
> references, call something else that makes 2.0 appear as "2" and
> 2.4999999995 appear as "3.5" and so forth.
>
> Easy, simple, no run-time penalties on expressions.

eh... didn't totally follow that.  idempotent... where are my old math
textbooks these days?  hmm.  "calling toString() when instantiating the
references"...  do you mean rendering the references?  if so, i don't know
enough about velocity's guts yet to know if it's setup to render via
anything but toString(), but it sounds hackish...  it'd be better even to
create our own number wrapper with a toString() that does what you describe.
but even then...  i'm not sure if that's a good way to go.  eh, i'll leave
these implementation questions to those who'll implement.  in the meantime,
i'll stick to theory and big picture stuff on this issue.  :-/

Nathan Bubna
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to