#343 plot of translated fnc incompatible with interp

closed
nobody
None
5
2006-03-28
2003-07-08
No

********First kind of error *********

f(x):=entier(x)$
plot2d(f(x),[x,0,1]) /* fine */ $
translate(f)$

plot2d(f(x),[x,0,1])$

=> can't use non-numeric string as operand of "-"

(from the tcl process)

********** Second kind of error *********

plot2d(sin,[x,0,%pi]) => undefined func

Instead, you have to say:

plot2d(verbify(sin),[x,0,%pi])

Yuck.

******************

Coerce-float-fun is responsible for wrapping the input
function with ($float ($realpart (meval* ...))). But it
does NOT wrap translated functions (or any other
function defined in Lisp or natively). It apparently
assumes that they produce real, floating-point results.
That is a poor assumption. It should wrap them with
($float ($realpart ...)) for compatibility with the
interpreted version.

I don't know exactly what goes wrong after that, but he
tcl error log reads:

>>>>>>>>>>>
can't use non-numeric string as operand of "-"
while executing
"expr {($max-$min)/1.7}"
(procedure "plot2dRangesToRadius" line 15)
invoked from within
"plot2dRangesToRadius {0.0000000000 1.0000000000}
{1.0000000000 4.2522806284830684E-314} {}"
<<<<<<<<<<<<

Note that 4.24E-314 is a denormalized number; was this
created by interpreting a fixnum as a float? Does tcl
have some problem handling denormalized numbers?

Discussion

  • Raymond Toy

    Raymond Toy - 2005-12-05

    Logged In: YES
    user_id=28849

    The first issue doesn't seem to happen anymore. Both the
    interpreted and translated function produce the same plot.

     
  • Robert Dodier

    Robert Dodier - 2006-03-28

    Logged In: YES
    user_id=501686

    About the second kind of error, I've committed r.162 of
    src/plot.lisp to extend COERCE-FLOAT-FUN to recognize
    simplifying functions (and some other cases). Now
    plot2d(sin,[x,0,%pi]); works as expected.

    About the first error, I don't observe it either.

    Closing this report as fixed on both counts.

     
  • Robert Dodier

    Robert Dodier - 2006-03-28
    • status: open --> closed
     

Log in to post a comment.