Pure Programmer
Blue Matrix


Cluster Map

Project: Renard Numbers with Rounding Function

Modify the program that computes Renard numbers. Modify it so that the values stored in the array of Renard numbers are rounded instead of using formetted output to round the output used in the original solution.

The roundSigDig() function should take the floating point value to round and the number of significant digits to keep (precision). It should return a new floating point value rounded to the number of significant digits. For example 1234 rounded to two significant digits is 1200 This rounding can be accomplished by multiplying the value (n) by 10int(precision-log10(n)-1), adding 0.5, computing the integer floor, then dividing by 10int(precision-log10(n)-1) again.

See project RenardNumbers1 and [[Significant Figures]]

Output
$ rustc RenardNumbers2.rs error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:15:5 | 15 | if args.len() != 3 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> RenardNumbers2.rs:17:3 | 17 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:19:25 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:19:47 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:20:28 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:20:50 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | warning: unnecessary parentheses around `if` condition --> RenardNumbers2.rs:56:9 | 56 | if (!first) { | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 56 - if (!first) { 56 + if !first { | error[E0425]: cannot find function `log10` in this scope --> RenardNumbers2.rs:10:35 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `log10` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (floor(value.log10())) as isize - 1; | error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:10:29 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (log10(value).floor() as isize - 1; | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:30 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.0f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:23 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:11:9 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 11 | return (value * pow(10.f64,(p) as f64) + 0.5f64).floor() / pow(10.f64,(p) as f64); | ~ ~~~~~~~~~ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:65 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.0f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:58 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:36:23 | 36 | let mut factor:f64 = pow(10.0f64,1.0f64 / f64::from(series)); | ^^^ not found in this scope error[E0277]: the type `[f64]` cannot be indexed by `isize` --> RenardNumbers2.rs:59:46 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[f64]>` is not implemented for `isize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` = note: required for `Vec<f64>` to implement `Index<isize>` error[E0425]: cannot find function `sprintf` in this scope --> RenardNumbers2.rs:59:19 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^^^^^^^ not found in this scope error: aborting due to 16 previous errors; 1 warning emitted Some errors have detailed explanations: E0277, E0425, E0610. For more information about an error, try `rustc --explain E0277`. $ rustc RenardNumbers2.rs error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:15:5 | 15 | if args.len() != 3 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> RenardNumbers2.rs:17:3 | 17 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:19:25 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:19:47 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:20:28 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:20:50 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | warning: unnecessary parentheses around `if` condition --> RenardNumbers2.rs:56:9 | 56 | if (!first) { | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 56 - if (!first) { 56 + if !first { | error[E0425]: cannot find function `log10` in this scope --> RenardNumbers2.rs:10:35 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `log10` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (floor(value.log10())) as isize - 1; | error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:10:29 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (log10(value).floor() as isize - 1; | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:30 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.0f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:23 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:11:9 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 11 | return (value * pow(10.f64,(p) as f64) + 0.5f64).floor() / pow(10.f64,(p) as f64); | ~ ~~~~~~~~~ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:65 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.0f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:58 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:36:23 | 36 | let mut factor:f64 = pow(10.0f64,1.0f64 / f64::from(series)); | ^^^ not found in this scope error[E0277]: the type `[f64]` cannot be indexed by `isize` --> RenardNumbers2.rs:59:46 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[f64]>` is not implemented for `isize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` = note: required for `Vec<f64>` to implement `Index<isize>` error[E0425]: cannot find function `sprintf` in this scope --> RenardNumbers2.rs:59:19 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^^^^^^^ not found in this scope error: aborting due to 16 previous errors; 1 warning emitted Some errors have detailed explanations: E0277, E0425, E0610. For more information about an error, try `rustc --explain E0277`. $ rustc RenardNumbers2.rs error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:15:5 | 15 | if args.len() != 3 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> RenardNumbers2.rs:17:3 | 17 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:19:25 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:19:47 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:20:28 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:20:50 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | warning: unnecessary parentheses around `if` condition --> RenardNumbers2.rs:56:9 | 56 | if (!first) { | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 56 - if (!first) { 56 + if !first { | error[E0425]: cannot find function `log10` in this scope --> RenardNumbers2.rs:10:35 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `log10` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (floor(value.log10())) as isize - 1; | error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:10:29 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (log10(value).floor() as isize - 1; | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:30 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.0f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:23 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:11:9 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 11 | return (value * pow(10.f64,(p) as f64) + 0.5f64).floor() / pow(10.f64,(p) as f64); | ~ ~~~~~~~~~ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:65 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.0f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:58 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:36:23 | 36 | let mut factor:f64 = pow(10.0f64,1.0f64 / f64::from(series)); | ^^^ not found in this scope error[E0277]: the type `[f64]` cannot be indexed by `isize` --> RenardNumbers2.rs:59:46 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[f64]>` is not implemented for `isize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` = note: required for `Vec<f64>` to implement `Index<isize>` error[E0425]: cannot find function `sprintf` in this scope --> RenardNumbers2.rs:59:19 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^^^^^^^ not found in this scope error: aborting due to 16 previous errors; 1 warning emitted Some errors have detailed explanations: E0277, E0425, E0610. For more information about an error, try `rustc --explain E0277`. $ rustc RenardNumbers2.rs error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:15:5 | 15 | if args.len() != 3 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> RenardNumbers2.rs:17:3 | 17 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:19:25 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:19:47 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:20:28 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:20:50 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | warning: unnecessary parentheses around `if` condition --> RenardNumbers2.rs:56:9 | 56 | if (!first) { | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 56 - if (!first) { 56 + if !first { | error[E0425]: cannot find function `log10` in this scope --> RenardNumbers2.rs:10:35 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `log10` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (floor(value.log10())) as isize - 1; | error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:10:29 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (log10(value).floor() as isize - 1; | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:30 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.0f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:23 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:11:9 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 11 | return (value * pow(10.f64,(p) as f64) + 0.5f64).floor() / pow(10.f64,(p) as f64); | ~ ~~~~~~~~~ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:65 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.0f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:58 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:36:23 | 36 | let mut factor:f64 = pow(10.0f64,1.0f64 / f64::from(series)); | ^^^ not found in this scope error[E0277]: the type `[f64]` cannot be indexed by `isize` --> RenardNumbers2.rs:59:46 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[f64]>` is not implemented for `isize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` = note: required for `Vec<f64>` to implement `Index<isize>` error[E0425]: cannot find function `sprintf` in this scope --> RenardNumbers2.rs:59:19 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^^^^^^^ not found in this scope error: aborting due to 16 previous errors; 1 warning emitted Some errors have detailed explanations: E0277, E0425, E0610. For more information about an error, try `rustc --explain E0277`. $ rustc RenardNumbers2.rs error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:15:5 | 15 | if args.len() != 3 { | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find function `exit` in this scope --> RenardNumbers2.rs:17:3 | 17 | exit(1); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::process::exit; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:19:25 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:19:47 | 19 | let mut series:isize = Utils.stoiWithDefault(args[1], 5); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | error[E0425]: cannot find value `Utils` in this scope --> RenardNumbers2.rs:20:28 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^^ not found in this scope error[E0425]: cannot find value `args` in this scope --> RenardNumbers2.rs:20:50 | 20 | let mut precision:isize = Utils.stoiWithDefault(args[2], 2); | ^^^^ not found in this scope | help: consider importing this function | 7 + use std::env::args; | warning: unnecessary parentheses around `if` condition --> RenardNumbers2.rs:56:9 | 56 | if (!first) { | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 56 - if (!first) { 56 + if !first { | error[E0425]: cannot find function `log10` in this scope --> RenardNumbers2.rs:10:35 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `log10` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (floor(value.log10())) as isize - 1; | error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:10:29 | 10 | let p:isize = sigdigits - (floor(log10(value))) as isize - 1; | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 10 - let p:isize = sigdigits - (floor(log10(value))) as isize - 1; 10 + let p:isize = sigdigits - (log10(value).floor() as isize - 1; | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:30 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.0f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:23 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `floor` in this scope --> RenardNumbers2.rs:11:9 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^^^ not found in this scope | help: use the `.` operator to call the method `floor` on `f64` | 11 | return (value * pow(10.f64,(p) as f64) + 0.5f64).floor() / pow(10.f64,(p) as f64); | ~ ~~~~~~~~~ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> RenardNumbers2.rs:11:65 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ | help: if intended to be a floating point literal, consider adding a `0` after the period | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.0f64,(p) as f64); | + error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:11:58 | 11 | return floor(value * pow(10.f64,(p) as f64) + 0.5f64) / pow(10.f64,(p) as f64); | ^^^ not found in this scope error[E0425]: cannot find function `pow` in this scope --> RenardNumbers2.rs:36:23 | 36 | let mut factor:f64 = pow(10.0f64,1.0f64 / f64::from(series)); | ^^^ not found in this scope error[E0277]: the type `[f64]` cannot be indexed by `isize` --> RenardNumbers2.rs:59:46 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[f64]>` is not implemented for `isize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` = note: required for `Vec<f64>` to implement `Index<isize>` error[E0425]: cannot find function `sprintf` in this scope --> RenardNumbers2.rs:59:19 | 59 | print!("{}", sprintf("%g",renardNumbers[i] * (rangeStart) as f64)); | ^^^^^^^ not found in this scope error: aborting due to 16 previous errors; 1 warning emitted Some errors have detailed explanations: E0277, E0425, E0610. For more information about an error, try `rustc --explain E0277`.

Solution