|
From: Dave D. <dde...@es...> - 2004-08-05 16:52:08
|
Reginald Beardsley <rb...@su...> writes:
> In my view, this violates the principle of "least surprise". It
> took me over an hour to figure out why things didn't plot where
> I expected.
>
> plot [x=0:10] x/3+13/3,x/3+13.0/3.0
>
> I'm quite familiar w/ the rules for integer math, I just had no
> reason to expect integer math rules in this context.
>
This crops up so often... I wonder if it is worth putting in special
code to detect division of two integer constants, and warn once per
session. (every evaluation would obviously be too often)
Just a quick scan over the action table after parsing, to detect the
sequence (puchc int), (pushc int), div
gnuplot> show at x/3.0 + 10/3
push x
pushc 3.0
div
pushc 10
pushc 3
div
plus
Or even - when appending the 'div' action, peek back at the previous
two entries.
This isn't going to catch the sequence
x=13
print x/3
but it might stop the user scratching their head for too long if they
then resort to typing in things like
print 13/3
dd
--
Dave Denholm <dde...@es...> http://www.esmertec.com
|