Skip to content

Commit

Permalink
Adding rawrAmountCutoff for Nyano pipe rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
qwahzi authored Nov 6, 2021
1 parent 7485894 commit 1e68651
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/pipes/rai.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class RaiPipe implements PipeTransform {
mrai = 1000000000000000000000000;
krai = 1000000000000000000000;
rai = 1000000000000000000;
rawrAmountCutoff = 1000000000000000000000000;

transform(value: any, args?: any): any {
const opts = args.split(',');
Expand All @@ -19,7 +20,7 @@ export class RaiPipe implements PipeTransform {
default:
case 'xrb': return `${(value / this.mrai).toFixed(6)}${!hideText ? ' NYANO' : ''}`;
case 'nyano':
const hasRawValue = (value / this.rai) % 1;
const hasRawValue = (value / this.rawrAmountCutoff) % 1;
if (hasRawValue) {
// New more precise toFixed function, but bugs on huge raw numbers
const newVal = value / this.mrai < 0.000001 ? 0 : value / this.mrai;
Expand Down

0 comments on commit 1e68651

Please sign in to comment.