mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 03:42:17 +00:00
Add Num.withDecimalPoint
This commit is contained in:
parent
9c664172dd
commit
64e9899cad
12 changed files with 34 additions and 13 deletions
|
@ -226,6 +226,10 @@ pub const RocDec = extern struct {
|
|||
return self.num;
|
||||
}
|
||||
|
||||
pub fn fromI128(num: i128) RocDec {
|
||||
return .{ .num = num };
|
||||
}
|
||||
|
||||
pub fn eq(self: RocDec, other: RocDec) bool {
|
||||
return self.num == other.num;
|
||||
}
|
||||
|
@ -1475,6 +1479,10 @@ pub fn toI128(arg: RocDec) callconv(.C) i128 {
|
|||
return @call(.always_inline, RocDec.toI128, .{arg});
|
||||
}
|
||||
|
||||
pub fn fromI128(arg: i128) callconv(.C) RocDec {
|
||||
return @call(.always_inline, RocDec.fromI128, .{arg});
|
||||
}
|
||||
|
||||
pub fn eqC(arg1: RocDec, arg2: RocDec) callconv(.C) bool {
|
||||
return @call(.always_inline, RocDec.eq, .{ arg1, arg2 });
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ comptime {
|
|||
exportDecFn(dec.tanC, "tan");
|
||||
exportDecFn(dec.toF64, "to_f64");
|
||||
exportDecFn(dec.toI128, "to_i128");
|
||||
exportDecFn(dec.fromI128, "from_i128");
|
||||
exportDecFn(dec.toStr, "to_str");
|
||||
|
||||
inline for (INTEGERS) |T| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue