Created
January 28, 2014 02:04
-
-
Save boredzo/8661176 to your computer and use it in GitHub Desktop.
The difference between fmod and remainder
This file contains hidden or 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
NSTimeInterval days = 0.0; | |
NSTimeInterval hours = 1.0; | |
NSTimeInterval minutes = 49.0; | |
NSTimeInterval seconds = 6.215; | |
NSTimeInterval interval = | |
days * 3600.0 * 24.0 | |
+ hours * 3600.0 | |
+ minutes * 60.0 | |
+ seconds * 1.0; | |
NSLog(@"%f", fmod(interval / 60.0, 60.0)); // 49.103583 | |
NSLog(@"%f", remainder(interval / 60.0, 60.0)); // -10.896417 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment