Created
July 1, 2020 09:53
-
-
Save oshibka404/7bf7aa276288a84c2685fc393524e613 to your computer and use it in GitHub Desktop.
Fractional part
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math' show pow; | |
void main() { | |
var number = 4734.602654867; | |
var digits = 4; | |
print(getFraction(number, digits)); | |
} | |
int getFraction(double number, int digits) => (number % 1 * pow(10, digits)).floor(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment