|
|
| version 1.22, 2002/08/01 11:26:44 | version 1.25, 2003/04/04 09:42:04 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b math parser class. | Parser: @b math parser class. |
| Copyright(c) 2001, 2002 ArtLebedev Group(http://www.artlebedev.com) | Copyright(c) 2001, 2003 ArtLebedev Group(http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru>(http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru>(http://paf.design.ru) |
| */ | */ |
| static const char* IDENT_MATH_C="$Id$"; | static const char* IDENT_MATH_C="$Date$"; |
| #include "pa_common.h" | #include "pa_common.h" |
| #include "pa_vint.h" | #include "pa_vint.h" |
| Line 47 static void _random(Request& r, const St | Line 47 static void _random(Request& r, const St |
| Pool& pool=r.pool(); | Pool& pool=r.pool(); |
| Value& range=params->as_junction(0, "range must be expression"); | Value& range=params->as_junction(0, "range must be expression"); |
| double top=r.process_to_value(range).as_double(); | double top=r.process_to_value(range).as_double(); |
| if(top<=1) | if(top<=0) |
| throw Exception("parser.runtime", | throw Exception("parser.runtime", |
| &method_name, | &method_name, |
| "top must be above 1(%g)", top); | "top must be above 0(%g)", top); |
| r.write_no_lang(*new(pool) VInt(pool, _random(uint(top)))); | r.write_no_lang(*new(pool) VInt(pool, _random(uint(top)))); |
| } | } |