Skip to content

Improve compile time abs implementation #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions src/lpython/semantics/python_comptime_eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,30 @@ struct PythonIntrinsicProcedures {
if (args.size() != 1) {
throw SemanticError("Intrinsic abs function accepts exactly 1 argument", loc);
}
ASR::expr_t* trig_arg = args[0];
ASR::expr_t* arg = args[0];
ASR::ttype_t* t = ASRUtils::expr_type(args[0]);
if (ASR::is_a<ASR::Real_t>(*t)) {
double rv = ASR::down_cast<ASR::ConstantReal_t>(trig_arg)->m_r;
ASR::ttype_t *int_type = ASRUtils::TYPE(ASR::make_Integer_t(al, loc, 4, nullptr, 0));
ASR::ttype_t *real_type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8, nullptr, 0));
Comment on lines +101 to +102
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we take the kind from args[0]'s type instead of defaulting it to 8 or 4?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should, perhaps everywhere in the codebase.

if (ASRUtils::is_real(*t)) {
double rv = ASR::down_cast<ASR::ConstantReal_t>(arg)->m_r;
double val = std::abs(rv);
return ASR::down_cast<ASR::expr_t>(ASR::make_ConstantReal_t(al, loc, val, t));
} else if (ASR::is_a<ASR::Integer_t>(*t)) {
int64_t rv = ASR::down_cast<ASR::ConstantInteger_t>(trig_arg)->m_n;
return ASR::down_cast<ASR::expr_t>(ASR::make_ConstantReal_t(al, loc, val, real_type));
} else if (ASRUtils::is_integer(*t)) {
int64_t rv = ASR::down_cast<ASR::ConstantInteger_t>(arg)->m_n;
int64_t val = std::abs(rv);
return ASR::down_cast<ASR::expr_t>(ASR::make_ConstantInteger_t(al, loc, val, t));
} else if (ASR::is_a<ASR::Complex_t>(*t)) {
double re = ASR::down_cast<ASR::ConstantComplex_t>(trig_arg)->m_re;
double im = ASR::down_cast<ASR::ConstantComplex_t>(trig_arg)->m_im;
return ASR::down_cast<ASR::expr_t>(ASR::make_ConstantInteger_t(al, loc, val, int_type));
} else if (ASRUtils::is_logical(*t)) {
bool rv = ASR::down_cast<ASR::ConstantLogical_t>(arg)->m_value;
int8_t val = rv ? 1 : 0;
return ASR::down_cast<ASR::expr_t>(ASR::make_ConstantInteger_t(al, loc, val, int_type));
} else if (ASRUtils::is_complex(*t)) {
double re = ASR::down_cast<ASR::ConstantComplex_t>(arg)->m_re;
double im = ASR::down_cast<ASR::ConstantComplex_t>(arg)->m_im;
std::complex<double> x(re, im);
double result = std::abs(x);
return ASR::down_cast<ASR::expr_t>(ASR::make_ConstantReal_t(al, loc, result, t));
return ASR::down_cast<ASR::expr_t>(ASR::make_ConstantReal_t(al, loc, result, real_type));
} else {
throw SemanticError("Argument of the abs function must be Integer, Real or Complex", loc);
throw SemanticError("Argument of the abs function must be Integer, Real, Logical, or Complex.", loc);
}
}

Expand Down
12 changes: 6 additions & 6 deletions tests/constants1.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ def test_ord_chr():


def test_abs():
# a: i32
# a = abs(5)
# a = abs(-500)
# a = abs(False)
# a = abs(True)
a: i32
a = abs(5)
a = abs(-500)
a = abs(False)
a = abs(True)
b: f32
b = abs(3.45)
b = abs(-5346.34)
# b = abs(complex(3.45, 5.6))
b = abs(complex(3.45, 5.6))


def test_len():
Expand Down
4 changes: 2 additions & 2 deletions tests/reference/asr-constants1-5828e8a.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "asr-constants1-5828e8a",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/constants1.py",
"infile_hash": "6adf0c1cf8ec1667bf19edaf62d087483e6229370ed0f10a207ee0b4",
"infile_hash": "96e60b5d3b6cb09a1198932629c9974ac3cf8854e3b1c7ba8959ea83",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-constants1-5828e8a.stdout",
"stdout_hash": "afdf64c50b62ecb3a51f71b729f21920178f29682559773af511c470",
"stdout_hash": "6183731c70508ffbf40925fd0bc831a41578990f8e3ba1eb7ad59521",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-constants1-5828e8a.stdout

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/reference/ast-constants1-91cb6ff.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "ast-constants1-91cb6ff",
"cmd": "lpython --show-ast --no-color {infile} -o {outfile}",
"infile": "tests/constants1.py",
"infile_hash": "6adf0c1cf8ec1667bf19edaf62d087483e6229370ed0f10a207ee0b4",
"infile_hash": "96e60b5d3b6cb09a1198932629c9974ac3cf8854e3b1c7ba8959ea83",
"outfile": null,
"outfile_hash": null,
"stdout": "ast-constants1-91cb6ff.stdout",
"stdout_hash": "3c238eeeb457cbc223572db7626e55d0b8fdff79b1d03393d7734a66",
"stdout_hash": "e7906b7058bcb0974b8d5bf25eff5d2841d308688c9689dd4bd7b65b",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/ast-constants1-91cb6ff.stdout
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(Tuple [(ConstantStr "a" ()) (ConstantStr "b" ()) (ConstantFloat 3.400000 ())] Load) (Tuple [(ConstantStr "c" ()) (ConstantInt 3 ()) (ConstantFloat 5.600000 ())] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(List [(UnaryOp USub (ConstantInt 4 ())) (UnaryOp USub (ConstantInt 5 ())) (UnaryOp USub (ConstantInt 6 ()))] Load) (List [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ())) (UnaryOp USub (ConstantInt 3 ()))] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Set [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())])] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Dict [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] [(ConstantStr "a" ()) (ConstantStr "b" ()) (ConstantStr "c" ())])] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "t" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantStr "5346" ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantStr "423.534" ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] [])
(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantInt 500 ()))] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .true. ())] []) ()) (AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(Call (Name complex Load) [(ConstantFloat 3.450000 ()) (ConstantFloat 5.600000 ())] [])] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(Tuple [(ConstantStr "a" ()) (ConstantStr "b" ()) (ConstantFloat 3.400000 ())] Load) (Tuple [(ConstantStr "c" ()) (ConstantInt 3 ()) (ConstantFloat 5.600000 ())] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(List [(UnaryOp USub (ConstantInt 4 ())) (UnaryOp USub (ConstantInt 5 ())) (UnaryOp USub (ConstantInt 6 ()))] Load) (List [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ())) (UnaryOp USub (ConstantInt 3 ()))] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Set [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())])] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Dict [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] [(ConstantStr "a" ()) (ConstantStr "b" ()) (ConstantStr "c" ())])] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "t" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantStr "5346" ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantStr "423.534" ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] [])