[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ShopSuite-dev] negatives work

From: Davi Leal
Subject: Re: [ShopSuite-dev] negatives work
Date: Mon, 27 Aug 2001 20:07:56 +0100

Tomasz Wegrzanowski wrote:

> It was really nasty bug.
> num/=g generated wrong assembly code because g was unsigned.
> After changing g to signed bug went away.
> I'm not sure if it's gcc bug or standard says it should be that way.

I have carried out the test with the new rational.c and it works. The previous
operations marked as ERR are now right.

Anyway I have added some tests with blanks into the argument and it raise always
zero '0/1'. It could be very good if the plug-in realize a strip-blanks 
before do its task. It would make the GUI task easier and less buggy.

I attack you the new step.sql

P.S.: The fact it is a gcc bug or ...  is out of my scope.  :)
-- rational_in() tests

select rational('1') AS one;
select rational('-1') AS minus_one;

select rational('0/0') AS undef;
select rational('0/1') AS zero;
select rational('0/2') AS zero;

select rational('1/0') AS undef;
select rational('9/0') AS undef;

select rational('1/2') AS half;
select rational('4/6') AS two_third;

select rational('-0/0') AS undef;
select rational('-0/1') AS zero;
select rational('-0/2') AS zero;

select rational('-1/0') AS undef;
select rational('-9/0') AS undef;

select rational('-1/2') AS minus_half;
select rational('-4/6') AS minus_two_third;

select rational(' 1 ') AS one_ERR;
select rational(' -1 ') AS minus_one_ERR;
select rational(' 9/0 ') AS undef_ERR;
select rational(' 1/2 ') AS half_ERR;
select rational(' -4/6 ') AS minus_two_third_ERR;

select rational(' 1') AS one_ERR;
select rational(' -1') AS minus_one_ERR;
select rational(' 9/0') AS undef_ERR;
select rational(' 1/2') AS half_ERR;
select rational(' -4/6') AS minus_two_third_ERR;

select rational('1 ') AS one_ERR;
select rational('-1 ') AS minus_one_ERR;
select rational('9/0 ') AS undef_ERR;
select rational('1/2 ') AS half_ERR;
select rational('-4/6 ') AS minus_two_third_ERR;

-- arith tests

select rational('0/1') + rational('1/2') AS half;
select rational('1/2') + rational('1/2') AS one;
select rational('1/2') + rational('-1/2') AS zero;
select rational('-1/2') + rational('-1/2') AS minus_one;

select rational('1/2') + rational('1/0') AS undef;
select rational('0/2') + rational('0/0') AS undef;
select rational('0/2') + rational('1/0') AS undef;
select rational('0/2') + rational('0/3') AS zero;

select rational('1/2') - rational('-1/2') AS one;
select rational('1/2') - rational('1/2') AS zero;
select rational('2/1') - rational('-1/1') AS three;
select rational('2/1') - rational('1/1') AS one;

select rational('2/1') * rational('1/2') AS one;
select rational('-1/2') * rational('-1/2') AS one_fourth;
select rational('1/2') * rational('-1/2') AS minus_one_fourth;
select rational('-1/2') * rational('1/2') AS minus_one_fourth;

select rational('2/3') / rational('2/3') AS one;
select rational('2/3') / rational('-3/2') AS minus_four_nineths;
select rational('-2/3') / rational('3/2') AS minus_four_nineths;

-- comparisions tests

select rational('0/1') = rational('1/2') AS false;
select rational('-1/2') > rational('1/2') AS false;
select rational('0/0') != rational('0/1') AS true;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]