{"record":{"id":"1c7b8ac3b77fc03f","repo":"RubyMoney/money","slug":"smallest-denomination-of-this-currency-is-not-defi","errorCode":null,"errorMessage":"Smallest denomination of this currency is not defined","messagePattern":"Smallest denomination of this currency is not defined","errorType":"exception","errorClass":"Money::UndefinedSmallestDenomination","httpStatus":null,"severity":"error","filePath":"lib/money/money.rb","lineNumber":86,"sourceCode":"  # @return [BigDecimal] when infinite_precision is true\n  #\n  # @see infinite_precision\n  def round_to_nearest_cash_value\n    warn \"[DEPRECATION] `round_to_nearest_cash_value` is deprecated - use \" \\\n         \"`to_nearest_cash_value.fractional` instead\"\n\n    to_nearest_cash_value.fractional\n  end\n\n  # Round a given amount of money to the nearest possible money in cash value.\n  # For example, in Swiss franc (CHF), the smallest possible amount of cash\n  # value is CHF 0.05. Therefore, this method rounds CHF 0.07 to CHF 0.05, and\n  # CHF 0.08 to CHF 0.10.\n  #\n  # @return [Money]\n  def to_nearest_cash_value\n    unless currency.smallest_denomination\n      raise UndefinedSmallestDenomination,\n            \"Smallest denomination of this currency is not defined\"\n    end\n\n    fractional = as_d(@fractional)\n    smallest_denomination = as_d(currency.smallest_denomination)\n    rounded_value =\n      (fractional / smallest_denomination)\n      .round(0, self.class.rounding_mode) * smallest_denomination\n\n    dup_with(fractional: return_value(rounded_value))\n  end\n\n  # @!attribute [r] currency\n  #   @return [Currency] The money's currency.\n  # @!attribute [r] bank\n  #   @return [Money::Bank::Base] The +Money::Bank+-based object which currency\n  #     exchanges are performed with.\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/RubyMoney/money/blob/26e2829c34f165847040a5a40d4d2daa5eb72927/lib/money/money.rb#L68-L104","documentation":"Error \"Smallest denomination of this currency is not defined\" thrown in RubyMoney/money.","triggerScenarios":"Thrown at lib/money/money.rb:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26e2829c34f165847040a5a40d4d2daa5eb72927","analyzedAt":"2026-08-23T17:41:07.306Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}