Fixed test
This commit is contained in:
@@ -65,7 +65,7 @@ public extension Array {
|
||||
/// - step: The step the function will use to generate the array
|
||||
/// - offset: The offset you want to use to generate your array
|
||||
static func arange(start: Double, end: Double, step: Double = 1, offset: Double = 0) -> [Double] {
|
||||
let len = (abs(end - start) + (offset * 2)) / step + 1
|
||||
let len = (abs(end - start) + (offset * 2)) / step + Double(1)
|
||||
let direction: Double = start < end ? 1 : -1
|
||||
let startingPoint = start - (direction * offset)
|
||||
let stepSize = direction * step
|
||||
|
||||
@@ -24,7 +24,8 @@ class AlgebraTests: XCTestCase {
|
||||
|
||||
// Roots
|
||||
let golden = try! Polynomial(1, -1, -1)
|
||||
XCTAssertEqual(golden.roots.last, 102334155/63245986) // Golden Ratio, simplified
|
||||
|
||||
XCTAssertEqual(golden.roots.last, BN(102334155, over: 63245986)) // Golden Ratio, simplified
|
||||
|
||||
let higher = try! Polynomial(1, 2, -25, -26, 120)
|
||||
let roots = higher.roots
|
||||
|
||||
@@ -141,7 +141,7 @@ class BigIntTests: XCTestCase {
|
||||
// MARK: Gamma
|
||||
XCTAssertEqual(try? factorial(3), 6)
|
||||
XCTAssertEqual(try? factorial(11), 39916800)
|
||||
XCTAssertEqual(try? gamma(3 / 2).nearlyEquals(0.8862269254527576), true)
|
||||
XCTAssertEqual(try? gamma(BN(3, over: 2)).nearlyEquals(0.8862269254527576), true)
|
||||
// MARK: Logarithms
|
||||
XCTAssert(ln(15).nearlyEquals(2.708050201102210))
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class TablesTests: XCTestCase {
|
||||
|
||||
func testEngineering() {
|
||||
let t = Tables()
|
||||
XCTAssertEqual(try t.CONVERT(28, from_unit: "km/h", to_unit: "m/s"), 70/9)
|
||||
XCTAssertEqual(try t.CONVERT(28, from_unit: "km/h", to_unit: "m/s"), BigDouble(70, over: 9))
|
||||
}
|
||||
|
||||
static var allTests = [
|
||||
|
||||
Reference in New Issue
Block a user