Browse Source

Added a fix to make sure that javascript division always uses floating point.

tags/2021-05-28
jules 11 years ago
parent
commit
671f5fbbdc
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      modules/juce_core/javascript/juce_Javascript.cpp

+ 1
- 1
modules/juce_core/javascript/juce_Javascript.cpp View File

@@ -544,7 +544,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
{ {
DivideOp (const CodeLocation& l, ExpPtr& a, ExpPtr& b) noexcept : BinaryOperator (l, a, b, TokenTypes::divide) {} DivideOp (const CodeLocation& l, ExpPtr& a, ExpPtr& b) noexcept : BinaryOperator (l, a, b, TokenTypes::divide) {}
var getWithDoubles (double a, double b) const override { return b != 0 ? a / b : std::numeric_limits<double>::infinity(); } var getWithDoubles (double a, double b) const override { return b != 0 ? a / b : std::numeric_limits<double>::infinity(); }
var getWithInts (int64 a, int64 b) const override { return b != 0 ? var (a / b) : var (std::numeric_limits<double>::infinity()); }
var getWithInts (int64 a, int64 b) const override { return b != 0 ? var (a / (double) b) : var (std::numeric_limits<double>::infinity()); }
}; };
struct ModuloOp : public BinaryOperator struct ModuloOp : public BinaryOperator


Loading…
Cancel
Save