Created
January 26, 2018 20:55
-
-
Save 1st1/1187fc58dfdef86e3cad8874e0894938 to your computer and use it in GitHub Desktop.
decimal bench
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
# ====================================================================== | |
# Calculating pi, 10000 iterations | |
# ====================================================================== | |
Precision: 9 decimal digits | |
float: | |
result: 3.1415926535897927 | |
time: 0.056572s | |
cdecimal: | |
result: 3.14159265 | |
time: 0.118656s | |
decimal: | |
result: 3.14159265 | |
time: 8.936352s | |
Precision: 19 decimal digits | |
float: | |
result: 3.1415926535897927 | |
time: 0.056380s | |
cdecimal: | |
result: 3.141592653589793236 | |
time: 0.247180s | |
decimal: | |
result: 3.141592653589793236 | |
time: 20.603687s | |
# ====================================================================== | |
# Factorial | |
# ====================================================================== | |
n = 1000 | |
cdecimal: | |
calculation time: 0.001376s | |
conversion time: 0.000020s | |
int: | |
calculation time: 0.000581s | |
conversion time: 0.000089s | |
n = 100000 | |
cdecimal: | |
calculation time: 0.237584s | |
conversion time: 0.002815s | |
int: | |
calculation time: 0.249919s | |
conversion time: 2.614302s |
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
# ====================================================================== | |
# Calculating pi, 10000 iterations | |
# ====================================================================== | |
Precision: 9 decimal digits | |
float: | |
result: 3.1415926535897927 | |
time: 0.060443s | |
cdecimal: | |
result: 3.14159265 | |
time: 0.115771s | |
decimal: | |
result: 3.14159265 | |
time: 9.005547s | |
Precision: 19 decimal digits | |
float: | |
result: 3.1415926535897927 | |
time: 0.056453s | |
cdecimal: | |
result: 3.141592653589793236 | |
time: 0.238429s | |
decimal: | |
result: 3.141592653589793236 | |
time: 21.062674s | |
# ====================================================================== | |
# Factorial | |
# ====================================================================== | |
n = 1000 | |
cdecimal: | |
calculation time: 0.001140s | |
conversion time: 0.000016s | |
int: | |
calculation time: 0.000590s | |
conversion time: 0.000084s | |
n = 100000 | |
cdecimal: | |
calculation time: 0.239586s | |
conversion time: 0.002923s | |
int: | |
calculation time: 0.257821s | |
conversion time: 2.664320s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment