title: Modulus Two Float Double Numbers
signature: fun modulusTwoFloatDoubleNumbers(a: Double, b: Double): Double {
source_py: def modulus_two_float_double_numbers(a, b):
      if (a < 0):
          a = (- a)
      if (b < 0):
          b = (- b)
      mod = a
      while (mod >= b):
          mod = (mod - b)
      if (a < 0):
          return (- mod)
      return mod
source_cpp: double modulus_two_float_double_numbers(double a, double b) {
    double mod;
    if ( a < 0 ) mod = - a;
    else mod = a;
    if ( b < 0 ) b = - b;
    while ( mod >= b ) mod = mod - b;
    if ( a < 0 ) return - mod;
    return mod;
  }
question_info.test_list: [{"idx": 0, "outputs": 3243.229719038493, "inputs": {"a": 3243.229719038493, "b": 5659.926861939672}}, {"idx": 1, "outputs": 4362.665881044217, "inputs": {"a": -4362.665881044217, "b": -9196.507113304497}}, {"idx": 2, "outputs": 2008.6661365619666, "inputs": {"a": 7255.066257575837, "b": 2623.200060506935}}, {"idx": 3, "outputs": 911.5074141984414, "inputs": {"a": -6929.554320261099, "b": -3009.0234530313287}}, {"idx": 4, "outputs": 3569.942027998315, "inputs": {"a": 3569.942027998315, "b": 6920.809419868375}}, {"idx": 5, "outputs": 56.49596323882673, "inputs": {"a": -6513.849053096595, "b": -70.95992406437102}}, {"idx": 6, "outputs": 368.98245607783906, "inputs": {"a": 7333.183189243961, "b": 580.3500610971768}}, {"idx": 7, "outputs": 2856.1752826258803, "inputs": {"a": -2856.1752826258803, "b": -9625.97442825802}}, {"idx": 8, "outputs": 108.4901262723597, "inputs": {"a": 9787.228111241662, "b": 2419.6844962423256}}, {"idx": 9, "outputs": 1722.873699288031, "inputs": {"a": -1722.873699288031, "b": -8370.700544254058}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Double, expected:Double):Boolean{
    return abs(actual - expected) < 1e-09
  }
  fun driver(a: Double, b: Double, expected:Double):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(a, b), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(3243.229719038493, 5659.926861939672, 3243.229719038493)
      println("TEST-0...${result}")
      
      result = driver(-4362.665881044217, -9196.507113304497, 4362.665881044217)
      println("TEST-1...${result}")
      
      result = driver(7255.066257575837, 2623.200060506935, 2008.6661365619666)
      println("TEST-2...${result}")
      
      result = driver(-6929.554320261099, -3009.0234530313287, 911.5074141984414)
      println("TEST-3...${result}")
      
      result = driver(3569.942027998315, 6920.809419868375, 3569.942027998315)
      println("TEST-4...${result}")
      
      result = driver(-6513.849053096595, -70.95992406437102, 56.49596323882673)
      println("TEST-5...${result}")
      
      result = driver(7333.183189243961, 580.3500610971768, 368.98245607783906)
      println("TEST-6...${result}")
      
      result = driver(-2856.1752826258803, -9625.97442825802, 2856.1752826258803)
      println("TEST-7...${result}")
      
      result = driver(9787.228111241662, 2419.6844962423256, 108.4901262723597)
      println("TEST-8...${result}")
      
      result = driver(-1722.873699288031, -8370.700544254058, 1722.873699288031)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: modulusTwoFloatDoubleNumbers
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn