Pure Programmer
Blue Matrix


Cluster Map

Project: Math Constants

Write a program that prints the values for π, 𝑒 φ (Golden Ratio) and ln 2. Use named constants for all three values.

Output
$ rustc MathConstants.rs error: unknown format trait `f` --> MathConstants.rs:13:35 | 13 | println!("{}", format!("π: {0:.15f}", π)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `f` --> MathConstants.rs:14:35 | 14 | println!("{}", format!("ℯ: {0:.15f}", ℯ)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `f` --> MathConstants.rs:15:35 | 15 | println!("{}", format!("φ: {0:.15f}", φ)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait error: unknown format trait `f` --> MathConstants.rs:16:37 | 16 | println!("{}", format!("ln2: {0:.15f}", ln2)); | ^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait warning: identifier contains uncommon Unicode codepoints --> MathConstants.rs:8:8 | 8 | static ℯ:f64 = 2.718281828459045f64; | ^ | = note: `#[warn(uncommon_codepoints)]` on by default warning: the usage of Script Group `Greek` in this crate consists solely of mixed script confusables --> MathConstants.rs:7:8 | 7 | static π:f64 = 3.141592653589793f64; | ^ | = note: the usage includes 'π' (U+03C0), 'φ' (U+03C6) = note: please recheck to make sure their usages are indeed what you want = note: `#[warn(mixed_script_confusables)]` on by default error: aborting due to 4 previous errors; 2 warnings emitted

Solution