NEWONE1 / invokeai /frontend /web /src /common /util /roundDownToMultiple.ts
roshikhan301's picture
Upload 2113 files
8a37e0a verified
export const roundDownToMultiple = (num: number, multiple: number): number => {
return Math.floor(num / multiple) * multiple;
};
export const roundUpToMultiple = (num: number, multiple: number): number => {
return Math.ceil(num / multiple) * multiple;
};
export const roundToMultiple = (num: number, multiple: number): number => {
return Math.round(num / multiple) * multiple;
};
export const roundToMultipleMin = (num: number, multiple: number): number => {
return Math.max(Math.round(num / multiple) * multiple, multiple);
};