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

Define three procedures for format ~F #3

Merged
merged 1 commit into from
Oct 29, 2017
Merged

Define three procedures for format ~F #3

merged 1 commit into from
Oct 29, 2017

Conversation

Hamayama
Copy link
Contributor

I found that the behavior of format ~F is determined by the implementation
of 'number->string'.

If (number->string (exact->inexact 0.0003)) returns "0.0003",
(format "~1,2F" 0.0003) returns "0.00".

If (number->string (exact->inexact 0.0003)) returns "3.0e-4",
(format "~1,2F" 0.0003) returns "3.00e-4".

I think this behavior should be customizable but it seems difficult.

So, I defined three procedures near the top of code and added a comment
that explains them.

If system provides a kind of 'number->string' that can select whether
output is fixed-point notation or exponential notation, user can use it
by overwriting these procedures.

Also, I refactored some code and confirmed all tests are passed in the
following environment.

OS: Windows 8.1 (64bit)
DevTool: MSYS2/MinGW-w64 (64bit) (gcc version 7.1.0 (Rev2, Built by MSYS2 project))
Scheme: Gauche v0.9.6_pre4, Sagittarius v0.8.4, Racket v6.7

@arthurgleckler arthurgleckler merged commit be16e72 into scheme-requests-for-implementation:master Oct 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants