Skip to content
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

Keep float as float32 when outputting them #708

Merged
merged 5 commits into from
Aug 8, 2018
Merged

Keep float as float32 when outputting them #708

merged 5 commits into from
Aug 8, 2018

Conversation

Anna-Livia
Copy link
Contributor

@Anna-Livia Anna-Livia commented Aug 6, 2018

Fixes #699

Technical changes

  • Addresses the typecasting made when outputing numbers in the API and in openfisca-run-test from float32 to float64.
  • The typecasting added random decimal numbers that bring no extra value to users.

@Anna-Livia Anna-Livia requested review from sandcha and fpagnoux August 6, 2018 15:02
@@ -116,6 +116,8 @@ def calculate():

if variable.value_type == Enum:
entity_result = result.decode()[entity_index].name
elif variable.value_type == float:
entity_result = float(str(result[entity_index])) # To turn the float32 into a regular float without adding confusing extra decimals. There must be a better way.
Copy link
Member

Choose a reason for hiding this comment

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

I guess we didn't find a better way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, not for now, all the solutions I found involved stringinfying in some way.

CHANGELOG.md Outdated
@@ -1,5 +1,10 @@
# Changelog

### 23.3.2 [#708](https://github.com/openfisca/openfisca-core/pull/708)

- Addresses the typecasting from `float32` to `float64` made when outputing numbers in the API and in `openfisca-run-test`.
Copy link
Member

Choose a reason for hiding this comment

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

The first and most obvious thing reading the Changelog should be the impact and users (your second point), before the technicality of how we fixed the issues (your first point).

I'd also add a small example of what changed, (maybe a short extract of a JSON?) to help illustrate what has changed 🙂

@Anna-Livia Anna-Livia requested a review from fpagnoux August 7, 2018 14:15
Copy link
Member

@fpagnoux fpagnoux left a comment

Choose a reason for hiding this comment

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

GTM (I slightly edited the Changelog)

@fpagnoux fpagnoux merged commit e3e2118 into master Aug 8, 2018
@fpagnoux fpagnoux deleted the rounding branch August 8, 2018 20:50
@fpagnoux
Copy link
Member

fpagnoux commented Aug 8, 2018

(Sorry, I should probably have let you the opportunity to review my editions, I was a little too enthusiastic to merge)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants