mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:37:35 +00:00
LibWeb: Change calc node representation from float to double
This commit is contained in:
parent
f5da6d61b4
commit
421559d725
22 changed files with 75 additions and 75 deletions
|
@ -25,21 +25,21 @@ public:
|
|||
, m_type(Type::Number)
|
||||
{
|
||||
}
|
||||
Number(Type type, float value)
|
||||
Number(Type type, double value)
|
||||
: m_value(value)
|
||||
, m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
Type type() const { return m_type; }
|
||||
float value() const { return m_value; }
|
||||
double value() const { return m_value; }
|
||||
i64 integer_value() const
|
||||
{
|
||||
// https://www.w3.org/TR/css-values-4/#numeric-types
|
||||
// When a value cannot be explicitly supported due to range/precision limitations, it must be converted
|
||||
// to the closest value supported by the implementation, but how the implementation defines "closest"
|
||||
// is explicitly undefined as well.
|
||||
return llroundf(m_value);
|
||||
return llround(m_value);
|
||||
}
|
||||
bool is_integer() const { return m_type == Type::Integer || m_type == Type::IntegerWithExplicitSign; }
|
||||
bool is_integer_with_explicit_sign() const { return m_type == Type::IntegerWithExplicitSign; }
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
float m_value { 0 };
|
||||
double m_value { 0 };
|
||||
Type m_type;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue