diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index bc53c7126..36b07f0a5 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1113,6 +1113,14 @@ void SMTEncoder::visitTypeConversion(FunctionCall const& _funCall) { solAssert(smt::isNumber(*funCallType), ""); + RationalNumberType const* rationalType = isConstant(*argument); + if (rationalType) + { + // The TypeChecker guarantees that a constant fits in the cast size. + defineExpr(_funCall, symbArg); + return; + } + auto const* fixedCast = dynamic_cast(funCallType); auto const* fixedArg = dynamic_cast(argType); if (fixedCast && fixedArg)