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

BatPrintf does not support %h conversion #961

Open
rixed opened this issue May 20, 2020 · 4 comments
Open

BatPrintf does not support %h conversion #961

rixed opened this issue May 20, 2020 · 4 comments

Comments

@rixed
Copy link
Contributor

rixed commented May 20, 2020

One has to resort to Legacy.Printf.sprintf for that, which is not convenient.
Also, this crash at runtime!

@UnixJunkie
Copy link
Member

If this is supported by the stdlib, how can batteries not support it?
I have never since this specifier though.

@UnixJunkie
Copy link
Member

h or H: convert a floating-point argument to hexadecimal notation, in the style 0xh.hhhh p+-dd (hexadecimal mantissa, exponent in decimal and denotes a power of 2).

@UnixJunkie
Copy link
Member

utop # Printf.printf "%h\n" 1.0;;
0x1p+0
utop # #require "batteries";;
utop # BatPrintf.printf "%h\n" 1.0;;
Exception:
Invalid_argument
 "printf: bad conversion %h, at char number 1 in format string ``%h\n''".

@UnixJunkie UnixJunkie added the bug label May 20, 2020
@UnixJunkie
Copy link
Member

I discover that batteries has a reimplementation of the Printf module.
Since it uses BatInnerIO, I suspect it is slower than Stdlib.Printf.
And I suspect that's why I never used this batteries module...

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

No branches or pull requests

2 participants