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

get_float function is buggy #13

Open
xjjo opened this issue Aug 19, 2022 · 1 comment
Open

get_float function is buggy #13

xjjo opened this issue Aug 19, 2022 · 1 comment

Comments

@xjjo
Copy link

xjjo commented Aug 19, 2022

function get_float(in_precision int, in_scale int) do not work properly when precision is 1 and scale is 0
i.e
table data type decimal(1,0)

@kedarvj
Copy link
Owner

kedarvj commented Oct 6, 2022

That's right, it occasionally go out of range. It works when the random number is within range though... not efficient but works! Will try working on the function.

mysql> select @x:=rand(), @x, @x*pow(10,1), round(@x*pow(10,1),0); +--------------------+--------------------+-------------------+-----------------------+ | @x:=rand() | @x | @x*pow(10,1) | round(@x*pow(10,1),0) | +--------------------+--------------------+-------------------+-----------------------+ | 0.9737842026853787 | 0.9737842026853787 | 9.737842026853787 | 10 | +--------------------+--------------------+-------------------+-----------------------+ 1 row in set, 1 warning (0.00 sec)

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

2 participants