mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
math: digits panic for invalid base
This commit is contained in:
parent
887c94d9ba
commit
91896af877
@ -99,6 +99,9 @@ pub fn exp(a f64) f64 {
|
||||
|
||||
// digits returns an array of the digits of n in the given base.
|
||||
pub fn digits(_n, base int) []int {
|
||||
if base < 2 {
|
||||
panic('digits: Cannot find digits of n with base $base')
|
||||
}
|
||||
mut n := _n
|
||||
mut sign := 1
|
||||
if n < 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user