Skip to content

Commit

Permalink
poly: fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
PottierLoic committed Jul 15, 2024
1 parent 6e57a00 commit cc2d76c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/poly_operations/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ fn main() {
result_add := poly.add(poly_1, poly_2)
println('Addition result: ${result_add}')

// Substraction
// Subtraction
// Degree is not modified unless highest coefficients cancel each other out
result_sub := poly.substract(poly_1, poly_2)
println('Substraction result: ${result_sub}')
result_sub := poly.subtract(poly_1, poly_2)
println('Subtraction result: ${result_sub}')

// Multiplication
// with given degree n and m for poly_1 and poly_2
Expand Down
2 changes: 1 addition & 1 deletion poly/poly.v
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ pub fn add(a []f64, b []f64) []f64 {
return c
}

pub fn substract(a []f64, b []f64) []f64 {
pub fn subtract(a []f64, b []f64) []f64 {
na := a.len
nb := b.len
nc := int(math.max(na, nb))
Expand Down
4 changes: 2 additions & 2 deletions poly/poly_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ fn test_add() {
assert add(a, b) == [7.0, 22, -7]
}

fn test_substract() {
fn test_subtract() {
a := [6.0, 777, -3]
b := [1.0, -755, -4]
assert substract(a, b) == [5.0, 1532, 1]
assert subtract(a, b) == [5.0, 1532, 1]
}

fn test_multiply() {
Expand Down

0 comments on commit cc2d76c

Please sign in to comment.