Skip to content

Math.min NOT work with 123021 numbers #36958

@ihgazni2

Description

@ihgazni2
  • Version: v16.0.0-pre,v12.18.2
  • Platform: linux
  • Subsystem: ubuntu

What steps will reproduce the bug?

>

function creat_arr(lngth2,lngth3){
    let arr_two = Array.from({length:lngth2}).map(r=>2)
    let arr_three = Array.from({length:lngth3}).map(r=>3)
    let arr = Array.prototype.concat(arr_two,arr_three)
    return(arr)
}

var arr = creat_arr(63124,60166)
Math.min(...arr)


Uncaught RangeError: Maximum call stack size exceeded

/*
> arr[63123]
2
> arr[63124]
3
>

> arr.filter(r=>r===2).length
63124
> arr.filter(r=>r===3).length
60166
>


[
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2,
  ... 123190 more items
]

*/


>
> var arr = creat_arr(6312,6016)
undefined
> Math.min(...arr)
2
>
> var arr = creat_arr(63124,59896)
undefined
> Math.min(...arr)
2
> var arr = creat_arr(63124,59897)
undefined
> Math.min(...arr)
Uncaught RangeError: Maximum call stack size exceeded
    at Math.min (<anonymous>)
>

How often does it reproduce? Is there a required condition?

always, if with too many params

What is the expected behavior?

Math.min(...arr)
2

What do you see instead?

Uncaught RangeError: Maximum call stack size exceeded
at Math.min ()

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    known limitationIssues that are identified as known limitations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions