shirayuki
028ec46ae6
Adding comments for grep
...
Change-Id: Ic3e57c5a06e6e227038aca85566255da5dfc990e
2013-03-08 17:16:56 +09:00
Reedy
e8905529b2
Add square root (sqrt) function
...
Change-Id: I2d7908be5ee964144ce10483c6f5834350c1c35b
2013-01-06 19:26:26 +00:00
IAlex
802c5f4405
Merge "Init $name"
2013-01-04 21:30:37 +00:00
Brad Jorsch
0fb7807e9a
(bug 43451) Restore old behavior of 'mod', add 'fmod'
...
In trying to fix bug 35866, I32c9eca6 changed the behavior of 'mod' to
no longer cast its arguments to integers, which conventiently also
solved bug 6068. However, this also broke many existing uses that
depended on that casting.
This change reverts 'mod' to its old behavior while still solving bug
35866, and at the same time adds a new 'fmod' operator with the new
behavior to keep bug 6068 fixed as well.
Change-Id: I6114c6e769119e6ced61b3b55b6f70b03b5b1ebe
2012-12-28 16:27:23 -05:00
Siebrand Mazeland
6259ee79c9
Init $name
...
Might not have been defined.
Change-Id: I8f088cc0fcdf0ea474c87b68d40d88e883f6e4df
2012-12-27 19:11:09 +00:00
Ori Livneh
00eca4460e
(Bug 6068) Use double precision for mod operator
...
Change-Id: I0efe4d5dd3ad3052972eb14ab75e979f8a18ff6f
2012-12-11 21:33:51 -08:00
Reedy
1a96b47d94
(Bug 35866) ParserFunctions: Division by zero in Expr.php
...
The PHP modulo operator ('%') casts its operands to ints, causing
floating point values 0 < $right < 1 to raise a divide-by-zero error.
Explicitly casting both operands to float and using fnmod() resolves the
issue. This change also tidies up the check for zero values and adds
tests.
Change-Id: I32c9eca6552e4fec248eb4fa6419faa39c10df3b
2012-12-11 03:21:58 -08:00
Reedy
ac8ad3f82e
Revert "Bug 35866 - ParserFunctions: Division by zero in Expr.php"
...
Seeemingly quite a lot of false positives...
This reverts commit a63cb85ae8
2012-12-07 00:59:10 +00:00
Reedy
a63cb85ae8
Bug 35866 - ParserFunctions: Division by zero in Expr.php
...
Change-Id: Ie9b101b69096e5021a05af1f7260fbc6611319ac
2012-12-06 23:49:23 +00:00
Siebrand Mazeland
5dee345880
ParserFunctions extension maintenance.
...
* Use Message class instead of wfMsg* methods.
* Replace additional deprecated methods.
* Fixed incorrect tag in i18n file.
* Update .gitignore.
Conflicts:
ParserFunctions.i18n.php
Change-Id: If21300c11ec628506cb56550bc91a24a5d7c45d2
2012-10-03 20:58:43 +00:00
Reedy
fdd7c091bd
Minor documentation additions
...
Change-Id: I876de41b2c81d93df34ee2a8222aff6dc8176aae
2012-07-23 20:56:17 +01:00
Sam Reed
ee97278b4d
Add some braces and also some documentation
2011-12-19 23:44:11 +00:00
Happy-melon
f274e42be1
Follow-up r81074:
...
* subclass ConvertError and ExprError from MWException
* invoking the parser for error messages clears state and exposes strip markers, and the error messages should be in the content language anyway
* clean up the magic word list
2011-01-29 13:54:02 +00:00
Sam Reed
5fa066a6e9
Start removing/fixing calls to deprecated methods in WMF used extensions
2010-10-29 15:14:44 +00:00
Siebrand Mazeland
20888253e0
* remove MediaWiki pre-1.8 compatibility and remove SprintfDateCompat.php
...
* bump version to 1.4.0
* run stylize.php
2010-10-02 22:36:34 +00:00
Chad Horohoe
7d289782c8
Revert r66934 (Removing wfLoadExtensionMessages() from everything). I disagree on principle...we branch extensions for this very reason. But people want trunk extensions compatible for several versions back, meh.
2010-05-27 15:56:53 +00:00
Chad Horohoe
1813ce38bb
Large commit. Removed 800+ references to no-op wfLoadExtensionMessages()
2010-05-26 22:25:32 +00:00
Andrew Garrett
e7bb4501f4
Revert Expr.php to r40762 for now -- still some errors that need tracking down and fixing.
2009-02-18 05:57:38 +00:00
Andrew Garrett
baaf9def26
Fix division by zero handling for BC -- 0 != "0.00"
2009-02-18 05:36:55 +00:00
Brion Vibber
47042d2584
fix regression -- bc compat check was reversed; attempting to call bcpow() when no bc :)
2009-02-18 05:23:56 +00:00
Andrew Garrett
5a331c7c28
Handle precision=0 correctly in bcround (it's the default anyway!)
2009-02-18 05:12:01 +00:00
Roan Kattouw
3c6bd5a6ec
ParserFunctions: Fix undefined variable warnings introduced in r47205
2009-02-16 10:08:31 +00:00
Andrew Garrett
67ad2159a1
Fix handling of 0, 0.0, 0.00 etc in logical functions.
2009-02-13 00:28:40 +00:00
Andrew Garrett
29f573fe22
Per Simetrical on code review, fix confused implementation of log (just convert to doubles and use the inaccurate floating-point math for now), and move initialisation to doExpression, instead of haveBC.
2009-02-12 23:49:30 +00:00
Andrew Garrett
d9fd747f2d
Revert "Adds explicit round-off checking to operations that are sensitive to floating point vs. integer round-off errors.", et al. ( r46683, r46671 )
...
Reimplement, but better! Use BC Math library where possible, for fixed-point math operations. The tolerance aspect has been included by doing math internally at 16 digits, but discarding the last two digits for the purpose of comparison.
2009-02-12 22:29:32 +00:00
Andrew Garrett
54de74c0ef
Fix glaring fatal.
2009-02-06 21:18:32 +00:00
Robert Rohde
a0fdcf7415
Adds explicit fractional tolerance checks to comparison functions. Currently set to 1e-10.
...
Addresses concerns related to r46671.
2009-02-01 18:40:26 +00:00
Robert Rohde
8f6382337c
Adds explicit round-off checking to operations that are sensitive to floating point vs. integer round-off errors.
...
Where applied, it assumes that any floating point number that is an integer to within one part in 10^10 should be replaced with that integer.
2009-02-01 03:56:24 +00:00
Aryeh Gregor
d8a4a48904
(bug 15349) Accept more types of minuses in #expr
...
{{#expr:1 − 2}} and {{#expr:1 − 2}} now work, in the same vein as {{#ifexpr:3 < 4|...}} does. This allows human-formatted template values to work more reliably when fed to #expr. Patch by Doug Strain.
2008-09-12 22:06:58 +00:00
Raimond Spekking
6bab1db29b
* (bug 13216 ) Add trigonometrical functions sin, cos, tan, asin, acos, atan and exp, ln, abs, floor, trunc, ceil, ^, and the constants pi and e.
...
This should help to avoid complicate templates which simulates these functions for geocoding purposes.
Patch by Rene Kijewski
2008-04-23 15:08:39 +00:00
Andrew Garrett
559348494d
Allow expr parser function to accept exponent input (i.e. 3e8). It seems silly to output in a format that we don't accept as input.
2008-03-28 11:59:12 +00:00
Siebrand Mazeland
04a88ee436
* use wfLoadExtensionMessages
...
* remove some unneeded blackslashes in messages (caused malformed error message)
* put Magic in separate file
* delay message loading
* add version in extension credits, remove EOL whitespace
* update Translate extension
2008-01-13 01:06:28 +00:00
Tim Starling
e1ca28d2f9
* Strip comments early, before template expansion. This mimics the behaviour in the old parser. Added parser tests demonstrating the regression this fixes. The syntactic effect is fairly elegant, with comments taking effect at source level, as expected. The removeHTMLcomments() and preprocessToDom() passes could be merged at a later date.
...
* No need for comment stripping in Expr.php anymore
* Updated srvus() to roughly account for these changes
* Gave comment handling its own preprocessor tag, and split off comment handling from extensionSubstitution(). This only applies for the non-HTML modes, since in HTML mode, comments are stripped early.
* Strip comments from template argument names (PPFrame::newChild).
2007-12-17 15:07:25 +00:00
Tim Starling
f06807863c
* Object versions of #ifexpr, #switch and #ifexist
...
* Fix for lack of StubObject in ~1.7
* Ignore HTML comments in expressions, which may now appear due to the parse order change
2007-12-09 08:11:38 +00:00
Raimond Spekking
5944437cb1
Use <strong> not <span>, per hint of Simetrical on wikitech-l. Thanks.
2007-11-19 15:37:49 +00:00
Raimond Spekking
e470229df5
* (bug 8773) Make error messages from expr.php localizable
...
** Move error messages to ParserFunctions.i18n.php
** Rename 'expr_...' to 'pfunc_expr_...' to be consistent with other messages which are localizable already
* Add CSS class 'error' to output of error messages
2007-11-16 08:02:24 +00:00
Brion Vibber
6f8f28792c
Renormalize invalid utf-8 byte in error message.
...
Would be better to work with an entire character, but it isn't that big a deal. :)
2007-08-31 14:08:16 +00:00
Aryeh Gregor
ddab9b72ee
Extensions too!
2007-06-29 01:36:09 +00:00
Antoine Musso
ccc136f753
remove some ending whitespaces
2007-01-06 20:56:46 +00:00
Brion Vibber
c8e0d935c0
fix line endings
2007-01-05 02:13:39 +00:00
Tim Starling
2477d59ae4
Exception-based error handling for expressions, plus a few other tweaks. Patch by AzaToth.
2006-11-21 07:22:13 +00:00
Jimmy Collins
d6b7f6f759
update for XHTML conformance
2006-07-07 18:01:48 +00:00
Tim Starling
3092bf1db5
Proper handling of division by zero
2006-04-12 04:00:46 +00:00
Tim Starling
4265df9c9a
Yay! Synonyms for all!
2006-04-07 00:23:46 +00:00
Tim Starling
c592fdf295
fixed stack check
2006-04-06 08:46:34 +00:00
Tim Starling
a49014ff5a
* Better error reporting
...
* Inequality operators
* rand function
2006-04-06 08:14:56 +00:00
Tim Starling
6d93dfe6b8
Mathematical expressions and conditional constructs implemented as parser functions. Documentation to follow.
2006-04-05 13:22:51 +00:00