Skip to content

Commit

Permalink
added float32 schubfach algorithm; wip (#18155)
Browse files Browse the repository at this point in the history
* added float32 schubfach algorithm; wip

* fixes #18418
  • Loading branch information
Araq authored Jun 3, 2021
1 parent 06960bb commit daaa409
Show file tree
Hide file tree
Showing 5 changed files with 478 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler/ccgexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2300,7 +2300,11 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
of mInt64ToStr: genDollar(p, e, d, "#nimInt64ToStr($1)")
of mBoolToStr: genDollar(p, e, d, "#nimBoolToStr($1)")
of mCharToStr: genDollar(p, e, d, "#nimCharToStr($1)")
of mFloatToStr: genDollar(p, e, d, "#nimFloatToStr($1)")
of mFloatToStr:
if e[1].typ.skipTypes(abstractInst).kind == tyFloat32:
genDollar(p, e, d, "#nimFloat32ToStr($1)")
else:
genDollar(p, e, d, "#nimFloatToStr($1)")
of mCStrToStr: genDollar(p, e, d, "#cstrToNimstr($1)")
of mStrToStr, mUnown: expr(p, e[1], d)
of mIsolate: genCall(p, e, d)
Expand Down
4 changes: 4 additions & 0 deletions lib/system/dollars.nim
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ proc `$`*(x: float): string {.magic: "FloatToStr", noSideEffect.}
## The stringify operator for a float argument. Returns `x`
## converted to a decimal string.

proc `$`*(x: float32): string {.magic: "FloatToStr", noSideEffect.}
## The stringify operator for a float32 argument. Returns `x`
## converted to a decimal string.

proc `$`*(x: bool): string {.magic: "BoolToStr", noSideEffect.}
## The stringify operator for a boolean argument. Returns `x`
## converted to the string "false" or "true".
Expand Down
Loading

0 comments on commit daaa409

Please sign in to comment.