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

Add ability to specify infinity and NaN strings #137

Open
planet36 opened this issue Dec 4, 2019 · 2 comments
Open

Add ability to specify infinity and NaN strings #137

planet36 opened this issue Dec 4, 2019 · 2 comments

Comments

@planet36
Copy link

planet36 commented Dec 4, 2019

It would be nice if a user could specify the string representation of infinity and NaN values.

For example:

  • "nan" instead of "NaN"
  • "inf" instead of "Infinity"
@ulfjack
Copy link
Owner

ulfjack commented Dec 4, 2019

I generally agree, but I haven't found a nice way to do that.

@Snuggan
Copy link

Snuggan commented Aug 18, 2020

Would something like this work?
#if !defined(RYU_MEMCOPY_NAN)
#define RYU_MEMCOPY_NAN int memcpy_nan( char * dest_) { memcpy( dest_, "nan", 3 ); return 3; }
#endif
RYU_MEMCOPY_NAN

#if !defined(RYU_MEMCOPY_INF)
#define RYU_MEMCOPY_INF int memcpy_infinity( char * dest_) { memcpy( dest_, "Infinity", 8 ); return 8; }
#endif
RYU_MEMCOPY_INF

#if !defined(RYU_EXPONENT)
#define RYU_EXPONENT 'e'
#endif

...and use memcpy_nan/memcpy_infinity/RYU_EXPONENT where appropriate?

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

No branches or pull requests

3 participants