diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-11-25 21:03:52 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-11-25 21:03:52 -0800 |
commit | b4932228ca6ea59177c20abd13d923b85a45332b (patch) | |
tree | 44b40e8d6a6be806834d6c14c8c78359e866236f /408print-float.mu | |
parent | dbb5df27901068dea242b423d76aa646e15896d0 (diff) | |
download | mu-b4932228ca6ea59177c20abd13d923b85a45332b.tar.gz |
7271
Diffstat (limited to '408print-float.mu')
-rw-r--r-- | 408print-float.mu | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/408print-float.mu b/408print-float.mu index d98880ac..e1c916f6 100644 --- a/408print-float.mu +++ b/408print-float.mu @@ -90,32 +90,31 @@ fn test-print-float-not-a-number { } fn print-float screen: (addr screen), n: float { -$print-float:body: { # - special names var bits/eax: int <- reinterpret n compare bits, 0 { break-if-!= print-string screen, "0" - break $print-float:body + return } compare bits, 0x80000000 { break-if-!= print-string screen, "-0" - break $print-float:body + return } compare bits, 0x7f800000 { break-if-!= print-string screen, "Inf" - break $print-float:body + return } compare bits, 0xff800000 { break-if-!= print-string screen, "-Inf" - break $print-float:body + return } var exponent/ecx: int <- copy bits exponent <- shift-right 0x17 # 23 bits of mantissa @@ -124,7 +123,7 @@ $print-float:body: { { break-if-!= print-string screen, "Nan" - break $print-float:body + return } # - regular numbers var sign/edx: int <- copy bits @@ -160,7 +159,6 @@ $print-float:body: { var exp-magnitude/eax: int <- abs exponent print-int32-hex-bits screen, exp-magnitude, 8 } -} #? fn main -> _/ebx: int { #? run-tests |