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

Request to Support Decoding Double Type in float32 Method #353

Open
funplusxxx opened this issue Sep 22, 2023 · 0 comments
Open

Request to Support Decoding Double Type in float32 Method #353

funplusxxx opened this issue Sep 22, 2023 · 0 comments

Comments

@funplusxxx
Copy link

I was examining the source code of msgpack and noticed that the float32 method in the decode_number.go file does not support decoding of double type values.

Here is the code snippet:

func (d *Decoder) float32(c codes.Code) (float32, error) {
	if c == codes.Float {
		n, err := d.uint32()
		if err != nil {
			return 0, err
		}
		return math.Float32frombits(n), nil
	}

	n, err := d.int(c)
	if err != nil {
		return 0, fmt.Errorf("msgpack: invalid code=%x decoding float32", c)
	}
	return float32(n), nil
}

As you can see, the method currently only supports decoding of float and integer types. I was wondering if there are any plans to extend this functionality to include support for decoding double type values as well. This could be beneficial for users who need to decode double type values into float32.

Thank you for your attention to this matter.

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

1 participant