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

Fixes to String.Format #1951

Merged
merged 6 commits into from
Jun 11, 2021
Merged

Fixes to String.Format #1951

merged 6 commits into from
Jun 11, 2021

Conversation

edleno2
Copy link
Contributor

@edleno2 edleno2 commented Jun 10, 2021

Description

  • Fixed lower case "g" to return exponential numbers like 1.23e+02 (note lower case 'e')
  • Fixed F format for integers so it does not try to zero pad fractional part - integers don't have any fractional part
  • Fixed one-off math issues in format N and calculation of significant digits
  • Fixed format N rounding to allow that next character may be the decimal point and not the next significant digit

Motivation and Context

While adding unit tests for String.Format it was noted that there were either bugs in nanoFramework, or inconsistency with .Net Core 5. These changes bring all unit tests into compliance with .Net Core 5.

How Has This Been Tested?

Win32 unit tests run on both nanoFramework and .Net Core 5

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (work on Unit Tests, has no impact on code or features)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

edleno2 added 4 commits June 6, 2021 23:41
N format was formatting significant digits incorrectly due to minor math errors (one-off).  F format had a mistake in handling integer types for leading zero's of fractional parts (which they don't have any).

Related to #770
Automated fixes for code style.
@nfbot
Copy link
Member

nfbot commented Jun 10, 2021

@edleno2 there are issues with the code style on the source files.
A PR was submitted with the code style fixes. Please click https://github.com/edleno2/nf-interpreter/pull/8, review the changes if you want and merge it.

Make sure to follow the project code style. Check the details here on how it works and the tools required to help you with that.

…173-9a91-4825-a0d9-381d7ea4c7be

Code style fixes for nanoframework/nf-interpreter PR#1951
@edleno2 edleno2 marked this pull request as ready for review June 10, 2021 22:12
Copy link
Member

@josesimoes josesimoes left a comment

Choose a reason for hiding this comment

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

LGTM!

@josesimoes josesimoes merged commit 1628a18 into nanoframework:develop Jun 11, 2021
@josesimoes josesimoes changed the title Fixes to String.Format caught by unit tests and comparing to .Net Core 5 Fixes to String.Format Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants