Replace the type conversion and rounding operators with overloads

Ref. #366

Also updates `CONTRIBUTING.md`.

This was pretty straight-forward :)
This commit is contained in:
Louis Gesbert 2022-12-13 13:28:01 +01:00
parent c94509e0bb
commit f236e2cfb2
35 changed files with 7789 additions and 7881 deletions

View File

@ -104,19 +104,20 @@ need more, here is how one can be added:
- Choose a name wisely. Be ready to patch any code that already used the name - Choose a name wisely. Be ready to patch any code that already used the name
for scope parameters, variables or structure fields, since it won't compile for scope parameters, variables or structure fields, since it won't compile
anymore. anymore.
- Add an element to the `builtin_expression` type in `surface/ast.ml(i)` - Add an element to the `builtin_expression` type in `surface/ast.ml`
- Add your builtin in the `builtins` list in `surface/lexer.cppo.ml`, and with - Add your builtin in the `builtins` list in `surface/lexer.cppo.ml`, and with
proper translations in all of the language-specific modules proper translations in all of the language-specific modules
`surface/lexer_en.cppo.ml`, `surface/lexer_fr.cppo.ml`, etc. Don't forget the `surface/lexer_en.cppo.ml`, `surface/lexer_fr.cppo.ml`, etc. Don't forget the
macro at the beginning of `lexer.cppo.ml`. macro at the beginning of `lexer.cppo.ml`.
- The rest can all be done by following the type errors downstream: - The rest can all be done by following the type errors downstream:
- Add a corresponding element to the lower-level AST in `dcalc/ast.ml(i)`, type `unop` - Add a corresponding element to the lower-level AST in `shared_ast/definitions.ml`, type `Op.t`
- Extend the translation accordingly in `surface/desugaring.ml` - Extend the generic operations on operators in `shared_ast/operators.ml` as well as the type information for the operator
- Extend the printer (`dcalc/print.ml`) and the typer with correct type - Extend the translation accordingly in `desugared/from_surface.ml`
information (`dcalc/typing.ml`) - Extend the printer (`shared_ast/print.ml`)
- Finally, provide the implementations: - Finally, provide the implementations:
- in `lcalc/to_ocaml.ml`, function `format_unop`
- in `dcalc/interpreter.ml`, function `evaluate_operator` - in `dcalc/interpreter.ml`, function `evaluate_operator`
- in `../runtimes/ocaml/runtime.ml`
- in `../runtimes/python/catala/src/catala/runtime.py`
- Update the syntax guide in `doc/syntax/syntax.tex` with your new builtin - Update the syntax guide in `doc/syntax/syntax.tex` with your new builtin
### Internationalization of the Catala syntax ### Internationalization of the Catala syntax

View File

@ -211,22 +211,16 @@ and evaluate_operator :
let rlit = let rlit =
match op, List.map (function ELit l, _ -> l | _ -> err ()) args with match op, List.map (function ELit l, _ -> l | _ -> err ()) args with
| Not, [LBool b] -> LBool (o_not b) | Not, [LBool b] -> LBool (o_not b)
| IntToRat, [LInt i] -> LRat (o_intToRat i)
| MoneyToRat, [LMoney i] -> LRat (o_moneyToRat i)
| RatToMoney, [LRat i] -> LMoney (o_ratToMoney i)
| GetDay, [LDate d] -> LInt (o_getDay d) | GetDay, [LDate d] -> LInt (o_getDay d)
| GetMonth, [LDate d] -> LInt (o_getMonth d) | GetMonth, [LDate d] -> LInt (o_getMonth d)
| GetYear, [LDate d] -> LInt (o_getYear d) | GetYear, [LDate d] -> LInt (o_getYear d)
| FirstDayOfMonth, [LDate d] -> LDate (o_firstDayOfMonth d) | FirstDayOfMonth, [LDate d] -> LDate (o_firstDayOfMonth d)
| LastDayOfMonth, [LDate d] -> LDate (o_lastDayOfMonth d) | LastDayOfMonth, [LDate d] -> LDate (o_lastDayOfMonth d)
| RoundMoney, [LMoney m] -> LMoney (o_roundMoney m)
| RoundDecimal, [LRat m] -> LRat (o_roundDecimal m)
| And, [LBool b1; LBool b2] -> LBool (o_and b1 b2) | And, [LBool b1; LBool b2] -> LBool (o_and b1 b2)
| Or, [LBool b1; LBool b2] -> LBool (o_or b1 b2) | Or, [LBool b1; LBool b2] -> LBool (o_or b1 b2)
| Xor, [LBool b1; LBool b2] -> LBool (o_xor b1 b2) | Xor, [LBool b1; LBool b2] -> LBool (o_xor b1 b2)
| ( ( Not | IntToRat | MoneyToRat | RatToMoney | GetDay | GetMonth | ( ( Not | GetDay | GetMonth | GetYear | FirstDayOfMonth
| GetYear | FirstDayOfMonth | LastDayOfMonth | RoundMoney | LastDayOfMonth | And | Or | Xor ),
| RoundDecimal | And | Or | Xor ),
_ ) -> _ ) ->
err () err ()
in in
@ -238,6 +232,11 @@ and evaluate_operator :
| Minus_rat, [LRat x] -> LRat (o_minus_rat x) | Minus_rat, [LRat x] -> LRat (o_minus_rat x)
| Minus_mon, [LMoney x] -> LMoney (o_minus_mon x) | Minus_mon, [LMoney x] -> LMoney (o_minus_mon x)
| Minus_dur, [LDuration x] -> LDuration (o_minus_dur x) | Minus_dur, [LDuration x] -> LDuration (o_minus_dur x)
| ToRat_int, [LInt i] -> LRat (o_torat_int i)
| ToRat_mon, [LMoney i] -> LRat (o_torat_mon i)
| ToMoney_rat, [LRat i] -> LMoney (o_tomoney_rat i)
| Round_mon, [LMoney m] -> LMoney (o_round_mon m)
| Round_rat, [LRat m] -> LRat (o_round_rat m)
| Add_int_int, [LInt x; LInt y] -> LInt (o_add_int_int x y) | Add_int_int, [LInt x; LInt y] -> LInt (o_add_int_int x y)
| Add_rat_rat, [LRat x; LRat y] -> LRat (o_add_rat_rat x y) | Add_rat_rat, [LRat x; LRat y] -> LRat (o_add_rat_rat x y)
| Add_mon_mon, [LMoney x; LMoney y] -> LMoney (o_add_mon_mon x y) | Add_mon_mon, [LMoney x; LMoney y] -> LMoney (o_add_mon_mon x y)
@ -292,7 +291,8 @@ and evaluate_operator :
| Eq_dat_dat, [LDate x; LDate y] -> LBool (o_eq_dat_dat x y) | Eq_dat_dat, [LDate x; LDate y] -> LBool (o_eq_dat_dat x y)
| Eq_dur_dur, [LDuration x; LDuration y] -> | Eq_dur_dur, [LDuration x; LDuration y] ->
LBool (protect o_eq_dur_dur x y) LBool (protect o_eq_dur_dur x y)
| ( ( Minus_int | Minus_rat | Minus_mon | Minus_dur | Add_int_int | ( ( Minus_int | Minus_rat | Minus_mon | Minus_dur | ToRat_int
| ToRat_mon | ToMoney_rat | Round_rat | Round_mon | Add_int_int
| Add_rat_rat | Add_mon_mon | Add_dat_dur | Add_dur_dur | Add_rat_rat | Add_mon_mon | Add_dat_dur | Add_dur_dur
| Sub_int_int | Sub_rat_rat | Sub_mon_mon | Sub_dat_dat | Sub_int_int | Sub_rat_rat | Sub_mon_mon | Sub_dat_dat
| Sub_dat_dur | Sub_dur_dur | Mult_int_int | Mult_rat_rat | Sub_dat_dur | Sub_dur_dur | Mult_int_int | Mult_rat_rat

View File

@ -687,17 +687,15 @@ let rec translate_expr
Expr.eapp Expr.eapp
(Expr.eop Fold [TAny, pos; TAny, pos; TAny, pos] emark) (Expr.eop Fold [TAny, pos; TAny, pos; TAny, pos] emark)
[f; init; collection] emark [f; init; collection] emark
| Builtin IntToDec -> Expr.eop IntToRat [TLit TInt, pos] emark | Builtin ToDecimal -> Expr.eop ToRat [TAny, pos] emark
| Builtin MoneyToDec -> Expr.eop MoneyToRat [TLit TMoney, pos] emark | Builtin ToMoney -> Expr.eop ToMoney [TAny, pos] emark
| Builtin DecToMoney -> Expr.eop RatToMoney [TLit TRat, pos] emark | Builtin Round -> Expr.eop Round [TAny, pos] emark
| Builtin Cardinal -> Expr.eop Length [TArray (TAny, pos), pos] emark | Builtin Cardinal -> Expr.eop Length [TArray (TAny, pos), pos] emark
| Builtin GetDay -> Expr.eop GetDay [TLit TDate, pos] emark | Builtin GetDay -> Expr.eop GetDay [TLit TDate, pos] emark
| Builtin GetMonth -> Expr.eop GetMonth [TLit TDate, pos] emark | Builtin GetMonth -> Expr.eop GetMonth [TLit TDate, pos] emark
| Builtin GetYear -> Expr.eop GetYear [TLit TDate, pos] emark | Builtin GetYear -> Expr.eop GetYear [TLit TDate, pos] emark
| Builtin FirstDayOfMonth -> Expr.eop FirstDayOfMonth [TLit TDate, pos] emark | Builtin FirstDayOfMonth -> Expr.eop FirstDayOfMonth [TLit TDate, pos] emark
| Builtin LastDayOfMonth -> Expr.eop LastDayOfMonth [TLit TDate, pos] emark | Builtin LastDayOfMonth -> Expr.eop LastDayOfMonth [TLit TDate, pos] emark
| Builtin RoundMoney -> Expr.eop RoundMoney [TLit TMoney, pos] emark
| Builtin RoundDecimal -> Expr.eop RoundDecimal [TLit TRat, pos] emark
and disambiguate_match_and_build_expression and disambiguate_match_and_build_expression
(scope : ScopeName.t) (scope : ScopeName.t)

View File

@ -60,16 +60,16 @@ let format_op
(* Todo: use the names from [Operator.name] *) (* Todo: use the names from [Operator.name] *)
| Not -> Format.pp_print_string fmt "not" | Not -> Format.pp_print_string fmt "not"
| Length -> Format.pp_print_string fmt "list_length" | Length -> Format.pp_print_string fmt "list_length"
| IntToRat -> Format.pp_print_string fmt "decimal_of_integer" | ToRat_int -> Format.pp_print_string fmt "decimal_of_integer"
| MoneyToRat -> Format.pp_print_string fmt "decimal_of_money" | ToRat_mon -> Format.pp_print_string fmt "decimal_of_money"
| RatToMoney -> Format.pp_print_string fmt "money_of_decimal" | ToMoney_rat -> Format.pp_print_string fmt "money_of_decimal"
| GetDay -> Format.pp_print_string fmt "day_of_month_of_date" | GetDay -> Format.pp_print_string fmt "day_of_month_of_date"
| GetMonth -> Format.pp_print_string fmt "month_number_of_date" | GetMonth -> Format.pp_print_string fmt "month_number_of_date"
| GetYear -> Format.pp_print_string fmt "year_of_date" | GetYear -> Format.pp_print_string fmt "year_of_date"
| FirstDayOfMonth -> Format.pp_print_string fmt "first_day_of_month" | FirstDayOfMonth -> Format.pp_print_string fmt "first_day_of_month"
| LastDayOfMonth -> Format.pp_print_string fmt "last_day_of_month" | LastDayOfMonth -> Format.pp_print_string fmt "last_day_of_month"
| RoundMoney -> Format.pp_print_string fmt "money_round" | Round_mon -> Format.pp_print_string fmt "money_round"
| RoundDecimal -> Format.pp_print_string fmt "decimal_round" | Round_rat -> Format.pp_print_string fmt "decimal_round"
| Add_int_int | Add_rat_rat | Add_mon_mon | Add_dat_dur | Add_dur_dur | Concat | Add_int_int | Add_rat_rat | Add_mon_mon | Add_dat_dur | Add_dur_dur | Concat
-> ->
Format.pp_print_string fmt "+" Format.pp_print_string fmt "+"

View File

@ -123,17 +123,11 @@ module Op = struct
(* unary *) (* unary *)
(* * monomorphic *) (* * monomorphic *)
| Not : ('a any, monomorphic) t | Not : ('a any, monomorphic) t
(* Todo: [AToB] operators could actually be overloaded [ToB] operators*)
| IntToRat : ('a any, monomorphic) t
| MoneyToRat : ('a any, monomorphic) t
| RatToMoney : ('a any, monomorphic) t
| GetDay : ('a any, monomorphic) t | GetDay : ('a any, monomorphic) t
| GetMonth : ('a any, monomorphic) t | GetMonth : ('a any, monomorphic) t
| GetYear : ('a any, monomorphic) t | GetYear : ('a any, monomorphic) t
| FirstDayOfMonth : ('a any, monomorphic) t | FirstDayOfMonth : ('a any, monomorphic) t
| LastDayOfMonth : ('a any, monomorphic) t | LastDayOfMonth : ('a any, monomorphic) t
| RoundMoney : ('a any, monomorphic) t
| RoundDecimal : ('a any, monomorphic) t
(* * polymorphic *) (* * polymorphic *)
| Length : ('a any, polymorphic) t | Length : ('a any, polymorphic) t
| Log : log_entry * Uid.MarkedString.info list -> ('a any, polymorphic) t | Log : log_entry * Uid.MarkedString.info list -> ('a any, polymorphic) t
@ -143,6 +137,14 @@ module Op = struct
| Minus_rat : ([< scopelang | dcalc | lcalc ], resolved) t | Minus_rat : ([< scopelang | dcalc | lcalc ], resolved) t
| Minus_mon : ([< scopelang | dcalc | lcalc ], resolved) t | Minus_mon : ([< scopelang | dcalc | lcalc ], resolved) t
| Minus_dur : ([< scopelang | dcalc | lcalc ], resolved) t | Minus_dur : ([< scopelang | dcalc | lcalc ], resolved) t
| ToRat : (desugared, overloaded) t
| ToRat_int : ([< scopelang | dcalc | lcalc ], resolved) t
| ToRat_mon : ([< scopelang | dcalc | lcalc ], resolved) t
| ToMoney : (desugared, overloaded) t
| ToMoney_rat : ([< scopelang | dcalc | lcalc ], resolved) t
| Round : (desugared, overloaded) t
| Round_rat : ([< scopelang | dcalc | lcalc ], resolved) t
| Round_mon : ([< scopelang | dcalc | lcalc ], resolved) t
(* binary *) (* binary *)
(* * monomorphic *) (* * monomorphic *)
| And : ('a any, monomorphic) t | And : ('a any, monomorphic) t

View File

@ -21,22 +21,25 @@ include Definitions.Op
let name : type a k. (a, k) t -> string = function let name : type a k. (a, k) t -> string = function
| Not -> "o_not" | Not -> "o_not"
| Length -> "o_length" | Length -> "o_length"
| IntToRat -> "o_intToRat"
| MoneyToRat -> "o_moneyToRat"
| RatToMoney -> "o_ratToMoney"
| GetDay -> "o_getDay" | GetDay -> "o_getDay"
| GetMonth -> "o_getMonth" | GetMonth -> "o_getMonth"
| GetYear -> "o_getYear" | GetYear -> "o_getYear"
| FirstDayOfMonth -> "o_firstDayOfMonth" | FirstDayOfMonth -> "o_firstDayOfMonth"
| LastDayOfMonth -> "o_lastDayOfMonth" | LastDayOfMonth -> "o_lastDayOfMonth"
| RoundMoney -> "o_roundMoney"
| RoundDecimal -> "o_roundDecimal"
| Log _ -> "o_log" | Log _ -> "o_log"
| Minus -> "o_minus" | Minus -> "o_minus"
| Minus_int -> "o_minus_int" | Minus_int -> "o_minus_int"
| Minus_rat -> "o_minus_rat" | Minus_rat -> "o_minus_rat"
| Minus_mon -> "o_minus_mon" | Minus_mon -> "o_minus_mon"
| Minus_dur -> "o_minus_dur" | Minus_dur -> "o_minus_dur"
| ToRat -> "o_torat"
| ToRat_int -> "o_torat_int"
| ToRat_mon -> "o_torat_mon"
| ToMoney -> "o_tomoney"
| ToMoney_rat -> "o_tomoney_rat"
| Round -> "o_round"
| Round_rat -> "o_round_rat"
| Round_mon -> "o_round_mon"
| And -> "o_and" | And -> "o_and"
| Or -> "o_or" | Or -> "o_or"
| Xor -> "o_xor" | Xor -> "o_xor"
@ -123,21 +126,24 @@ let compare (type a k a2 k2) (t1 : (a, k) t) (t2 : (a2, k2) t) =
| n -> n) | n -> n)
| Not, Not | Not, Not
| Length, Length | Length, Length
| IntToRat, IntToRat
| MoneyToRat, MoneyToRat
| RatToMoney, RatToMoney
| GetDay, GetDay | GetDay, GetDay
| GetMonth, GetMonth | GetMonth, GetMonth
| GetYear, GetYear | GetYear, GetYear
| FirstDayOfMonth, FirstDayOfMonth | FirstDayOfMonth, FirstDayOfMonth
| LastDayOfMonth, LastDayOfMonth | LastDayOfMonth, LastDayOfMonth
| RoundMoney, RoundMoney
| RoundDecimal, RoundDecimal
| Minus, Minus | Minus, Minus
| Minus_int, Minus_int | Minus_int, Minus_int
| Minus_rat, Minus_rat | Minus_rat, Minus_rat
| Minus_mon, Minus_mon | Minus_mon, Minus_mon
| Minus_dur, Minus_dur | Minus_dur, Minus_dur
| ToRat, ToRat
| ToRat_int, ToRat_int
| ToRat_mon, ToRat_mon
| ToMoney, ToMoney
| ToMoney_rat, ToMoney_rat
| Round, Round
| Round_rat, Round_rat
| Round_mon, Round_mon
| And, And | And, And
| Or, Or | Or, Or
| Xor, Xor | Xor, Xor
@ -201,22 +207,25 @@ let compare (type a k a2 k2) (t1 : (a, k) t) (t2 : (a2, k2) t) =
| Fold, Fold -> 0 | Fold, Fold -> 0
| Not, _ -> -1 | _, Not -> 1 | Not, _ -> -1 | _, Not -> 1
| Length, _ -> -1 | _, Length -> 1 | Length, _ -> -1 | _, Length -> 1
| IntToRat, _ -> -1 | _, IntToRat -> 1
| MoneyToRat, _ -> -1 | _, MoneyToRat -> 1
| RatToMoney, _ -> -1 | _, RatToMoney -> 1
| GetDay, _ -> -1 | _, GetDay -> 1 | GetDay, _ -> -1 | _, GetDay -> 1
| GetMonth, _ -> -1 | _, GetMonth -> 1 | GetMonth, _ -> -1 | _, GetMonth -> 1
| GetYear, _ -> -1 | _, GetYear -> 1 | GetYear, _ -> -1 | _, GetYear -> 1
| FirstDayOfMonth, _ -> -1 | _, FirstDayOfMonth -> 1 | FirstDayOfMonth, _ -> -1 | _, FirstDayOfMonth -> 1
| LastDayOfMonth, _ -> -1 | _, LastDayOfMonth -> 1 | LastDayOfMonth, _ -> -1 | _, LastDayOfMonth -> 1
| RoundMoney, _ -> -1 | _, RoundMoney -> 1
| RoundDecimal, _ -> -1 | _, RoundDecimal -> 1
| Log _, _ -> -1 | _, Log _ -> 1 | Log _, _ -> -1 | _, Log _ -> 1
| Minus, _ -> -1 | _, Minus -> 1 | Minus, _ -> -1 | _, Minus -> 1
| Minus_int, _ -> -1 | _, Minus_int -> 1 | Minus_int, _ -> -1 | _, Minus_int -> 1
| Minus_rat, _ -> -1 | _, Minus_rat -> 1 | Minus_rat, _ -> -1 | _, Minus_rat -> 1
| Minus_mon, _ -> -1 | _, Minus_mon -> 1 | Minus_mon, _ -> -1 | _, Minus_mon -> 1
| Minus_dur, _ -> -1 | _, Minus_dur -> 1 | Minus_dur, _ -> -1 | _, Minus_dur -> 1
| ToRat, _ -> -1 | _, ToRat -> 1
| ToRat_int, _ -> -1 | _, ToRat_int -> 1
| ToRat_mon, _ -> -1 | _, ToRat_mon -> 1
| ToMoney, _ -> -1 | _, ToMoney -> 1
| ToMoney_rat, _ -> -1 | _, ToMoney_rat -> 1
| Round, _ -> -1 | _, Round -> 1
| Round_rat, _ -> -1 | _, Round_rat -> 1
| Round_mon, _ -> -1 | _, Round_mon -> 1
| And, _ -> -1 | _, And -> 1 | And, _ -> -1 | _, And -> 1
| Or, _ -> -1 | _, Or -> 1 | Or, _ -> -1 | _, Or -> 1
| Xor, _ -> -1 | _, Xor -> 1 | Xor, _ -> -1 | _, Xor -> 1
@ -294,15 +303,16 @@ let kind_dispatch :
fun ~polymorphic ~monomorphic ?(overloaded = fun _ -> assert false) fun ~polymorphic ~monomorphic ?(overloaded = fun _ -> assert false)
?(resolved = fun _ -> assert false) op -> ?(resolved = fun _ -> assert false) op ->
match op with match op with
| ( Not | IntToRat | MoneyToRat | RatToMoney | GetDay | GetMonth | GetYear | ( Not | GetDay | GetMonth | GetYear | FirstDayOfMonth | LastDayOfMonth | And
| FirstDayOfMonth | LastDayOfMonth | RoundMoney | RoundDecimal | And | Or | Or | Xor ) as op ->
| Xor ) as op ->
monomorphic op monomorphic op
| (Log _ | Length | Eq | Map | Concat | Filter | Reduce | Fold) as op -> | (Log _ | Length | Eq | Map | Concat | Filter | Reduce | Fold) as op ->
polymorphic op polymorphic op
| (Minus | Add | Sub | Mult | Div | Lt | Lte | Gt | Gte) as op -> | ( Minus | ToRat | ToMoney | Round | Add | Sub | Mult | Div | Lt | Lte | Gt
| Gte ) as op ->
overloaded op overloaded op
| ( Minus_int | Minus_rat | Minus_mon | Minus_dur | Add_int_int | Add_rat_rat | ( Minus_int | Minus_rat | Minus_mon | Minus_dur | ToRat_int | ToRat_mon
| ToMoney_rat | Round_rat | Round_mon | Add_int_int | Add_rat_rat
| Add_mon_mon | Add_dat_dur | Add_dur_dur | Sub_int_int | Sub_rat_rat | Add_mon_mon | Add_dat_dur | Add_dur_dur | Sub_int_int | Sub_rat_rat
| Sub_mon_mon | Sub_dat_dat | Sub_dat_dur | Sub_dur_dur | Mult_int_int | Sub_mon_mon | Sub_dat_dat | Sub_dat_dur | Sub_dur_dur | Mult_int_int
| Mult_rat_rat | Mult_mon_rat | Mult_dur_int | Div_int_int | Div_rat_rat | Mult_rat_rat | Mult_mon_rat | Mult_dur_int | Div_int_int | Div_rat_rat
@ -331,16 +341,11 @@ let translate :
| Reduce -> Reduce | Reduce -> Reduce
| Fold -> Fold | Fold -> Fold
| Not -> Not | Not -> Not
| IntToRat -> IntToRat
| MoneyToRat -> MoneyToRat
| RatToMoney -> RatToMoney
| GetDay -> GetDay | GetDay -> GetDay
| GetMonth -> GetMonth | GetMonth -> GetMonth
| GetYear -> GetYear | GetYear -> GetYear
| FirstDayOfMonth -> FirstDayOfMonth | FirstDayOfMonth -> FirstDayOfMonth
| LastDayOfMonth -> LastDayOfMonth | LastDayOfMonth -> LastDayOfMonth
| RoundMoney -> RoundMoney
| RoundDecimal -> RoundDecimal
| And -> And | And -> And
| Or -> Or | Or -> Or
| Xor -> Xor | Xor -> Xor
@ -348,6 +353,11 @@ let translate :
| Minus_rat -> Minus_rat | Minus_rat -> Minus_rat
| Minus_mon -> Minus_mon | Minus_mon -> Minus_mon
| Minus_dur -> Minus_dur | Minus_dur -> Minus_dur
| ToRat_int -> ToRat_int
| ToRat_mon -> ToRat_mon
| ToMoney_rat -> ToMoney_rat
| Round_rat -> Round_rat
| Round_mon -> Round_mon
| Add_int_int -> Add_int_int | Add_int_int -> Add_int_int
| Add_rat_rat -> Add_rat_rat | Add_rat_rat -> Add_rat_rat
| Add_mon_mon -> Add_mon_mon | Add_mon_mon -> Add_mon_mon
@ -398,16 +408,11 @@ let monomorphic_type (op, pos) =
let ( @-> ) a b = TArrow ((TLit a, pos), (TLit b, pos)), pos in let ( @-> ) a b = TArrow ((TLit a, pos), (TLit b, pos)), pos in
match op with match op with
| Not -> TBool @-> TBool | Not -> TBool @-> TBool
| IntToRat -> TInt @-> TRat
| MoneyToRat -> TMoney @-> TRat
| RatToMoney -> TRat @-> TMoney
| GetDay -> TDate @-> TInt | GetDay -> TDate @-> TInt
| GetMonth -> TDate @-> TInt | GetMonth -> TDate @-> TInt
| GetYear -> TDate @-> TInt | GetYear -> TDate @-> TInt
| FirstDayOfMonth -> TDate @-> TDate | FirstDayOfMonth -> TDate @-> TDate
| LastDayOfMonth -> TDate @-> TDate | LastDayOfMonth -> TDate @-> TDate
| RoundMoney -> TMoney @-> TMoney
| RoundDecimal -> TRat @-> TRat
| And -> TBool @- TBool @-> TBool | And -> TBool @- TBool @-> TBool
| Or -> TBool @- TBool @-> TBool | Or -> TBool @- TBool @-> TBool
| Xor -> TBool @- TBool @-> TBool | Xor -> TBool @- TBool @-> TBool
@ -420,6 +425,11 @@ let resolved_type (op, pos) =
| Minus_rat -> TRat @-> TRat | Minus_rat -> TRat @-> TRat
| Minus_mon -> TMoney @-> TMoney | Minus_mon -> TMoney @-> TMoney
| Minus_dur -> TDuration @-> TDuration | Minus_dur -> TDuration @-> TDuration
| ToRat_int -> TInt @-> TRat
| ToRat_mon -> TMoney @-> TRat
| ToMoney_rat -> TRat @-> TMoney
| Round_rat -> TRat @-> TRat
| Round_mon -> TMoney @-> TMoney
| Add_int_int -> TInt @- TInt @-> TInt | Add_int_int -> TInt @- TInt @-> TInt
| Add_rat_rat -> TRat @- TRat @-> TRat | Add_rat_rat -> TRat @- TRat @-> TRat
| Add_mon_mon -> TMoney @- TMoney @-> TMoney | Add_mon_mon -> TMoney @- TMoney @-> TMoney
@ -472,6 +482,11 @@ let resolve_overload_aux (op : ('a, overloaded) t) (operands : typ_lit list) :
| Minus, [TRat] -> Minus_rat, `Straight | Minus, [TRat] -> Minus_rat, `Straight
| Minus, [TMoney] -> Minus_mon, `Straight | Minus, [TMoney] -> Minus_mon, `Straight
| Minus, [TDuration] -> Minus_dur, `Straight | Minus, [TDuration] -> Minus_dur, `Straight
| ToRat, [TInt] -> ToRat_int, `Straight
| ToRat, [TMoney] -> ToRat_mon, `Straight
| ToMoney, [TRat] -> ToMoney_rat, `Straight
| Round, [TRat] -> Round_rat, `Straight
| Round, [TMoney] -> Round_mon, `Straight
| Add, [TInt; TInt] -> Add_int_int, `Straight | Add, [TInt; TInt] -> Add_int_int, `Straight
| Add, [TRat; TRat] -> Add_rat_rat, `Straight | Add, [TRat; TRat] -> Add_rat_rat, `Straight
| Add, [TMoney; TMoney] -> Add_mon_mon, `Straight | Add, [TMoney; TMoney] -> Add_mon_mon, `Straight
@ -514,7 +529,10 @@ let resolve_overload_aux (op : ('a, overloaded) t) (operands : typ_lit list) :
| Gte, [TMoney; TMoney] -> Gte_mon_mon, `Straight | Gte, [TMoney; TMoney] -> Gte_mon_mon, `Straight
| Gte, [TDuration; TDuration] -> Gte_dur_dur, `Straight | Gte, [TDuration; TDuration] -> Gte_dur_dur, `Straight
| Gte, [TDate; TDate] -> Gte_dat_dat, `Straight | Gte, [TDate; TDate] -> Gte_dat_dat, `Straight
| (Minus | Add | Sub | Mult | Div | Lt | Lte | Gt | Gte), _ -> raise Not_found | ( ( Minus | ToRat | ToMoney | Round | Add | Sub | Mult | Div | Lt | Lte | Gt
| Gte ),
_ ) ->
raise Not_found
let resolve_overload let resolve_overload
ctx ctx

View File

@ -150,16 +150,19 @@ let log_entry (fmt : Format.formatter) (entry : log_entry) : unit =
let operator_to_string : type a k. (a, k) Op.t -> string = function let operator_to_string : type a k. (a, k) Op.t -> string = function
| Not -> "~" | Not -> "~"
| Length -> "length" | Length -> "length"
| IntToRat -> "int_to_rat"
| MoneyToRat -> "money_to_rat"
| RatToMoney -> "rat_to_money"
| GetDay -> "get_day" | GetDay -> "get_day"
| GetMonth -> "get_month" | GetMonth -> "get_month"
| GetYear -> "get_year" | GetYear -> "get_year"
| FirstDayOfMonth -> "first_day_of_month" | FirstDayOfMonth -> "first_day_of_month"
| LastDayOfMonth -> "last_day_of_month" | LastDayOfMonth -> "last_day_of_month"
| RoundMoney -> "round_money" | ToRat -> "to_rat"
| RoundDecimal -> "round_decimal" | ToRat_int -> "to_rat_int"
| ToRat_mon -> "to_rat_mon"
| ToMoney -> "to_mon"
| ToMoney_rat -> "to_mon_rat"
| Round -> "round"
| Round_rat -> "round_rat"
| Round_mon -> "round_mon"
| Log _ -> "Log" | Log _ -> "Log"
| Minus -> "-" | Minus -> "-"
| Minus_int -> "-!" | Minus_int -> "-!"

View File

@ -301,16 +301,14 @@ type unop = Not | Minus of op_kind
type builtin_expression = type builtin_expression =
| Cardinal | Cardinal
| IntToDec | ToDecimal
| MoneyToDec | ToMoney
| DecToMoney
| GetDay | GetDay
| GetMonth | GetMonth
| GetYear | GetYear
| LastDayOfMonth | LastDayOfMonth
| FirstDayOfMonth | FirstDayOfMonth
| RoundMoney | Round
| RoundDecimal
[@@deriving [@@deriving
visitors { variety = "map"; name = "builtin_expression_map"; nude = true }, visitors { variety = "map"; name = "builtin_expression_map"; nude = true },
visitors { variety = "iter"; name = "builtin_expression_iter"; nude = true }] visitors { variety = "iter"; name = "builtin_expression_iter"; nude = true }]

View File

@ -221,20 +221,8 @@ module R = Re.Pcre
#ifndef MR_FALSE #ifndef MR_FALSE
#define MR_FALSE MS_FALSE #define MR_FALSE MS_FALSE
#endif #endif
#ifndef MR_IntToDec #ifndef MR_Round
#define MR_IntToDec MS_IntToDec #define MR_Round MS_Round
#endif
#ifndef MR_MoneyToDec
#define MR_MoneyToDec MS_MoneyToDec
#endif
#ifndef MR_DecToMoney
#define MR_DecToMoney MS_DecToMoney
#endif
#ifndef MR_RoundMoney
#define MR_RoundMoney MS_RoundMoney
#endif
#ifndef MR_RoundDecimal
#define MR_RoundDecimal MS_RoundDecimal
#endif #endif
#ifndef MR_GetDay #ifndef MR_GetDay
#define MR_GetDay MS_GetDay #define MR_GetDay MS_GetDay
@ -340,16 +328,12 @@ let token_list : (string * token) list =
let lex_builtin (s : string) : Ast.builtin_expression option = let lex_builtin (s : string) : Ast.builtin_expression option =
let lexbuf = Utf8.from_string s in let lexbuf = Utf8.from_string s in
match%sedlex lexbuf with match%sedlex lexbuf with
| MR_IntToDec, eof -> Some IntToDec | MR_Round, eof -> Some Round
| MR_DecToMoney, eof -> Some DecToMoney
| MR_MoneyToDec, eof -> Some MoneyToDec
| MR_GetDay, eof -> Some GetDay | MR_GetDay, eof -> Some GetDay
| MR_GetMonth, eof -> Some GetMonth | MR_GetMonth, eof -> Some GetMonth
| MR_GetYear, eof -> Some GetYear | MR_GetYear, eof -> Some GetYear
| MR_FirstDayOfMonth -> Some FirstDayOfMonth | MR_FirstDayOfMonth -> Some FirstDayOfMonth
| MR_LastDayOfMonth -> Some LastDayOfMonth | MR_LastDayOfMonth -> Some LastDayOfMonth
| MR_RoundMoney, eof -> Some RoundMoney
| MR_RoundDecimal, eof -> Some RoundDecimal
| _ -> None | _ -> None
(** Regexp matching any digit character. (** Regexp matching any digit character.

View File

@ -101,11 +101,7 @@
(* Builtins *) (* Builtins *)
#define MS_RoundMoney "round_money" #define MS_Round "round"
#define MS_RoundDecimal "round_decimal"
#define MS_IntToDec "integer_to_decimal"
#define MS_MoneyToDec "money_to_decimal"
#define MS_DecToMoney "decimal_to_money"
#define MS_GetDay "get_day" #define MS_GetDay "get_day"
#define MS_GetMonth "get_month" #define MS_GetMonth "get_month"
#define MS_GetYear "get_year" #define MS_GetYear "get_year"

View File

@ -125,15 +125,7 @@
(* Builtins *) (* Builtins *)
#define MS_RoundMoney "arrondi_argent" #define MS_Round "arrondi"
#define MS_RoundDecimal "arrondi_décimal"
#define MR_RoundDecimal "arrondi_d", 0xE9, "cimal"
#define MS_IntToDec "entier_vers_décimal"
#define MR_IntToDec "entier_vers_d", 0xE9, "cimal"
#define MS_MoneyToDec "argent_vers_décimal"
#define MR_MoneyToDec "argent_vers_d", 0xE9, "cimal"
#define MS_DecToMoney "décimal_vers_argent"
#define MR_DecToMoney "d", 0xE9, "cimal_vers_argent"
#define MS_GetDay "accès_jour" #define MS_GetDay "accès_jour"
#define MR_GetDay "acc", 0xE8, "s_jour" #define MR_GetDay "acc", 0xE8, "s_jour"
#define MS_GetMonth "accès_mois" #define MS_GetMonth "accès_mois"

View File

@ -110,16 +110,8 @@
(* Builtins *) (* Builtins *)
#define MS_RoundDecimal "zaokrąglony_dziesiętny" #define MS_Round "zaokrąglony"
#define MR_RoundDecimal "zaokr",0x0105,"glony_dziesi", 0x0119, "tny" #define MR_Round "zaokr",0x0105,"glony"
#define MS_RoundMoney "zaokrąglony_pieniądze"
#define MR_RoundMoney "zaokr",0x0105,"glony_pieni", 0x0105, "dze"
#define MS_IntToDec "calkowita_wers_dziesiętny"
#define MR_IntToDec "calkowita_wers_dziesi", 0x0119, "tny"
#define MS_MoneyToDec "pieniądze_wers_dziesiętny"
#define MR_MoneyToDec "pieni", 0x0105, "dze_wers_dziesi", 0x0119, "tny"
#define MS_DecToMoney "dziesiętny_wers_pieniądze"
#define MR_DecToMoney "dziesi", 0x0119, "tny_wers_pieni", 0x0105, "dze"
#define MS_GetDay "dostęp_dzień" #define MS_GetDay "dostęp_dzień"
#define MR_GetDay "dost", 0x0119, "p_dzie", 0x144 #define MR_GetDay "dost", 0x0119, "p_dzie", 0x144
#define MS_GetMonth "dostęp_miesiąc" #define MS_GetMonth "dostęp_miesiąc"

File diff suppressed because it is too large Load Diff

View File

@ -82,6 +82,8 @@ small_expression:
| CARDINAL { | CARDINAL {
(Builtin Cardinal, Pos.from_lpos $sloc) (Builtin Cardinal, Pos.from_lpos $sloc)
} }
| DECIMAL { Builtin ToDecimal, Pos.from_lpos $sloc }
| MONEY { Builtin ToMoney, Pos.from_lpos $sloc }
| LSQUARE l = separated_list(SEMICOLON, expression) RSQUARE { | LSQUARE l = separated_list(SEMICOLON, expression) RSQUARE {
(ArrayLit l, Pos.from_lpos $sloc) (ArrayLit l, Pos.from_lpos $sloc)
} }
@ -212,7 +214,7 @@ mult_op:
mult_expression: mult_expression:
| e = unop_expression { e } | e = unop_expression { e }
| e1 = mult_expression binop = mult_op e2 = unop_expression { | e1 = mult_expression binop = mult_op e2 = unop_expression {
(Binop (binop, e1, e2), Pos.from_lpos $sloc) (Binop (binop, e1, e2), Pos.from_lpos $sloc)
} }

View File

@ -570,15 +570,15 @@ let rec translate_op :
| Length, [e1] -> | Length, [e1] ->
(* For now, an array is only its symbolic length. We simply return it *) (* For now, an array is only its symbolic length. We simply return it *)
translate_expr ctx e1 translate_expr ctx e1
| IntToRat, _ -> | ToRat_int, _ ->
failwith failwith
"[Z3 encoding] application of unary operator IntToRat not supported" "[Z3 encoding] application of unary operator ToRat_int not supported"
| MoneyToRat, _ -> | ToRat_mon, _ ->
failwith failwith
"[Z3 encoding] application of unary operator MoneyToRat not supported" "[Z3 encoding] application of unary operator ToRat_mon not supported"
| RatToMoney, _ -> | ToMoney_rat, _ ->
failwith failwith
"[Z3 encoding] application of unary operator RatToMoney not supported" "[Z3 encoding] application of unary operator ToMoney_rat not supported"
| GetDay, _ -> | GetDay, _ ->
failwith "[Z3 encoding] application of unary operator GetDay not supported" failwith "[Z3 encoding] application of unary operator GetDay not supported"
| GetMonth, _ -> | GetMonth, _ ->
@ -596,10 +596,10 @@ let rec translate_op :
failwith failwith
"[Z3 encoding] LastDayOfMonth operator only supported in comparisons \ "[Z3 encoding] LastDayOfMonth operator only supported in comparisons \
with literal" with literal"
| RoundDecimal, _ -> | Round_rat, _ ->
failwith "[Z3 encoding] RoundDecimal operator not implemented yet" failwith "[Z3 encoding] Round_rat operator not implemented yet"
| RoundMoney, _ -> | Round_mon, _ ->
failwith "[Z3 encoding] RoundMoney operator not implemented yet" failwith "[Z3 encoding] Round_mon operator not implemented yet"
| _ -> ill_formed () | _ -> ill_formed ()
(** [translate_expr] translate the expression [vc] to its corresponding Z3 (** [translate_expr] translate the expression [vc] to its corresponding Z3

View File

@ -55,13 +55,13 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
conséquence égal à conséquence égal à
selon zone sous forme selon zone sous forme
--Zone1: --Zone1:
406,30€ + 58,95€ * (entier_vers_décimal de 406,30€ + 58,95€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
--Zone2: --Zone2:
357,80€ + 52,08€ * (entier_vers_décimal de 357,80€ + 52,08€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
--Zone3: --Zone3:
330,94€ + 47,43€ * (entier_vers_décimal de 330,94€ + 47,43€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
``` ```
@ -159,7 +159,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sous condition date_courante >= |2021-10-01| et sous condition date_courante >= |2021-10-01| et
date_courante < |2022-07-01|: date_courante < |2022-07-01|:
étiquette base définition montant_forfaitaire_charges_d823_16 égal à étiquette base définition montant_forfaitaire_charges_d823_16 égal à
54,22€ + 12,29€ * (entier_vers_décimal de nombre_personnes_à_charge) 54,22€ + 12,29€ * (décimal de nombre_personnes_à_charge)
``` ```
### Article 13 | LEGIARTI000044137423 [archive] ### Article 13 | LEGIARTI000044137423 [archive]
@ -235,7 +235,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sinon (si nombre_personnes_à_charge = 6 alors sinon (si nombre_personnes_à_charge = 6 alors
1,73% 1,73%
sinon sinon
(1,73% - (0,06% * (entier_vers_décimal de (1,73% - (0,06% * (décimal de
(nombre_personnes_à_charge - 6)))) (nombre_personnes_à_charge - 6))))
)))))) ))))))
# TODO informatique: corriger le parseur pour éviter d'avoir à mettre # TODO informatique: corriger le parseur pour éviter d'avoir à mettre
@ -252,7 +252,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sous condition date_courante >= |2021-10-01| et sous condition date_courante >= |2021-10-01| et
date_courante < |2022-07-01|: date_courante < |2022-07-01|:
définition rapport_loyers égal à définition rapport_loyers égal à
arrondi_décimal de ((loyer_éligible / loyer_référence) * 100,0) / 100,0 arrondi de ((loyer_éligible / loyer_référence) * 100,0) / 100,0
``` ```
Pour la détermination de TL , les taux progressifs et les tranches successives de RL mentionnés Pour la détermination de TL , les taux progressifs et les tranches successives de RL mentionnés
@ -285,9 +285,9 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sinon (si rapport_loyers >= 75% alors sinon (si rapport_loyers >= 75% alors
0,45% * 30% + 0,68% * (rapport_loyers - 75%) 0,45% * 30% + 0,68% * (rapport_loyers - 75%)
sinon 0,0)) sinon 0,0))
définition taux_loyer_éligible état arrondi égal à définition taux_loyer_éligible état taux_arrondi égal à
# La troisième décimale en pourcentage est en fait la cinquième décimale # La troisième décimale en pourcentage est en fait la cinquième décimale
(arrondi_décimal de (taux_loyer_éligible * 100000,0)) / 100000,0 (arrondi de (taux_loyer_éligible * 100000,0)) / 100000,0
``` ```
Le loyer de référence LR est défini selon le tableau suivant (en euros) : Le loyer de référence LR est défini selon le tableau suivant (en euros) :
@ -309,7 +309,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
-- PersonneSeule: 259,78€ -- PersonneSeule: 259,78€
-- Couple: 317,97€ -- Couple: 317,97€
sinon (357,80€ + sinon (357,80€ +
(52,08€ * (entier_vers_décimal de (nombre_personnes_à_charge - 1)))) (52,08€ * (décimal de (nombre_personnes_à_charge - 1))))
``` ```
NOTA : NOTA :
@ -372,13 +372,13 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
conséquence égal à conséquence égal à
selon zone sous forme selon zone sous forme
--Zone1: --Zone1:
304,73€ + 44,21€ * (entier_vers_décimal de 304,73€ + 44,21€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
--Zone2: --Zone2:
268,35€ + 39,06€ * (entier_vers_décimal de 268,35€ + 39,06€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
--Zone3: --Zone3:
248,21€ + 35,57€ * (entier_vers_décimal de 248,21€ + 35,57€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
``` ```
@ -398,7 +398,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
(selon situation_familiale_calcul_apl sous forme (selon situation_familiale_calcul_apl sous forme
-- PersonneSeule: 27,10€ -- PersonneSeule: 27,10€
-- Couple: 54,22€) + -- Couple: 54,22€) +
12,29€ * (entier_vers_décimal de nombre_personnes_à_charge) 12,29€ * (décimal de nombre_personnes_à_charge)
``` ```
NOTA : NOTA :
@ -428,7 +428,7 @@ champ d'application CalculAidePersonnaliséeLogementAccessionPropriété
date_courante < |2022-07-01|: date_courante < |2022-07-01|:
étiquette base définition montant_forfaitaire_charges_d832_10 égal à étiquette base définition montant_forfaitaire_charges_d832_10 égal à
54,22 € + 12,29 € * (entier_vers_décimal de nombre_personnes_à_charge) 54,22 € + 12,29 € * (décimal de nombre_personnes_à_charge)
``` ```
### Article 24 | LEGIARTI000044137409 [archive] ### Article 24 | LEGIARTI000044137409 [archive]
@ -466,7 +466,7 @@ champ d'application CalculAidePersonnaliséeLogementAccessionPropriété
(selon situation_familiale_calcul_apl sous forme (selon situation_familiale_calcul_apl sous forme
-- PersonneSeule: 27,10€ -- PersonneSeule: 27,10€
-- Couple: 54,22€) + -- Couple: 54,22€) +
12,29 € * (entier_vers_décimal de nombre_personnes_à_charge) 12,29 € * (décimal de nombre_personnes_à_charge)
``` ```
NOTA : NOTA :
@ -511,7 +511,7 @@ champ d'application CalculAidePersonnaliséeLogementFoyer sous condition
636,35 € 636,35 €
sinon sinon
(686,37 € + (686,37 € +
71,19€ * (entier_vers_décimal de (nombre_personnes_à_charge - 4))))))) 71,19€ * (décimal de (nombre_personnes_à_charge - 4)))))))
-- Zone2: ( -- Zone2: (
si nombre_personnes_à_charge = 0 alors si nombre_personnes_à_charge = 0 alors
(selon situation_familiale_calcul_apl sous forme (selon situation_familiale_calcul_apl sous forme
@ -525,7 +525,7 @@ champ d'application CalculAidePersonnaliséeLogementFoyer sous condition
579,29 € 579,29 €
sinon sinon
(617,27 € + (617,27 € +
64,34€ * (entier_vers_décimal de (nombre_personnes_à_charge - 4))))))) 64,34€ * (décimal de (nombre_personnes_à_charge - 4)))))))
-- Zone3: ( -- Zone3: (
si nombre_personnes_à_charge = 0 alors si nombre_personnes_à_charge = 0 alors
(selon situation_familiale_calcul_apl sous forme (selon situation_familiale_calcul_apl sous forme
@ -539,7 +539,7 @@ champ d'application CalculAidePersonnaliséeLogementFoyer sous condition
541,10 € 541,10 €
sinon sinon
(576,57 € + (576,57 € +
59,71€ * (entier_vers_décimal de (nombre_personnes_à_charge - 4))))))) 59,71€ * (décimal de (nombre_personnes_à_charge - 4)))))))
) )
``` ```
@ -564,7 +564,7 @@ champ d'application CalculAllocationLogementAccessionPropriété
étiquette oct_2021_juin_2022 définition montant_forfaitaire_charges égal à étiquette oct_2021_juin_2022 définition montant_forfaitaire_charges égal à
si nombre_personnes_à_charge = 0 alors 54,22 € si nombre_personnes_à_charge = 0 alors 54,22 €
sinon 54,22 € + (12,29 € * ( sinon 54,22 € + (12,29 € * (
entier_vers_décimal de nombre_personnes_à_charge)) décimal de nombre_personnes_à_charge))
``` ```
### Article 37 | LEGIARTI000044137400 [archive] ### Article 37 | LEGIARTI000044137400 [archive]
@ -604,7 +604,7 @@ champ d'application CalculAllocationLogementAccessionPropriété
(selon situation_familiale_calcul_apl sous forme (selon situation_familiale_calcul_apl sous forme
-- PersonneSeule: 27,10 € -- PersonneSeule: 27,10 €
-- Couple : 54,22€) + (12,29 € * ( -- Couple : 54,22€) + (12,29 € * (
entier_vers_décimal de nombre_personnes_à_charge)) décimal de nombre_personnes_à_charge))
``` ```
NOTA : NOTA :
@ -633,7 +633,7 @@ champ d'application CalculAllocationLogementFoyer
définition montant_forfaitaire_charges égal à définition montant_forfaitaire_charges égal à
si nombre_personnes_à_charge = 0 alors 54,22 € si nombre_personnes_à_charge = 0 alors 54,22 €
sinon 54,22 € + (12,29 € * ( sinon 54,22 € + (12,29 € * (
entier_vers_décimal de nombre_personnes_à_charge)) décimal de nombre_personnes_à_charge))
``` ```
@ -780,13 +780,13 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
conséquence égal à conséquence égal à
selon zone sous forme selon zone sous forme
--Zone1: --Zone1:
404,60€ + 58,70€ * (entier_vers_décimal de 404,60€ + 58,70€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
--Zone2: --Zone2:
356,30€ + 51,86€ * (entier_vers_décimal de 356,30€ + 51,86€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
--Zone3: --Zone3:
329,56€ + 47,23€ * (entier_vers_décimal de 329,56€ + 47,23€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
``` ```
@ -883,7 +883,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sous condition date_courante < |2021-10-01| et sous condition date_courante < |2021-10-01| et
date_courante >= |2020-10-01|: date_courante >= |2020-10-01|:
étiquette base définition montant_forfaitaire_charges_d823_16 égal à étiquette base définition montant_forfaitaire_charges_d823_16 égal à
53,99€ + 12,24€ * (entier_vers_décimal de nombre_personnes_à_charge) 53,99€ + 12,24€ * (décimal de nombre_personnes_à_charge)
``` ```
#### Article 13 | LEGIARTI000042378442 [archive] #### Article 13 | LEGIARTI000042378442 [archive]
@ -959,7 +959,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sinon (si nombre_personnes_à_charge = 6 alors sinon (si nombre_personnes_à_charge = 6 alors
1,73% 1,73%
sinon sinon
(1,73% - (0,06% * (entier_vers_décimal de (1,73% - (0,06% * (décimal de
(nombre_personnes_à_charge - 6)))) (nombre_personnes_à_charge - 6))))
)))))) ))))))
# TODO informatique: corriger le parseur pour éviter d'avoir à mettre # TODO informatique: corriger le parseur pour éviter d'avoir à mettre
@ -976,7 +976,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sous condition date_courante >= |2020-10-01| et sous condition date_courante >= |2020-10-01| et
date_courante < |2021-10-01|: date_courante < |2021-10-01|:
définition rapport_loyers égal à définition rapport_loyers égal à
arrondi_décimal de ((loyer_éligible / loyer_référence) * 100,0) / 100,0 arrondi de ((loyer_éligible / loyer_référence) * 100,0) / 100,0
``` ```
Pour la détermination de TL , les taux progressifs et les tranches successives de RL mentionnés Pour la détermination de TL , les taux progressifs et les tranches successives de RL mentionnés
@ -1006,9 +1006,9 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sinon (si rapport_loyers >= 75% alors sinon (si rapport_loyers >= 75% alors
0,45% * 30% + 0,68% * (rapport_loyers - 75%) 0,45% * 30% + 0,68% * (rapport_loyers - 75%)
sinon 0,0)) sinon 0,0))
définition taux_loyer_éligible état arrondi égal à définition taux_loyer_éligible état taux_arrondi égal à
# La troisième décimale en pourcentage est en fait la cinquième décimale # La troisième décimale en pourcentage est en fait la cinquième décimale
(arrondi_décimal de (taux_loyer_éligible * 100000,0)) / 100000,0 (arrondi de (taux_loyer_éligible * 100000,0)) / 100000,0
``` ```
Le loyer de référence LR est défini selon le tableau suivant (en euros) : Le loyer de référence LR est défini selon le tableau suivant (en euros) :
@ -1030,7 +1030,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
-- PersonneSeule: 258,69€ -- PersonneSeule: 258,69€
-- Couple: 316,64€ -- Couple: 316,64€
sinon (356,30€ + sinon (356,30€ +
(51,86€ * (entier_vers_décimal de (nombre_personnes_à_charge - 1)))) (51,86€ * (décimal de (nombre_personnes_à_charge - 1))))
``` ```
NOTA : NOTA :
@ -1091,13 +1091,13 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
conséquence égal à conséquence égal à
selon zone sous forme selon zone sous forme
--Zone1: --Zone1:
303,45€ + 44,03€ * (entier_vers_décimal de 303,45€ + 44,03€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
--Zone2: --Zone2:
267,23€ + 38,90€ * (entier_vers_décimal de 267,23€ + 38,90€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
--Zone3: --Zone3:
247,17€ + 35,42€ * (entier_vers_décimal de 247,17€ + 35,42€ * (décimal de
(nombre_personnes_à_charge - 1)) (nombre_personnes_à_charge - 1))
``` ```
@ -1117,7 +1117,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
(selon situation_familiale_calcul_apl sous forme (selon situation_familiale_calcul_apl sous forme
-- PersonneSeule: 26,99€ -- PersonneSeule: 26,99€
-- Couple: 53,99€) + -- Couple: 53,99€) +
12,24€ * (entier_vers_décimal de nombre_personnes_à_charge) 12,24€ * (décimal de nombre_personnes_à_charge)
``` ```
NOTA : NOTA :
@ -1149,7 +1149,7 @@ champ d'application CalculAidePersonnaliséeLogementAccessionPropriété
date_courante >= |2020-10-01|: date_courante >= |2020-10-01|:
étiquette base définition montant_forfaitaire_charges_d832_10 égal à étiquette base définition montant_forfaitaire_charges_d832_10 égal à
53,99 € + 12,24 € * (entier_vers_décimal de nombre_personnes_à_charge) 53,99 € + 12,24 € * (décimal de nombre_personnes_à_charge)
``` ```
#### Article 24 | LEGIARTI000042378430 [archive] #### Article 24 | LEGIARTI000042378430 [archive]
@ -1187,7 +1187,7 @@ champ d'application CalculAidePersonnaliséeLogementAccessionPropriété
(selon situation_familiale_calcul_apl sous forme (selon situation_familiale_calcul_apl sous forme
-- PersonneSeule: 26,99€ -- PersonneSeule: 26,99€
-- Couple: 53,99€) + -- Couple: 53,99€) +
12,24 € * (entier_vers_décimal de nombre_personnes_à_charge) 12,24 € * (décimal de nombre_personnes_à_charge)
``` ```
NOTA : NOTA :
@ -1234,7 +1234,7 @@ champ d'application CalculAidePersonnaliséeLogementFoyer sous condition
633,69 € 633,69 €
sinon sinon
(683,5 € + (683,5 € +
70,89€ * (entier_vers_décimal de (nombre_personnes_à_charge - 4))))))) 70,89€ * (décimal de (nombre_personnes_à_charge - 4)))))))
-- Zone2: ( -- Zone2: (
si nombre_personnes_à_charge = 0 alors si nombre_personnes_à_charge = 0 alors
(selon situation_familiale_calcul_apl sous forme (selon situation_familiale_calcul_apl sous forme
@ -1248,7 +1248,7 @@ champ d'application CalculAidePersonnaliséeLogementFoyer sous condition
576,87 € 576,87 €
sinon sinon
(614,69 € + (614,69 € +
64,07€ * (entier_vers_décimal de (nombre_personnes_à_charge - 4))))))) 64,07€ * (décimal de (nombre_personnes_à_charge - 4)))))))
-- Zone3: ( -- Zone3: (
si nombre_personnes_à_charge = 0 alors si nombre_personnes_à_charge = 0 alors
(selon situation_familiale_calcul_apl sous forme (selon situation_familiale_calcul_apl sous forme
@ -1262,7 +1262,7 @@ champ d'application CalculAidePersonnaliséeLogementFoyer sous condition
538,84 € 538,84 €
sinon sinon
(574,16 € + (574,16 € +
59,46€ * (entier_vers_décimal de (nombre_personnes_à_charge - 4))))))) 59,46€ * (décimal de (nombre_personnes_à_charge - 4)))))))
) )
``` ```
@ -1328,7 +1328,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sinon (si nombre_personnes_à_charge = 6 alors sinon (si nombre_personnes_à_charge = 6 alors
9 439 € 9 439 €
sinon sinon
(9 439€ + (311 € * (entier_vers_décimal de (9 439€ + (311 € * (décimal de
(nombre_personnes_à_charge - 6)))) (nombre_personnes_à_charge - 6))))
)))))) ))))))
``` ```
@ -1382,7 +1382,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif
sinon (si nombre_personnes_à_charge = 6 alors sinon (si nombre_personnes_à_charge = 6 alors
9 246 € 9 246 €
sinon sinon
(9 246€ + (305 € * (entier_vers_décimal de (9 246€ + (305 € * (décimal de
(nombre_personnes_à_charge - 6)))) (nombre_personnes_à_charge - 6))))
)))))) ))))))
``` ```

File diff suppressed because it is too large Load Diff

View File

@ -267,7 +267,7 @@ champ d'application CalculetteAidesAuLogementGardeAlternée:
(calculette.aide_finale_formule - (calculette.aide_finale_formule -
calculette_sans_garde_alternée.aide_finale_formule) * calculette_sans_garde_alternée.aide_finale_formule) *
((somme décimal de coefficents_enfants_garde_alternée_pris_en_compte) / ((somme décimal de coefficents_enfants_garde_alternée_pris_en_compte) /
(entier_vers_décimal de (décimal de
nombre de coefficents_enfants_garde_alternée_pris_en_compte)))) nombre de coefficents_enfants_garde_alternée_pris_en_compte))))
``` ```

View File

@ -1875,7 +1875,7 @@ champ d'application CalculAidePersonnaliséeLogementLocatif:
contributions_sociales.montant de aide_finale contributions_sociales.montant de aide_finale
dans dans
soit aide_finale_moins_crds_arrondie égal à soit aide_finale_moins_crds_arrondie égal à
arrondi_argent de ((aide_finale - crds) - 0,50€) arrondi de ((aide_finale - crds) - 0,50€)
dans dans
si si
aide_finale_moins_crds_arrondie + crds >= 0€ aide_finale_moins_crds_arrondie + crds >= 0€
@ -1962,7 +1962,7 @@ champ d'application CalculAidePersonnaliséeLogement:
définition ressources_ménage état avec_arrondi égal à définition ressources_ménage état avec_arrondi égal à
# Cette formule arrondit à la centaine d'euros supérieure. Essayez quelques # Cette formule arrondit à la centaine d'euros supérieure. Essayez quelques
# exemples pour vous en convaincre, dont 100 et 150. # exemples pour vous en convaincre, dont 100 et 150.
arrondi_argent de ((ressources_ménage * 1%) + 0,49€) * 100,0 arrondi de ((ressources_ménage * 1%) + 0,49€) * 100,0
``` ```
5° “ R0 ” est un abattement forfaitaire appliqué aux ressources du ménage. Il est fixé 5° “ R0 ” est un abattement forfaitaire appliqué aux ressources du ménage. Il est fixé
@ -3149,7 +3149,7 @@ champ d'application CalculAidePersonnaliséeLogementAccessionPropriété:
soit aide_finale égal à traitement_aide_finale de aide_finale dans soit aide_finale égal à traitement_aide_finale de aide_finale dans
soit crds égal à contributions_sociales.montant de aide_finale dans soit crds égal à contributions_sociales.montant de aide_finale dans
soit aide_finale_moins_crds_arrondie égal à soit aide_finale_moins_crds_arrondie égal à
arrondi_argent de ((aide_finale - crds) - 0,50€) arrondi de ((aide_finale - crds) - 0,50€)
dans dans
si si
aide_finale_moins_crds_arrondie + crds >= 0€ aide_finale_moins_crds_arrondie + crds >= 0€
@ -3195,8 +3195,8 @@ Lorsque le calcul le porte à une valeur supérieure à 0,95, il est considéré
```catala ```catala
champ d'application CalculAidePersonnaliséeLogementAccessionPropriété: champ d'application CalculAidePersonnaliséeLogementAccessionPropriété:
définition coefficient_prise_en_charge_d832_10 état arrondi égal à définition coefficient_prise_en_charge_d832_10 état coeff_arrondi égal à
(arrondi_décimal de ((coefficient_prise_en_charge_d832_10 - 0,005) (arrondi de ((coefficient_prise_en_charge_d832_10 - 0,005)
* 100,0)) / 100,0 * 100,0)) / 100,0
définition coefficient_prise_en_charge_d832_10 état seuil égal à définition coefficient_prise_en_charge_d832_10 état seuil égal à
si coefficient_prise_en_charge_d832_10 >= 0,95 alors 0,95 sinon si coefficient_prise_en_charge_d832_10 >= 0,95 alors 0,95 sinon
@ -3259,7 +3259,7 @@ champ d'application CalculNombrePartsAccessionPropriété:
sinon (si nombre_personnes_à_charge = 4 alors sinon (si nombre_personnes_à_charge = 4 alors
4,3 4,3
sinon sinon
( 4,3 + (0,5 * (entier_vers_décimal de ( 4,3 + (0,5 * (décimal de
(nombre_personnes_à_charge - 4)))) (nombre_personnes_à_charge - 4))))
)))) ))))
@ -3431,12 +3431,12 @@ champ d'application CalculAidePersonnaliséeLogementAccessionPropriété:
# décimal plutôt que argent qui arrondi systématiquement au centime près # décimal plutôt que argent qui arrondi systématiquement au centime près
# à chaque étape de calcul. # à chaque étape de calcul.
soit ressources_ménage_arrondies égal à soit ressources_ménage_arrondies égal à
argent_vers_décimal de ressources_ménage_arrondies décimal de ressources_ménage_arrondies
dans dans
soit montant_limite_tranches_d832_15_1 égal à soit montant_limite_tranches_d832_15_1 égal à
argent_vers_décimal de montant_limite_tranches_d832_15_1 décimal de montant_limite_tranches_d832_15_1
dans dans
décimal_vers_argent de ( argent de (
((si ((si
# Pour la tranche supérieure # Pour la tranche supérieure
ressources_ménage_arrondies >= ressources_ménage_arrondies >=
@ -3804,7 +3804,7 @@ champ d'application CalculAidePersonnaliséeLogementFoyer:
contributions_sociales.montant de aide_finale contributions_sociales.montant de aide_finale
dans dans
soit aide_finale_moins_crds_arrondie égal à soit aide_finale_moins_crds_arrondie égal à
arrondi_argent de ((aide_finale - crds) - 0,50€) arrondi de ((aide_finale - crds) - 0,50€)
dans si dans si
aide_finale_moins_crds_arrondie + crds >= 0€ aide_finale_moins_crds_arrondie + crds >= 0€
alors alors
@ -3871,8 +3871,8 @@ calcul le porte à une valeur supérieure à 0,95, il est considéré égal à 0
```catala ```catala
champ d'application CalculAidePersonnaliséeLogementFoyer: champ d'application CalculAidePersonnaliséeLogementFoyer:
définition coefficient_prise_en_charge_d832_25 état arrondi égal à définition coefficient_prise_en_charge_d832_25 état coeff_arrondi égal à
(arrondi_décimal de ((coefficient_prise_en_charge_d832_25 - 0,005) (arrondi de ((coefficient_prise_en_charge_d832_25 - 0,005)
* 100,0)) / 100,0 * 100,0)) / 100,0
définition coefficient_prise_en_charge_d832_25 état seuil égal à définition coefficient_prise_en_charge_d832_25 état seuil égal à
si coefficient_prise_en_charge_d832_25 >= 0,95 alors 0,95 sinon si coefficient_prise_en_charge_d832_25 >= 0,95 alors 0,95 sinon
@ -3915,7 +3915,7 @@ champ d'application CalculNombrePartLogementFoyer:
sinon (si nombre_personnes_à_charge = 4 alors sinon (si nombre_personnes_à_charge = 4 alors
4,3 4,3
sinon sinon
( 4,3 + (0,5 * (entier_vers_décimal de ( 4,3 + (0,5 * (décimal de
(nombre_personnes_à_charge - 4)))) (nombre_personnes_à_charge - 4))))
)))) ))))
@ -3953,11 +3953,11 @@ lorsque le calcul le porte à une valeur supérieure à 0,90, il est considéré
```catala ```catala
champ d'application CalculAidePersonnaliséeLogementFoyer: champ d'application CalculAidePersonnaliséeLogementFoyer:
exception définition coefficient_prise_en_charge_d832_25 état arrondi exception définition coefficient_prise_en_charge_d832_25 état coeff_arrondi
sous condition sous condition
condition_2_du_832_25 condition_2_du_832_25
conséquence égal à conséquence égal à
(arrondi_décimal de ((coefficient_prise_en_charge_d832_25 - 0,005) (arrondi de ((coefficient_prise_en_charge_d832_25 - 0,005)
* 100,0)) / 100,0 * 100,0)) / 100,0
exception définition coefficient_prise_en_charge_d832_25 état seuil exception définition coefficient_prise_en_charge_d832_25 état seuil
sous condition sous condition
@ -4003,7 +4003,7 @@ champ d'application CalculNombrePartLogementFoyer:
sinon (si nombre_personnes_à_charge = 4 alors sinon (si nombre_personnes_à_charge = 4 alors
4,3 4,3
sinon sinon
( 4,3 + (0,5 * (entier_vers_décimal de ( 4,3 + (0,5 * (décimal de
(nombre_personnes_à_charge - 4)))) (nombre_personnes_à_charge - 4))))
)))) ))))
``` ```
@ -4029,8 +4029,8 @@ champ d'application CalculÉquivalenceLoyerMinimale:
-- LimiteTranche.Infini: LimiteTrancheDécimal.Infini -- LimiteTranche.Infini: LimiteTrancheDécimal.Infini
-- LimiteTranche.Revenu de tranche_haut: -- LimiteTranche.Revenu de tranche_haut:
LimiteTrancheDécimal.Revenu contenu LimiteTrancheDécimal.Revenu contenu
((argent_vers_décimal de tranche_haut) * n_nombre_parts_d832_25)) ((décimal de tranche_haut) * n_nombre_parts_d832_25))
-- bas: argent_vers_décimal de tranche.bas * -- bas: décimal de tranche.bas *
n_nombre_parts_d832_25 n_nombre_parts_d832_25
-- taux: tranche.taux -- taux: tranche.taux
} }
@ -4038,9 +4038,9 @@ champ d'application CalculÉquivalenceLoyerMinimale:
définition montant égal à définition montant égal à
soit ressources_ménage_arrondies égal à soit ressources_ménage_arrondies égal à
argent_vers_décimal de ressources_ménage_arrondies décimal de ressources_ménage_arrondies
dans dans
décimal_vers_argent de ( argent de (
((somme décimal de ((somme décimal de
((si ressources_ménage_arrondies <= tranche.bas alors 0,0 ((si ressources_ménage_arrondies <= tranche.bas alors 0,0
sinon sinon
@ -4060,7 +4060,7 @@ champ d'application CalculÉquivalenceLoyerMinimale:
tranche.taux)) tranche.taux))
pour tranche dans tranches_revenus_d832_26_multipliées) pour tranche dans tranches_revenus_d832_26_multipliées)
+ +
argent_vers_décimal de montant_forfaitaire_d832_26 décimal de montant_forfaitaire_d832_26
* n_nombre_parts_d832_25) * n_nombre_parts_d832_25)
/ 12,0) / 12,0)
``` ```
@ -4077,9 +4077,9 @@ champ d'application CalculÉquivalenceLoyerMinimale:
condition_2_du_832_25 condition_2_du_832_25
conséquence égal à conséquence égal à
soit ressources_ménage_arrondies égal à soit ressources_ménage_arrondies égal à
argent_vers_décimal de ressources_ménage_arrondies décimal de ressources_ménage_arrondies
dans dans
décimal_vers_argent de ( argent de (
((somme décimal de ((somme décimal de
((si ressources_ménage_arrondies <= tranche.bas alors 0,0 ((si ressources_ménage_arrondies <= tranche.bas alors 0,0
sinon sinon
@ -4099,7 +4099,7 @@ champ d'application CalculÉquivalenceLoyerMinimale:
tranche.taux)) tranche.taux))
pour tranche dans tranches_revenus_d832_26_multipliées)) pour tranche dans tranches_revenus_d832_26_multipliées))
+ +
argent_vers_décimal de montant_forfaitaire_d832_26) décimal de montant_forfaitaire_d832_26)
/ 12,0) / 12,0)
``` ```
@ -4475,7 +4475,7 @@ champ d'application CalculAllocationLogementAccessionPropriété:
soit aide_finale égal à traitement_aide_finale de aide_finale dans soit aide_finale égal à traitement_aide_finale de aide_finale dans
soit crds égal à contributions_sociales.montant de aide_finale dans soit crds égal à contributions_sociales.montant de aide_finale dans
soit aide_finale_moins_crds_arrondie égal à soit aide_finale_moins_crds_arrondie égal à
arrondi_argent de ((aide_finale - crds) - 0,50€) arrondi de ((aide_finale - crds) - 0,50€)
dans dans
si si
aide_finale_moins_crds_arrondie + crds >= 0€ aide_finale_moins_crds_arrondie + crds >= 0€
@ -4714,7 +4714,7 @@ champ d'application CalculAllocationLogementAccessionPropriété:
si ressources_ménage_arrondies <= seuil_minimal_ressources_ménage alors si ressources_ménage_arrondies <= seuil_minimal_ressources_ménage alors
# Cette formule arrondit à la centaine d'euros supérieure. Essayez quelques # Cette formule arrondit à la centaine d'euros supérieure. Essayez quelques
# exemples pour vous en convaincre, dont 100 et 150. # exemples pour vous en convaincre, dont 100 et 150.
(arrondi_argent de ((seuil_minimal_ressources_ménage + 49,99€) * 1%)) * (arrondi de ((seuil_minimal_ressources_ménage + 49,99€) * 1%)) *
100,0 100,0
sinon sinon
ressources_ménage_arrondies ressources_ménage_arrondies
@ -4799,7 +4799,7 @@ champ d'application CalculAllocationLogement:
définition ressources_ménage état avec_arrondi égal à définition ressources_ménage état avec_arrondi égal à
# Cette formule arrondit à la centaine d'euros supérieure. Essayez quelques # Cette formule arrondit à la centaine d'euros supérieure. Essayez quelques
# exemples pour vous en convaincre, dont 100 et 150. # exemples pour vous en convaincre, dont 100 et 150.
arrondi_argent de ((ressources_ménage * 1%) + 0,49€) * 100,0 arrondi de ((ressources_ménage * 1%) + 0,49€) * 100,0
``` ```
3° " L " est l'équivalence de loyer prise en compte, déterminée selon les dispositions 3° " L " est l'équivalence de loyer prise en compte, déterminée selon les dispositions
@ -4888,7 +4888,7 @@ champ d'application CalculAllocationLogementFoyer:
soit aide_finale égal à traitement_aide_finale de aide_finale dans soit aide_finale égal à traitement_aide_finale de aide_finale dans
soit crds égal à contributions_sociales.montant de aide_finale dans soit crds égal à contributions_sociales.montant de aide_finale dans
soit aide_finale_moins_crds_arrondie égal à soit aide_finale_moins_crds_arrondie égal à
arrondi_argent de ((aide_finale - crds) - 0,50€) arrondi de ((aide_finale - crds) - 0,50€)
dans dans
si si
aide_finale_moins_crds_arrondie + crds >= 0€ aide_finale_moins_crds_arrondie + crds >= 0€

View File

@ -548,7 +548,7 @@ déclaration champ d'application CalculAidePersonnaliséeLogementLocatif:
interne loyer_éligible contenu argent interne loyer_éligible contenu argent
interne taux_loyer_éligible contenu décimal interne taux_loyer_éligible contenu décimal
état formule état formule
état arrondi état taux_arrondi
interne rapport_loyers contenu décimal interne rapport_loyers contenu décimal
interne loyer_référence contenu argent interne loyer_référence contenu argent
interne fraction_l832_3 contenu décimal interne fraction_l832_3 contenu décimal
@ -636,7 +636,7 @@ déclaration champ d'application CalculAidePersonnaliséeLogementFoyer:
résultat coefficient_prise_en_charge_d832_25 contenu décimal résultat coefficient_prise_en_charge_d832_25 contenu décimal
état formule état formule
état arrondi état coeff_arrondi
état seuil état seuil
résultat aide_finale_formule contenu argent résultat aide_finale_formule contenu argent
@ -686,7 +686,7 @@ déclaration champ d'application
interne n_nombre_parts_d832_11 contenu décimal interne n_nombre_parts_d832_11 contenu décimal
résultat coefficient_prise_en_charge_d832_10 contenu décimal résultat coefficient_prise_en_charge_d832_10 contenu décimal
état formule état formule
état arrondi état coeff_arrondi
état seuil état seuil
interne dépense_nette_minimale_d832_10 contenu argent dépend de argent interne dépense_nette_minimale_d832_10 contenu argent dépend de argent
interne abattement_dépense_nette_minimale_d832_10 interne abattement_dépense_nette_minimale_d832_10

View File

@ -22,14 +22,14 @@ champ d'application AllocationsFamiliales :
définition plafond_I_d521_3 sous condition définition plafond_I_d521_3 sous condition
date_courante >= |2018-01-01| et date_courante <= |2018-12-31| date_courante >= |2018-01-01| et date_courante <= |2018-12-31|
conséquence égal à 56 286 € + conséquence égal à 56 286 € +
5 628 € * (entier_vers_décimal de 5 628 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
exception exception
définition plafond_II_d521_3 sous condition définition plafond_II_d521_3 sous condition
date_courante >= |2018-01-01| et date_courante <= |2018-12-31| date_courante >= |2018-01-01| et date_courante <= |2018-12-31|
conséquence égal à 78 770 € + conséquence égal à 78 770 € +
5 628 € * (entier_vers_décimal de 5 628 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
``` ```
@ -55,14 +55,14 @@ champ d'application AllocationsFamiliales :
définition plafond_I_d521_3 sous condition définition plafond_I_d521_3 sous condition
date_courante >= |2019-01-01| et date_courante <= |2019-12-31| date_courante >= |2019-01-01| et date_courante <= |2019-12-31|
conséquence égal à 56 849 € + conséquence égal à 56 849 € +
5 684 € * (entier_vers_décimal de 5 684 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
exception exception
définition plafond_II_d521_3 sous condition définition plafond_II_d521_3 sous condition
date_courante >= |2019-01-01| et date_courante <= |2019-12-31| date_courante >= |2019-01-01| et date_courante <= |2019-12-31|
conséquence égal à 79 558 € + conséquence égal à 79 558 € +
5 684 € * (entier_vers_décimal de 5 684 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
``` ```
@ -88,14 +88,14 @@ champ d'application AllocationsFamiliales :
définition plafond_I_d521_3 sous condition définition plafond_I_d521_3 sous condition
date_courante >= |2020-01-01| et date_courante <= |2020-12-31| date_courante >= |2020-01-01| et date_courante <= |2020-12-31|
conséquence égal à 57 759 € + conséquence égal à 57 759 € +
5 775 € * (entier_vers_décimal de 5 775 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
exception exception
définition plafond_II_d521_3 sous condition définition plafond_II_d521_3 sous condition
date_courante >= |2020-01-01| et date_courante <= |2020-12-31| date_courante >= |2020-01-01| et date_courante <= |2020-12-31|
conséquence égal à 80 831 € + conséquence égal à 80 831 € +
5 775 € * (entier_vers_décimal de 5 775 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
``` ```
@ -115,7 +115,7 @@ champ d'application AllocationsFamiliales :
définition plafond_I_d521_3 sous condition définition plafond_I_d521_3 sous condition
date_courante >= |2021-01-01| et date_courante <= |2021-12-31| date_courante >= |2021-01-01| et date_courante <= |2021-12-31|
conséquence égal à 58 279 € + conséquence égal à 58 279 € +
5 827 € * (entier_vers_décimal de 5 827 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
``` ```
@ -131,7 +131,7 @@ champ d'application AllocationsFamiliales :
définition plafond_II_d521_3 sous condition définition plafond_II_d521_3 sous condition
date_courante >= |2021-01-01| et date_courante <= |2021-12-31| date_courante >= |2021-01-01| et date_courante <= |2021-12-31|
conséquence égal à 81 558 € + conséquence égal à 81 558 € +
5 827 € * (entier_vers_décimal de 5 827 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
``` ```
@ -195,7 +195,7 @@ champ d'application AllocationsFamiliales :
définition montant_initial_base_quatrième_enfant_et_plus_mayotte égal à définition montant_initial_base_quatrième_enfant_et_plus_mayotte égal à
si nombre de enfants_à_charge_droit_ouvert_prestation_familiale > 3 si nombre de enfants_à_charge_droit_ouvert_prestation_familiale > 3
alors (bmaf.montant * 4,63 %) * ( alors (bmaf.montant * 4,63 %) * (
entier_vers_décimal de décimal de
((nombre de enfants_à_charge_droit_ouvert_prestation_familiale) - 3) ((nombre de enfants_à_charge_droit_ouvert_prestation_familiale) - 3)
) sinon 0 € ) sinon 0 €
``` ```

View File

@ -43,7 +43,7 @@ champ d'application AllocationsFamiliales sous condition
définition montant_initial_base_troisième_enfant_et_plus égal à définition montant_initial_base_troisième_enfant_et_plus égal à
si nombre de enfants_à_charge_droit_ouvert_prestation_familiale > 2 si nombre de enfants_à_charge_droit_ouvert_prestation_familiale > 2
alors (bmaf.montant * 41 %) * ( alors (bmaf.montant * 41 %) * (
entier_vers_décimal de décimal de
((nombre de enfants_à_charge_droit_ouvert_prestation_familiale) - 2) ((nombre de enfants_à_charge_droit_ouvert_prestation_familiale) - 2)
) sinon 0 € ) sinon 0 €
``` ```
@ -84,7 +84,7 @@ champ d'application AllocationsFamiliales sous condition
définition montant_initial_base_troisième_enfant_et_plus égal à définition montant_initial_base_troisième_enfant_et_plus égal à
si nombre de enfants_à_charge_droit_ouvert_prestation_familiale > 2 si nombre de enfants_à_charge_droit_ouvert_prestation_familiale > 2
alors (bmaf.montant * 20,5 %) * ( alors (bmaf.montant * 20,5 %) * (
entier_vers_décimal de décimal de
((nombre de enfants_à_charge_droit_ouvert_prestation_familiale) - 2) ((nombre de enfants_à_charge_droit_ouvert_prestation_familiale) - 2)
) sinon 0 € ) sinon 0 €
``` ```
@ -122,7 +122,7 @@ champ d'application AllocationsFamiliales sous condition
définition montant_initial_base_troisième_enfant_et_plus égal à définition montant_initial_base_troisième_enfant_et_plus égal à
si nombre de enfants_à_charge_droit_ouvert_prestation_familiale > 2 si nombre de enfants_à_charge_droit_ouvert_prestation_familiale > 2
alors (bmaf.montant * 10,25 %) * ( alors (bmaf.montant * 10,25 %) * (
entier_vers_décimal de décimal de
((nombre de enfants_à_charge_droit_ouvert_prestation_familiale) - 2) ((nombre de enfants_à_charge_droit_ouvert_prestation_familiale) - 2)
) sinon 0 € ) sinon 0 €
``` ```
@ -198,7 +198,7 @@ champ d'application AllocationsFamiliales :
champ d'application AllocationsFamiliales : champ d'application AllocationsFamiliales :
définition montant_versé_forfaitaire égal à définition montant_versé_forfaitaire égal à
montant_versé_forfaitaire_par_enfant * montant_versé_forfaitaire_par_enfant *
entier_vers_décimal de décimal de
nombre de (enfant dans enfants_à_charge nombre de (enfant dans enfants_à_charge
tel que droit_ouvert_forfaitaire de enfant) tel que droit_ouvert_forfaitaire de enfant)
``` ```
@ -302,7 +302,7 @@ I.-Le plafond prévu au 1° du I des articles D. 521-1 et D. 521-2 est fixé à
```catala ```catala
champ d'application AllocationsFamiliales : champ d'application AllocationsFamiliales :
définition plafond_I_d521_3 égal à 55 950 € + définition plafond_I_d521_3 égal à 55 950 € +
5 595 € * (entier_vers_décimal de 5 595 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
``` ```
@ -312,7 +312,7 @@ II.-Le plafond prévu au 2° du I des articles D. 521-1 et D. 521-2 est fixé à
```catala ```catala
champ d'application AllocationsFamiliales : champ d'application AllocationsFamiliales :
définition plafond_II_d521_3 égal à 78 300 € + définition plafond_II_d521_3 égal à 78 300 € +
5 595 € * (entier_vers_décimal de 5 595 € * (décimal de
(nombre de enfants_à_charge_droit_ouvert_prestation_familiale)) (nombre de enfants_à_charge_droit_ouvert_prestation_familiale))
``` ```

View File

@ -158,7 +158,7 @@ enfants à charge.
```catala ```catala
champ d'application AllocationsFamiliales : champ d'application AllocationsFamiliales :
définition nombre_total_enfants égal à définition nombre_total_enfants égal à
entier_vers_décimal de (nombre de décimal de (nombre de
enfants_à_charge_droit_ouvert_prestation_familiale) enfants_à_charge_droit_ouvert_prestation_familiale)
``` ```

View File

@ -785,7 +785,7 @@ declaration scope MoneyValues:
scope MoneyValues: scope MoneyValues:
definition value1 under condition definition value1 under condition
12.655465446655426 - 0.45265426541654 < 12.3554654652 consequence 12.655465446655426 - 0.45265426541654 < 12.3554654652 consequence
equals (integer_to_decimal of 45) / (integer_to_decimal of 9) equals (decimal of 45) / (decimal of 9)
definition value2 equals definition value2 equals
$1.00 * ((($6,520.23 - $320.45) * value1) / $45) $1.00 * ((($6,520.23 - $320.45) * value1) / $45)
``` ```

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -403,16 +403,16 @@ let enfant_le_plus_age (enfant_le_plus_age_in: EnfantLePlusAgeIn.t) : EnfantLePl
start_line=12; start_column=14; end_line=12; end_column=25; start_line=12; start_column=14; end_line=12; end_column=25;
law_headings=["Règles diverses"; "Épilogue"]} true)) law_headings=["Règles diverses"; "Épilogue"]} true))
(fun (_: unit) -> (fun (_: unit) ->
o_fold o_reduce
(fun (acc_: Enfant.t) (item_: Enfant.t) -> (fun (x1_: Enfant.t) (x2_: Enfant.t) ->
if if
(o_lt_dat_dat (let potentiel_plus_age_ : Enfant.t = acc_ (o_lt_dat_dat (let potentiel_plus_age_ : Enfant.t = x1_
in in
(potentiel_plus_age_.Enfant.date_de_naissance)) (potentiel_plus_age_.Enfant.date_de_naissance))
(let potentiel_plus_age_ : Enfant.t = item_ (let potentiel_plus_age_ : Enfant.t = x2_
in in
(potentiel_plus_age_.Enfant.date_de_naissance))) then (potentiel_plus_age_.Enfant.date_de_naissance))) then
acc_ else item_) x1_ else x2_)
({Enfant.identifiant = (integer_of_string "-1"); ({Enfant.identifiant = (integer_of_string "-1");
Enfant.obligation_scolaire = Enfant.obligation_scolaire =
(SituationObligationScolaire.Pendant ()); (SituationObligationScolaire.Pendant ());
@ -1018,8 +1018,8 @@ let prestations_familiales (prestations_familiales_in: PrestationsFamilialesIn.t
([||]) ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_R.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_R.catala_fr";
start_line=217; start_column=18; start_line=215; start_column=18;
end_line=217; end_column=41; end_line=215; end_column=41;
law_headings=["Article R755-0-2"; law_headings=["Article R755-0-2";
"Chapitre 5 : Prestations familiales et prestations assimilées"; "Chapitre 5 : Prestations familiales et prestations assimilées";
"Titre 5 : Départements d'outre-mer"; "Titre 5 : Départements d'outre-mer";
@ -1662,7 +1662,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Prologue"]} ([||]) "Prologue"]} ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=293; start_column=14; end_line=293; end_column=35; start_line=294; start_column=14; end_line=294; end_column=35;
law_headings=["Article D521-2"; law_headings=["Article D521-2";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -2003,7 +2003,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
o_add_mon_mon (money_of_cents_string "7877000") o_add_mon_mon (money_of_cents_string "7877000")
(o_mult_mon_rat (money_of_cents_string (o_mult_mon_rat (money_of_cents_string
"562800") "562800")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_))))); enfants_a_charge_droit_ouvert_prestation_familiale_)))));
(fun (_: unit) -> (fun (_: unit) ->
@ -2029,7 +2029,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
o_add_mon_mon (money_of_cents_string "7955800") o_add_mon_mon (money_of_cents_string "7955800")
(o_mult_mon_rat (money_of_cents_string (o_mult_mon_rat (money_of_cents_string
"568400") "568400")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_))))); enfants_a_charge_droit_ouvert_prestation_familiale_)))));
(fun (_: unit) -> (fun (_: unit) ->
@ -2055,7 +2055,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
o_add_mon_mon (money_of_cents_string "8083100") o_add_mon_mon (money_of_cents_string "8083100")
(o_mult_mon_rat (money_of_cents_string (o_mult_mon_rat (money_of_cents_string
"577500") "577500")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_))))); enfants_a_charge_droit_ouvert_prestation_familiale_)))));
(fun (_: unit) -> (fun (_: unit) ->
@ -2082,13 +2082,13 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
o_add_mon_mon (money_of_cents_string "8155800") o_add_mon_mon (money_of_cents_string "8155800")
(o_mult_mon_rat (money_of_cents_string (o_mult_mon_rat (money_of_cents_string
"582700") "582700")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_)))))|]) enfants_a_charge_droit_ouvert_prestation_familiale_)))))|])
(fun (_: unit) -> false) (fun (_: unit) -> raise EmptyError))|]) (fun (_: unit) -> false) (fun (_: unit) -> raise EmptyError))|])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=313; start_column=14; end_line=313; end_column=31; start_line=314; start_column=14; end_line=314; end_column=31;
law_headings=["Article D521-3"; law_headings=["Article D521-3";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -2098,7 +2098,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
(fun (_: unit) -> (fun (_: unit) ->
o_add_mon_mon (money_of_cents_string "7830000") o_add_mon_mon (money_of_cents_string "7830000")
(o_mult_mon_rat (money_of_cents_string "559500") (o_mult_mon_rat (money_of_cents_string "559500")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_))))) enfants_a_charge_droit_ouvert_prestation_familiale_)))))
with with
@ -2145,7 +2145,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
o_add_mon_mon (money_of_cents_string "5628600") o_add_mon_mon (money_of_cents_string "5628600")
(o_mult_mon_rat (money_of_cents_string (o_mult_mon_rat (money_of_cents_string
"562800") "562800")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_))))); enfants_a_charge_droit_ouvert_prestation_familiale_)))));
(fun (_: unit) -> (fun (_: unit) ->
@ -2171,7 +2171,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
o_add_mon_mon (money_of_cents_string "5684900") o_add_mon_mon (money_of_cents_string "5684900")
(o_mult_mon_rat (money_of_cents_string (o_mult_mon_rat (money_of_cents_string
"568400") "568400")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_))))); enfants_a_charge_droit_ouvert_prestation_familiale_)))));
(fun (_: unit) -> (fun (_: unit) ->
@ -2197,7 +2197,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
o_add_mon_mon (money_of_cents_string "5775900") o_add_mon_mon (money_of_cents_string "5775900")
(o_mult_mon_rat (money_of_cents_string (o_mult_mon_rat (money_of_cents_string
"577500") "577500")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_))))); enfants_a_charge_droit_ouvert_prestation_familiale_)))));
(fun (_: unit) -> (fun (_: unit) ->
@ -2224,13 +2224,13 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
o_add_mon_mon (money_of_cents_string "5827900") o_add_mon_mon (money_of_cents_string "5827900")
(o_mult_mon_rat (money_of_cents_string (o_mult_mon_rat (money_of_cents_string
"582700") "582700")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_)))))|]) enfants_a_charge_droit_ouvert_prestation_familiale_)))))|])
(fun (_: unit) -> false) (fun (_: unit) -> raise EmptyError))|]) (fun (_: unit) -> false) (fun (_: unit) -> raise EmptyError))|])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=303; start_column=14; end_line=303; end_column=30; start_line=304; start_column=14; end_line=304; end_column=30;
law_headings=["Article D521-3"; law_headings=["Article D521-3";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -2240,7 +2240,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
(fun (_: unit) -> (fun (_: unit) ->
o_add_mon_mon (money_of_cents_string "5595000") o_add_mon_mon (money_of_cents_string "5595000")
(o_mult_mon_rat (money_of_cents_string "559500") (o_mult_mon_rat (money_of_cents_string "559500")
(o_intToRat (o_torat_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_))))) enfants_a_charge_droit_ouvert_prestation_familiale_)))))
with with
@ -2432,7 +2432,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
(o_mult_mon_rat (o_mult_mon_rat
(o_mult_mon_rat bmaf_dot_montant_ (o_mult_mon_rat bmaf_dot_montant_
(decimal_of_string "0.0463")) (decimal_of_string "0.0463"))
(o_intToRat (o_torat_int
(o_sub_int_int (o_sub_int_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_) enfants_a_charge_droit_ouvert_prestation_familiale_)
@ -2802,7 +2802,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Prologue"]} ([||]) "Prologue"]} ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_R.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_R.catala_fr";
start_line=162; start_column=14; end_line=162; end_column=34; start_line=160; start_column=14; end_line=160; end_column=34;
law_headings=["Article R521-3"; law_headings=["Article R521-3";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -2810,7 +2810,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Partie réglementaire - Décrets en Conseil d'Etat"; "Partie réglementaire - Décrets en Conseil d'Etat";
"Code de la sécurité sociale"]} true)) "Code de la sécurité sociale"]} true))
(fun (_: unit) -> (fun (_: unit) ->
o_intToRat o_torat_int
(o_length enfants_a_charge_droit_ouvert_prestation_familiale_))) (o_length enfants_a_charge_droit_ouvert_prestation_familiale_)))
with with
EmptyError -> (raise (NoValueProvided EmptyError -> (raise (NoValueProvided
@ -2836,10 +2836,12 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Partie réglementaire - Décrets en Conseil d'Etat"; "Partie réglementaire - Décrets en Conseil d'Etat";
"Code de la sécurité sociale"]} true)) "Code de la sécurité sociale"]} true))
(fun (_: unit) -> (fun (_: unit) ->
o_fold o_reduce
(fun (acc_: decimal) (enfant_: Enfant.t) -> (fun (x1_: decimal) (x2_: decimal) -> o_add_rat_rat x1_ x2_)
o_add_rat_rat acc_ (decimal_of_string "0.")
(match ((log_end_call (o_map
(fun (enfant_: Enfant.t) ->
match ((log_end_call
["AllocationsFamiliales"; "prise_en_compte"] ["AllocationsFamiliales"; "prise_en_compte"]
((log_variable_definition ((log_variable_definition
["AllocationsFamiliales"; "prise_en_compte"; "output"] ["AllocationsFamiliales"; "prise_en_compte"; "output"]
@ -2851,9 +2853,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
with with
| PriseEnCompte.Complete _ -> (decimal_of_string "1.") | PriseEnCompte.Complete _ -> (decimal_of_string "1.")
| PriseEnCompte.Partagee _ -> (decimal_of_string "0.5") | PriseEnCompte.Partagee _ -> (decimal_of_string "0.5")
| PriseEnCompte.Zero _ -> (decimal_of_string "0."))) | PriseEnCompte.Zero _ -> (decimal_of_string "0."))
(decimal_of_string "0.") enfants_a_charge_droit_ouvert_prestation_familiale_)))
enfants_a_charge_droit_ouvert_prestation_familiale_))
with with
EmptyError -> (raise (NoValueProvided EmptyError -> (raise (NoValueProvided
{filename = "examples/allocations_familiales/prologue.catala_fr"; {filename = "examples/allocations_familiales/prologue.catala_fr";
@ -3290,8 +3291,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
([||]) ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=364; start_column=5; start_line=365; start_column=5;
end_line=365; end_column=71; end_line=366; end_column=71;
law_headings=["Article D755-5"; law_headings=["Article D755-5";
"Chapitre 5 : Prestations familiales et prestations assimilées"; "Chapitre 5 : Prestations familiales et prestations assimilées";
"Titre 5 : Départements d'outre-mer"; "Titre 5 : Départements d'outre-mer";
@ -3309,7 +3310,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
(decimal_of_string "0.0588")))|]) (decimal_of_string "0.0588")))|])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=361; start_column=29; end_line=361; end_column=64; start_line=362; start_column=29; end_line=362; end_column=64;
law_headings=["Article D755-5"; law_headings=["Article D755-5";
"Chapitre 5 : Prestations familiales et prestations assimilées"; "Chapitre 5 : Prestations familiales et prestations assimilées";
"Titre 5 : Départements d'outre-mer"; "Titre 5 : Départements d'outre-mer";
@ -3676,8 +3677,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
([||]) ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=220; start_column=5; start_line=221; start_column=5;
end_line=220; end_column=42; end_line=221; end_column=42;
law_headings=["Article D521-2"; law_headings=["Article D521-2";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -3698,8 +3699,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
([||]) ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=234; start_column=5; start_line=235; start_column=5;
end_line=235; end_column=45; end_line=236; end_column=45;
law_headings=["Article D521-2"; law_headings=["Article D521-2";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -3722,8 +3723,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
([||]) ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=248; start_column=5; start_line=249; start_column=5;
end_line=248; end_column=42; end_line=249; end_column=42;
law_headings=["Article D521-2"; law_headings=["Article D521-2";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -3778,7 +3779,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
(o_mult_mon_rat (o_mult_mon_rat
(o_mult_mon_rat bmaf_dot_montant_ (o_mult_mon_rat bmaf_dot_montant_
(decimal_of_string "0.41")) (decimal_of_string "0.41"))
(o_intToRat (o_torat_int
(o_sub_int_int (o_sub_int_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_) enfants_a_charge_droit_ouvert_prestation_familiale_)
@ -3814,7 +3815,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
(o_mult_mon_rat (o_mult_mon_rat
(o_mult_mon_rat bmaf_dot_montant_ (o_mult_mon_rat bmaf_dot_montant_
(decimal_of_string "0.205")) (decimal_of_string "0.205"))
(o_intToRat (o_torat_int
(o_sub_int_int (o_sub_int_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_) enfants_a_charge_droit_ouvert_prestation_familiale_)
@ -3848,7 +3849,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
(o_mult_mon_rat (o_mult_mon_rat
(o_mult_mon_rat bmaf_dot_montant_ (o_mult_mon_rat bmaf_dot_montant_
(decimal_of_string "0.1025")) (decimal_of_string "0.1025"))
(o_intToRat (o_torat_int
(o_sub_int_int (o_sub_int_int
(o_length (o_length
enfants_a_charge_droit_ouvert_prestation_familiale_) enfants_a_charge_droit_ouvert_prestation_familiale_)
@ -4540,26 +4541,23 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Code de la sécurité sociale"]} true)) "Code de la sécurité sociale"]} true))
(fun (_: unit) -> (fun (_: unit) ->
o_mult_mon_rat montant_verse_forfaitaire_par_enfant_ o_mult_mon_rat montant_verse_forfaitaire_par_enfant_
(o_intToRat (o_torat_int
(o_fold (o_length
(fun (acc_: integer) (enfant_: Enfant.t) -> (o_filter
if (fun (enfant_: Enfant.t) -> (log_end_call
((log_end_call ["AllocationsFamiliales";
["AllocationsFamiliales"; "droit_ouvert_forfaitaire"]
"droit_ouvert_forfaitaire"] ((log_variable_definition
((log_variable_definition ["AllocationsFamiliales";
["AllocationsFamiliales"; "droit_ouvert_forfaitaire"; "output"]
"droit_ouvert_forfaitaire"; "output"] (embed_bool) ((log_begin_call
(embed_bool) ((log_begin_call ["AllocationsFamiliales";
["AllocationsFamiliales"; "droit_ouvert_forfaitaire"]
"droit_ouvert_forfaitaire"] droit_ouvert_forfaitaire_)
droit_ouvert_forfaitaire_) ((log_variable_definition
((log_variable_definition ["AllocationsFamiliales";
["AllocationsFamiliales"; "droit_ouvert_forfaitaire"; "input"]
"droit_ouvert_forfaitaire"; "input"] (embed_enfant) enfant_))))))) enfants_a_charge_)))))
(embed_enfant) enfant_))))))) then
(o_add_int_int acc_ (integer_of_string "1")) else
acc_) (integer_of_string "0") enfants_a_charge_))))
with with
EmptyError -> (raise (NoValueProvided EmptyError -> (raise (NoValueProvided
{filename = "examples/allocations_familiales/prologue.catala_fr"; {filename = "examples/allocations_familiales/prologue.catala_fr";
@ -4591,8 +4589,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Prologue"]} ([||]) "Prologue"]} ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=355; start_column=5; start_line=356; start_column=5;
end_line=356; end_column=69; end_line=357; end_column=69;
law_headings=["Article D755-5"; law_headings=["Article D755-5";
"Chapitre 5 : Prestations familiales et prestations assimilées"; "Chapitre 5 : Prestations familiales et prestations assimilées";
"Titre 5 : Départements d'outre-mer"; "Titre 5 : Départements d'outre-mer";
@ -4677,8 +4675,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Prologue"]} ([||]) "Prologue"]} ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=378; start_column=5; start_line=379; start_column=5;
end_line=382; end_column=55; end_line=383; end_column=55;
law_headings=["Article D755-5"; law_headings=["Article D755-5";
"Chapitre 5 : Prestations familiales et prestations assimilées"; "Chapitre 5 : Prestations familiales et prestations assimilées";
"Titre 5 : Départements d'outre-mer"; "Titre 5 : Départements d'outre-mer";
@ -4730,8 +4728,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Prologue"]} ([||]) "Prologue"]} ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=388; start_column=5; start_line=389; start_column=5;
end_line=391; end_column=56; end_line=392; end_column=56;
law_headings=["Article D755-5"; law_headings=["Article D755-5";
"Chapitre 5 : Prestations familiales et prestations assimilées"; "Chapitre 5 : Prestations familiales et prestations assimilées";
"Titre 5 : Départements d'outre-mer"; "Titre 5 : Départements d'outre-mer";
@ -4831,8 +4829,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Prologue"]} ([||]) "Prologue"]} ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=267; start_column=5; start_line=268; start_column=5;
end_line=269; end_column=41; end_line=270; end_column=41;
law_headings=["Article D521-2"; law_headings=["Article D521-2";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -4867,8 +4865,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
"Prologue"]} ([||]) "Prologue"]} ([||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=277; start_column=5; start_line=278; start_column=5;
end_line=279; end_column=40; end_line=280; end_column=40;
law_headings=["Article D521-2"; law_headings=["Article D521-2";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -4896,7 +4894,7 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
(fun (_: unit) -> false) (fun (_: unit) -> raise EmptyError))|]) (fun (_: unit) -> false) (fun (_: unit) -> raise EmptyError))|])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_D.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_D.catala_fr";
start_line=285; start_column=14; end_line=285; end_column=55; start_line=286; start_column=14; end_line=286; end_column=55;
law_headings=["Article D521-2"; law_headings=["Article D521-2";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -4950,8 +4948,8 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
[||]) [||])
(fun (_: unit) -> (log_decision_taken (fun (_: unit) -> (log_decision_taken
{filename = "examples/allocations_familiales/securite_sociale_R.catala_fr"; {filename = "examples/allocations_familiales/securite_sociale_R.catala_fr";
start_line=188; start_column=5; start_line=186; start_column=5;
end_line=188; end_column=43; end_line=186; end_column=43;
law_headings=["Article R521-4"; law_headings=["Article R521-4";
"Chapitre 1er : Allocations familiales"; "Chapitre 1er : Allocations familiales";
"Titre 2 : Prestations générales d'entretien"; "Titre 2 : Prestations générales d'entretien";
@ -5028,23 +5026,25 @@ let allocations_familiales (allocations_familiales_in: AllocationsFamilialesIn.t
law_headings=["Règles diverses"; "Épilogue"]} true)) law_headings=["Règles diverses"; "Épilogue"]} true))
(fun (_: unit) -> (fun (_: unit) ->
if droit_ouvert_base_ then if droit_ouvert_base_ then
(o_fold (o_reduce
(fun (acc_: money) (enfant_: Enfant.t) -> (fun (x1_: money) (x2_: money) -> o_add_mon_mon x1_ x2_)
o_add_mon_mon acc_ ((log_end_call (money_of_cents_string "0")
["AllocationsFamiliales"; (o_map
"montant_avec_garde_alternée_majoration"] (fun (enfant_: Enfant.t) -> (log_end_call
((log_variable_definition ["AllocationsFamiliales";
["AllocationsFamiliales"; "montant_avec_garde_alternée_majoration"]
"montant_avec_garde_alternée_majoration"; "output"] ((log_variable_definition
(embed_money) ((log_begin_call ["AllocationsFamiliales";
["AllocationsFamiliales"; "montant_avec_garde_alternée_majoration"; "output"]
"montant_avec_garde_alternée_majoration"] (embed_money) ((log_begin_call
montant_avec_garde_alternee_majoration_) ["AllocationsFamiliales";
((log_variable_definition "montant_avec_garde_alternée_majoration"]
["AllocationsFamiliales"; montant_avec_garde_alternee_majoration_)
"montant_avec_garde_alternée_majoration"; "input"] ((log_variable_definition
(embed_enfant) enfant_)))))))) (money_of_cents_string ["AllocationsFamiliales";
"0") enfants_a_charge_) else (money_of_cents_string "0"))) "montant_avec_garde_alternée_majoration"; "input"]
(embed_enfant) enfant_))))))) enfants_a_charge_)) else
(money_of_cents_string "0")))
with with
EmptyError -> (raise (NoValueProvided EmptyError -> (raise (NoValueProvided
{filename = "examples/allocations_familiales/prologue.catala_fr"; {filename = "examples/allocations_familiales/prologue.catala_fr";

File diff suppressed because it is too large Load Diff

View File

@ -514,22 +514,22 @@ def allocation_familiales_avril2008(allocation_familiales_avril2008_in:Allocatio
def enfant_le_plus_age(enfant_le_plus_age_in:EnfantLePlusAgeIn): def enfant_le_plus_age(enfant_le_plus_age_in:EnfantLePlusAgeIn):
enfants = enfant_le_plus_age_in.enfants_in enfants = enfant_le_plus_age_in.enfants_in
try: try:
def temp_le_plus_age(acc:Enfant, item:Enfant): def temp_le_plus_age(x1:Enfant, x2:Enfant):
if (acc.date_de_naissance < item.date_de_naissance): if (x1.date_de_naissance < x2.date_de_naissance):
return acc return x1
else: else:
return item return x2
temp_le_plus_age_1 = list_fold_left(temp_le_plus_age, temp_le_plus_age_1 = list_reduce(temp_le_plus_age,
Enfant(identifiant = integer_of_string("-1"), Enfant(identifiant = integer_of_string("-1"),
obligation_scolaire = SituationObligationScolaire(SituationObligationScolaire_Code.Pendant, obligation_scolaire = SituationObligationScolaire(SituationObligationScolaire_Code.Pendant,
Unit()), Unit()),
remuneration_mensuelle = money_of_cents_string("0"), remuneration_mensuelle = money_of_cents_string("0"),
date_de_naissance = date_of_numbers(2999,12,31), date_de_naissance = date_of_numbers(2999,12,31),
prise_en_charge = PriseEnCharge(PriseEnCharge_Code.EffectiveEtPermanente, prise_en_charge = PriseEnCharge(PriseEnCharge_Code.EffectiveEtPermanente,
Unit()), Unit()),
a_deja_ouvert_droit_aux_allocations_familiales = False, a_deja_ouvert_droit_aux_allocations_familiales = False,
beneficie_titre_personnel_aide_personnelle_logement = False), beneficie_titre_personnel_aide_personnelle_logement = False),
enfants) enfants)
except EmptyError: except EmptyError:
temp_le_plus_age_1 = dead_value temp_le_plus_age_1 = dead_value
raise NoValueProvided(SourcePosition(filename="examples/allocations_familiales/prologue.catala_fr", raise NoValueProvided(SourcePosition(filename="examples/allocations_familiales/prologue.catala_fr",
@ -1846,21 +1846,23 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
"Prologue"])) "Prologue"]))
nombre_total_enfants = temp_nombre_total_enfants nombre_total_enfants = temp_nombre_total_enfants
try: try:
def temp_nombre_moyen_enfants(acc_1:Decimal, enfant_1:Enfant): def temp_nombre_moyen_enfants(enfant_1:Enfant):
match_arg_16 = prise_en_compte(enfant_1) match_arg_16 = prise_en_compte(enfant_1)
if match_arg_16.code == PriseEnCompte_Code.Complete: if match_arg_16.code == PriseEnCompte_Code.Complete:
_ = match_arg_16.value _ = match_arg_16.value
temp_nombre_moyen_enfants_1 = decimal_of_string("1.") return decimal_of_string("1.")
elif match_arg_16.code == PriseEnCompte_Code.Partagee: elif match_arg_16.code == PriseEnCompte_Code.Partagee:
_ = match_arg_16.value _ = match_arg_16.value
temp_nombre_moyen_enfants_1 = decimal_of_string("0.5") return decimal_of_string("0.5")
elif match_arg_16.code == PriseEnCompte_Code.Zero: elif match_arg_16.code == PriseEnCompte_Code.Zero:
_ = match_arg_16.value _ = match_arg_16.value
temp_nombre_moyen_enfants_1 = decimal_of_string("0.") return decimal_of_string("0.")
return (acc_1 + temp_nombre_moyen_enfants_1) def temp_nombre_moyen_enfants_1(x1_1:Decimal, x2_1:Decimal):
temp_nombre_moyen_enfants_2 = list_fold_left(temp_nombre_moyen_enfants, return (x1_1 + x2_1)
decimal_of_string("0."), temp_nombre_moyen_enfants_2 = list_reduce(temp_nombre_moyen_enfants_1,
enfants_a_charge_droit_ouvert_prestation_familiale) decimal_of_string("0."),
list_map(temp_nombre_moyen_enfants,
enfants_a_charge_droit_ouvert_prestation_familiale))
except EmptyError: except EmptyError:
temp_nombre_moyen_enfants_2 = dead_value temp_nombre_moyen_enfants_2 = dead_value
raise NoValueProvided(SourcePosition(filename="examples/allocations_familiales/prologue.catala_fr", raise NoValueProvided(SourcePosition(filename="examples/allocations_familiales/prologue.catala_fr",
@ -2637,15 +2639,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
"Prologue"])) "Prologue"]))
montant_initial_metropole_majoration = temp_montant_initial_metropole_majoration montant_initial_metropole_majoration = temp_montant_initial_metropole_majoration
try: try:
def temp_montant_verse_forfaitaire(acc_2:Integer, enfant_2:Enfant): def temp_montant_verse_forfaitaire(enfant_2:Enfant):
if droit_ouvert_forfaitaire(enfant_2): return droit_ouvert_forfaitaire(enfant_2)
return (acc_2 + integer_of_string("1"))
else:
return acc_2
temp_montant_verse_forfaitaire_1 = (montant_verse_forfaitaire_par_enfant * temp_montant_verse_forfaitaire_1 = (montant_verse_forfaitaire_par_enfant *
decimal_of_integer(list_fold_left(temp_montant_verse_forfaitaire, decimal_of_integer(list_length(list_filter(temp_montant_verse_forfaitaire,
integer_of_string("0"), enfants_a_charge))))
enfants_a_charge)))
except EmptyError: except EmptyError:
temp_montant_verse_forfaitaire_1 = dead_value temp_montant_verse_forfaitaire_1 = dead_value
raise NoValueProvided(SourcePosition(filename="examples/allocations_familiales/prologue.catala_fr", raise NoValueProvided(SourcePosition(filename="examples/allocations_familiales/prologue.catala_fr",
@ -2872,23 +2870,25 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
montant_verse_base = temp_montant_verse_base montant_verse_base = temp_montant_verse_base
try: try:
if droit_ouvert_base: if droit_ouvert_base:
def temp_montant_verse_majoration(acc_3:Money, enfant_3:Enfant): def temp_montant_verse_majoration(enfant_3:Enfant):
return (acc_3 + return montant_avec_garde_alternee_majoration(enfant_3)
montant_avec_garde_alternee_majoration(enfant_3)) def temp_montant_verse_majoration_1(x1_2:Money, x2_2:Money):
temp_montant_verse_majoration_1 = list_fold_left(temp_montant_verse_majoration, return (x1_2 + x2_2)
money_of_cents_string("0"), temp_montant_verse_majoration_2 = list_reduce(temp_montant_verse_majoration_1,
enfants_a_charge) money_of_cents_string("0"),
list_map(temp_montant_verse_majoration,
enfants_a_charge))
else: else:
temp_montant_verse_majoration_1 = money_of_cents_string("0") temp_montant_verse_majoration_2 = money_of_cents_string("0")
except EmptyError: except EmptyError:
temp_montant_verse_majoration_1 = dead_value temp_montant_verse_majoration_2 = dead_value
raise NoValueProvided(SourcePosition(filename="examples/allocations_familiales/prologue.catala_fr", raise NoValueProvided(SourcePosition(filename="examples/allocations_familiales/prologue.catala_fr",
start_line=129, start_column=11, start_line=129, start_column=11,
end_line=129, end_column=35, end_line=129, end_column=35,
law_headings=["Allocations familiales", law_headings=["Allocations familiales",
"Champs d'applications", "Champs d'applications",
"Prologue"])) "Prologue"]))
montant_verse_majoration = temp_montant_verse_majoration_1 montant_verse_majoration = temp_montant_verse_majoration_2
try: try:
temp_montant_base_complement_pour_base_et_majoration = (montant_verse_base + temp_montant_base_complement_pour_base_et_majoration = (montant_verse_base +
montant_verse_majoration) montant_verse_majoration)

View File

@ -580,16 +580,16 @@ let equal_periods (p1 : duration) (p2 : duration) : bool =
module Oper = struct module Oper = struct
let o_not = Stdlib.not let o_not = Stdlib.not
let o_length a = Z.of_int (Array.length a) let o_length a = Z.of_int (Array.length a)
let o_intToRat = decimal_of_integer let o_torat_int = decimal_of_integer
let o_moneyToRat = decimal_of_money let o_torat_mon = decimal_of_money
let o_ratToMoney = money_of_decimal let o_tomoney_rat = money_of_decimal
let o_getDay = day_of_month_of_date let o_getDay = day_of_month_of_date
let o_getMonth = month_number_of_date let o_getMonth = month_number_of_date
let o_getYear = year_of_date let o_getYear = year_of_date
let o_firstDayOfMonth = first_day_of_month let o_firstDayOfMonth = first_day_of_month
let o_lastDayOfMonth = last_day_of_month let o_lastDayOfMonth = last_day_of_month
let o_roundMoney = money_round let o_round_mon = money_round
let o_roundDecimal = decimal_round let o_round_rat = decimal_round
let o_minus_int i1 = Z.sub Z.zero i1 let o_minus_int i1 = Z.sub Z.zero i1
let o_minus_rat i1 = Q.sub Q.zero i1 let o_minus_rat i1 = Q.sub Q.zero i1
let o_minus_mon m1 = Z.sub Z.zero m1 let o_minus_mon m1 = Z.sub Z.zero m1

View File

@ -289,16 +289,16 @@ module Oper : sig
(* The types **must** match with Shared_ast.Operator.*_type *) (* The types **must** match with Shared_ast.Operator.*_type *)
val o_not : bool -> bool val o_not : bool -> bool
val o_length : 'a array -> integer val o_length : 'a array -> integer
val o_intToRat : integer -> decimal val o_torat_int : integer -> decimal
val o_moneyToRat : money -> decimal val o_torat_mon : money -> decimal
val o_ratToMoney : decimal -> money val o_tomoney_rat : decimal -> money
val o_getDay : date -> integer val o_getDay : date -> integer
val o_getMonth : date -> integer val o_getMonth : date -> integer
val o_getYear : date -> integer val o_getYear : date -> integer
val o_firstDayOfMonth : date -> date val o_firstDayOfMonth : date -> date
val o_lastDayOfMonth : date -> date val o_lastDayOfMonth : date -> date
val o_roundMoney : money -> money val o_round_mon : money -> money
val o_roundDecimal : decimal -> decimal val o_round_rat : decimal -> decimal
val o_minus_int : integer -> integer val o_minus_int : integer -> integer
val o_minus_rat : decimal -> decimal val o_minus_rat : decimal -> decimal
val o_minus_mon : money -> money val o_minus_mon : money -> money

View File

@ -21,11 +21,11 @@ scope S:
# Extremum # Extremum
assertion maximum of [1; 2; 3] or if collection is empty then 10 = 3 assertion maximum of [1; 2; 3] or if collection is empty then 10 = 3
assertion maximum of (integer_to_decimal of i) for i in [1; 2; 3] or if collection is empty then 10. = 3. assertion maximum of (decimal of i) for i in [1; 2; 3] or if collection is empty then 10. = 3.
# Arg extremum # Arg extremum
assertion (i in [1; 2; 3] assertion (i in [1; 2; 3]
such that integer_to_decimal of ((2 - i) * (2 - i)) is minimum such that decimal of ((2 - i) * (2 - i)) is minimum
or if collection is empty then 42) or if collection is empty then 42)
= 2 = 2
``` ```
@ -38,13 +38,13 @@ let scope S (x: integer|internal|output) =
(λ (x1: integer) (x2: integer) → (λ (x1: integer) (x2: integer) →
if if
let i : integer = x1 in let i : integer = x1 in
int_to_rat 2 -! i *! 2 -! i <. to_rat_int 2 -! i *! 2 -! i <.
let i : integer = x2 in let i : integer = x2 in
int_to_rat 2 -! i *! 2 -! i then x1 else x2) 42 [1; 2; 3] = to_rat_int 2 -! i *! 2 -! i then x1 else x2) 42 [1; 2; 3] =
2; 2;
assert reduce assert reduce
(λ (x1: decimal) (x2: decimal) → if x1 >. x2 then x1 else x2) (λ (x1: decimal) (x2: decimal) → if x1 >. x2 then x1 else x2)
10. map (λ (i: integer) → int_to_rat i) [1; 2; 3] = 3.; 10. map (λ (i: integer) → to_rat_int i) [1; 2; 3] = 3.;
assert reduce assert reduce
(λ (x1: integer) (x2: integer) → if x1 >! x2 then x1 else x2) (λ (x1: integer) (x2: integer) → if x1 >! x2 then x1 else x2)
10 [1; 2; 3] = 3; 10 [1; 2; 3] = 3;

View File

@ -10,8 +10,8 @@ declaration scope A:
scope A: scope A:
definition x equals 84.648665 definition x equals 84.648665
definition y equals 4.368297 definition y equals 4.368297
definition x1 equals round_decimal of x definition x1 equals round of x
definition y1 equals round_decimal of y definition y1 equals round of y
``` ```
```catala-test-inline ```catala-test-inline

View File

@ -14,7 +14,7 @@ declaration structure B:
data z content decimal data z content decimal
scope S: scope S:
definition b equals let b equals 42 in B { -- y: true -- z: integer_to_decimal of b} definition b equals let b equals 42 in B { -- y: true -- z: decimal of b}
definition a equals definition a equals
let b equals let b equals
if b.y if b.y

View File

@ -14,7 +14,7 @@ scope S:
Structure { -- i: 4 -- e: y }; Structure { -- i: 4 -- e: y };
Structure { -- i: 5 -- e: Dat content |1970-01-01| } Structure { -- i: 5 -- e: Dat content |1970-01-01| }
] ]
definition a equals integer_to_decimal of (number of (z ++ z)) / 2. definition a equals decimal of (number of (z ++ z)) / 2.
scope S2: scope S2:
definition sub.x equals 44. definition sub.x equals 44.