On Thu, Dec 13, 2007 at 11:40:49AM +0000, Niels Nes wrote:
> Update of /cvsroot/monetdb/MonetDB4/src/modules/plain
> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24024/src/modules/plain
> 
> Modified Files:
>       Tag: MonetDB_4-20
>       arith.mx 
> Log Message:
> added function sign (sql allready expected this to exist)
> 
> returns 1 for positive numbers
>       0 for 0 
>       -1 for negative
> 
> 
> Index: arith.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB4/src/modules/plain/arith.mx,v
> retrieving revision 1.3
> retrieving revision 1.3.6.1
> diff -u -d -r1.3 -r1.3.6.1
> --- arith.mx  20 Feb 2007 11:32:12 -0000      1.3
> +++ arith.mx  13 Dec 2007 11:40:47 -0000      1.3.6.1
> @@ -251,6 +251,7 @@
>  @= mel_unary_ops
>       .COMMAND abs(@1) : @1 = @1_unary_ABS; "absolute value"
>       .OPERATOR "-" (@1) : @1 = @1_unary_NEG; "negative value"
> +     .COMMAND sign(@1) : @1 = @1_unary_SIGN; "Returns +1, 0, -1 based on the 
> sign of the given expression"
>  @= unary_ops
>       @:@1_unary_ops(chr)@
>       @:@1_unary_ops(bte)@
> @@ -411,9 +412,11 @@
>  
>  #define arith_abs(s) ((s)<0)?-(s):(s)
>  #define arith_neg(s) (-(s))
> +#define arith_sign(s) ((s)<0)?-1:(s==0)?0:1
                          ^^^        ^
should(n't) the second "s" be in parentheses, too?

Stefan

>  @= c_unary_ops
>  @:arith_unop(_ABS,arith_abs,@1)@
>  @:arith_unop(_NEG,arith_neg,@1)@
> +@:arith_unop(_SIGN,arith_sign,@1)@
>  @c
>  @:unary_ops(c)@

-- 
| Dr. Stefan Manegold | mailto:[EMAIL PROTECTED] |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-developers

Reply via email to