Rs
Module 5HashMap & BTreeMapLesson 6 of 818 min

std Math & Formatting

f64 methods and format! for reports and d1.

f64 toolbox

abs, sqrt, ln, exp, max, min, powi, powf

consts

rust
use std::f64::consts::PI;

d1 building block for Black-Scholes

Challenge

Implement d2 = d1 - sigma*sqrt(t).

Tips
  • std math powers many kernels
  • Guard t>0 sigma>0 in prod
  • format! allocates String

Try it live

std Math & FormattingRust 2021
Loading editor…
Output
Press Run to compile and execute.