mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Fixes #555
This commit is contained in:
parent
401fcd54be
commit
15c7691c09
@ -980,8 +980,10 @@ module UserFacing = struct
|
||||
aux (Z.abs n)
|
||||
|
||||
let money (lang : Cli.backend_lang) ppf n =
|
||||
let num = Z.abs n in
|
||||
let units, cents = Z.div_rem num (Z.of_int 100) in
|
||||
if Z.sign n < 0 then Format.pp_print_char ppf '-';
|
||||
(match lang with En -> Format.pp_print_string ppf "$" | Fr | Pl -> ());
|
||||
let units, cents = Z.div_rem n (Z.of_int 100) in
|
||||
integer lang ppf units;
|
||||
Format.pp_print_string ppf (decsep lang);
|
||||
Format.fprintf ppf "%02d" (Z.to_int (Z.abs cents));
|
||||
|
@ -7,15 +7,15 @@ declaration scope A:
|
||||
|
||||
scope A:
|
||||
definition x equals $0.15 * 2.0
|
||||
definition y equals $0.3
|
||||
assertion x = y
|
||||
definition y equals - $0.3
|
||||
assertion x = - y
|
||||
```
|
||||
|
||||
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] Invariant typing_defaults checked. result: [25/25]
|
||||
[RESULT] Invariant typing_defaults checked. result: [27/27]
|
||||
[RESULT] Invariant match_inversion checked. result: [0/0]
|
||||
[RESULT] Invariant app_inversion checked. result: [0/0]
|
||||
[RESULT] Invariant no_return_a_function checked. result: [0/0]
|
||||
@ -28,11 +28,11 @@ $ catala Typecheck --check-invariants
|
||||
$ catala Interpret -s A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = $0.30
|
||||
[RESULT] y = $0.30
|
||||
[RESULT] y = -$0.30
|
||||
```
|
||||
```catala-test-inline
|
||||
$ catala Interpret_Lcalc -s A --avoid-exceptions --optimize
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = $0.30
|
||||
[RESULT] y = $0.30
|
||||
[RESULT] y = -$0.30
|
||||
```
|
||||
|
@ -76,7 +76,7 @@ $ catala Interpret -s S
|
||||
[RESULT] o_b = true
|
||||
[RESULT] o_d = [-13 days]
|
||||
[RESULT] o_i = -5
|
||||
[RESULT] o_m = $-5.75
|
||||
[RESULT] o_m = -$5.75
|
||||
[RESULT] o_t = 2022-01-24
|
||||
[RESULT] o_x = 0.142,857,142,857,142,857,14…
|
||||
```
|
||||
@ -86,7 +86,7 @@ $ catala Interpret_Lcalc -s S --avoid-exceptions --optimize
|
||||
[RESULT] o_b = true
|
||||
[RESULT] o_d = [-13 days]
|
||||
[RESULT] o_i = -5
|
||||
[RESULT] o_m = $-5.75
|
||||
[RESULT] o_m = -$5.75
|
||||
[RESULT] o_t = 2022-01-24
|
||||
[RESULT] o_x = 0.142,857,142,857,142,857,14…
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user