<commit_before>//
//  Numeric.swift
//  AudioKit
//
//  Created by <NAME>, revision history on Github.
//  Copyright © 2016 AudioKit. All rights reserved.
//

import Foundation

// MARK: Numeric Protocol

/// Very simple protoocol for anything with an instrinsic floating point value.
/// Allows constants to be passed into an AudioKit operation as well as other operations.
public protocol Numeric: AKParameter {
    /// Raw value of the numeric parameter
    func value() -> Double
}

/// Numeric extension for integers
extension Int: Numeric {
    /// Get basic value as a double
    public func value() -> Double {
        return Double(self)
    }
}

/// Numeric extension for floats
extension Float: Numeric {
    /// Get basic value as a double
    public func value() -> Double {
        return Double(self)
    }
}

/// Numeric extension for doubles
extension Double: Numeric {
    /// Get basic value as a double
    public func value() -> Double {
        return Double(self)
    }
}

/// Equality
public func ==(lhs: Numeric, rhs: Numeric) -> Bool {
    return lhs.value() == rhs.value()
}

/// Addition
public func +(lhs: Numeric, rhs: Numeric) -> Double {
    return lhs.value() + rhs.value()
}

/// Subtraction<commit_msg>Preventing recursion<commit_after>//
//  Numeric.swift
//  AudioKit
//
//  Created by <NAME>, revision history on Github.
//  Copyright © 2016 AudioKit. All rights reserved.
//

import Foundation

// MARK: Numeric Protocol

/// Very simple protoocol for anything with an instrinsic floating point value.
/// Allows constants to be passed into an AudioKit operation as well as other operations.
public protocol Numeric: AKParameter {
    /// Raw value of the numeric parameter
    func value() -> Double
}

/// Numeric extension for integers
extension Int: Numeric {
    /// Get basic value as a double
    public func value() -> Double {
        return Double(self)
    }
}

/// Numeric extension for floats
extension Float: Numeric {
    /// Get basic value as a double
    public func value() -> Double {
        return Double(self)
    }
}

/// Numeric extension for doubles
extension Double: Numeric {
    /// Get basic value as a double
    public func value() -> Double {
        return Double(self)
    }
}

/// Equality
//public func ==(lhs: Numeric, rhs: Numeric) -> Bool {
//    return lhs.value() == rhs.value()
//}

/// Addition
public func +(lhs: Numeric, rhs: Numeric) -> Double {
    return lhs.value() + rhs.value()
}

/// Subtraction
{'fraction_non_alphanumeric': 0.11660635303578609, 'fraction_numerical': 0.003216726980297547, 'mean_word_length': 2.6057971014492756, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4028325', 'n_tokens_mistral': 724, 'n_tokens_neox': 696, 'n_words': 280}