Created
April 23, 2019 05:37
-
-
Save rust-play/0897cc40be4f02083e6c97b06ded8870 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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
fn bitcoin_block_reward(height: u64) -> u64 { | |
let coin = 100000000.0; | |
let reward_base = 50.0 * coin; | |
let reward_halving = 210000.0; | |
let result = reward_base / (2.0 as f64).powf((height as f64 / reward_halving).floor()); | |
result.floor() as u64 | |
} | |
fn main() { | |
println!("{}", bitcoin_block_reward(1489218)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment