title: Modulus Two Float Double Numbers
signature: double modulusTwoFloatDoubleNumbers(double a, double b) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(double actual, double expected){
      return abs(actual - expected) < 1e-09;
  }
  
  string driver(double a, double b, double expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(a, b), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver(3243.229719038493, 5659.926861939672, 3243.229719038493); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(-4362.665881044217, -9196.507113304497, 4362.665881044217); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(7255.066257575837, 2623.200060506935, 2008.6661365619666); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(-6929.554320261099, -3009.0234530313287, 911.5074141984414); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(3569.942027998315, 6920.809419868375, 3569.942027998315); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(-6513.849053096595, -70.95992406437102, 56.49596323882673); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(7333.183189243961, 580.3500610971768, 368.98245607783906); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver(-2856.1752826258803, -9625.97442825802, 2856.1752826258803); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver(9787.228111241662, 2419.6844962423256, 108.4901262723597); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver(-1722.873699288031, -8370.700544254058, 1722.873699288031); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
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;
  }