bsl_variable *stdlib_divide_float(bsl_context **context, bsl_symbol *symbol, bsl_func_rtype rtype, bsl_func_arg *args, uint32_t arg_count)
{
	__attribute__((unused)) bsl_symbol *local_symbol = symbol;

	bsl_variable_type var_type = bsl_variable_type_from_func_rtype(rtype);

	bsl_variable *variable = bsl_variable_create_type(var_type);

	float a = 0;
	float b = 0;

	if (arg_count == 2) {
		a = args[0].args[0].u.f;
		b = args[1].args[0].u.f;
	}

	if (FloatEquals(b, 0)) {
		variable->u.f = a / b;
	}
	else {
		bsl_context_assign_error((*context), bsl_error_unsafe_evaluation);
	}

	return variable;
}
Exemple #2
0
bool Angle::operator==(const Angle& rhs) const
{
	return FloatEquals(this->asRadians(), rhs.asRadians());
}