revbank/lib/RevBank
Juerd Waalboer ef0039bc33 Handle huge numbers better
A sufficiently big number, i.e. longer than a long long, had interesting
effects. Perl would promote it to a float, and format it as -1 in
sprintf, which RevBank::Amount didn't handle correctly. In extreme cases
the number got rounded to Inf and would no longer round-trip.

As a result, numbers returned by RevBank::Amount are now Math::BigInt
and Math::BigFloat objects. Those should be transparent to all existing
code. It's amazing to see the unit tests pass.

I don't think there is any actual use case in RevBank for numbers this
large and I don't think anyone will have actually encountered the
aforementioned weird effects. Mostly, the input would be parsed with
parse_amount which refuses any number greater than 99900 anyway. Only
where parse_string was used directly, such large numbers could actually
have been used, but in stock RevBank that is only done when reading the
accounts file.

This change also introduces a new global function parse_any_amount that
is like parse_amount but doesn't complain about negative or large
numbers, to further improve the adduser plugin (see previous commit) in
insane edge cases. It differs from RevBank::Amount->parse_string in that
it does support addition and subtraction operators.
2024-08-28 05:19:02 +02:00
..
Cart Tweak output (increase indendation) 2023-12-26 19:33:11 +01:00
Amount.pm Handle huge numbers better 2024-08-28 05:19:02 +02:00
Amount.pod typo 2022-06-12 02:34:34 +02:00
Cart.pm Introduce ';' as command/transaction separator 2023-12-26 00:21:01 +01:00
Eval.pm cwd is no longer in @INC in new perl versions 2017-02-18 22:31:19 +01:00
FileIO.pm Explicitly use Perl 5.32 2023-12-12 00:28:17 +01:00
FileIO.pod Implement global advisory lock 2022-08-29 17:50:12 +02:00
Global.pm Handle huge numbers better 2024-08-28 05:19:02 +02:00
Global.pod Split documentation for RevBank::Global 2023-05-23 12:56:34 +02:00
Messages.pm Inflation 2024-05-17 22:48:18 +02:00
Plugin.pm Support control character escapes, add :AllChars attribute 2023-12-28 03:07:40 +01:00
Plugins.pm undo: deal with checkout exception 2023-12-26 02:08:24 +01:00
Plugins.pod Ignore all hook exceptions except in hook_checkout_prepare 2023-11-24 05:15:22 +01:00
Prompt.pm v6.1.2: fix retry prompt 2024-04-25 01:08:15 +02:00
TextEditor.pm Explicitly use Perl 5.32 2023-12-12 00:28:17 +01:00
TextEditor.pod bump to v3.5; add built-in editor 2022-08-30 20:45:01 +02:00
Users.pm v6.1.4: fix bug (0.00 balance account not usable) 2024-04-28 03:43:20 +02:00
Users.pod v6.1.1: Feature: warning messages for invalid accounts 2024-04-25 01:08:15 +02:00