Skip to content

Commit d105b9b

Browse files
documentation: exact_math/scientific_mode.rs
1 parent d08e860 commit d105b9b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/exact_math/scientific_mode.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ use std::{f64, fmt::Display};
22

33
use crate::parsing::ast::int_to_superscript_string;
44

5+
/// # Science Float
6+
/// A float in scientific notation is a floating point value and an integer exponent.
57
pub struct ScienceFloat {
68
exponent: i32,
79
value: f64, //value * 10^exponent
810
}
911

12+
/// Implementation of the Display trait for the ScienceFloat struct.
1013
impl Display for ScienceFloat {
1114
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1215
match self.exponent {
@@ -21,6 +24,9 @@ impl Display for ScienceFloat {
2124
}
2225
}
2326

27+
/// # FromFloat
28+
/// Takes a floating point number
29+
/// Returns the scientific representation of that float.
2430
pub fn from_float(f: f64) -> ScienceFloat {
2531
let multiple;
2632
let working_value;

0 commit comments

Comments
 (0)