about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--408print-float.mu18
1 files changed, 11 insertions, 7 deletions
diff --git a/408print-float.mu b/408print-float.mu
index ced7aeea..3dca50ec 100644
--- a/408print-float.mu
+++ b/408print-float.mu
@@ -367,7 +367,7 @@ fn test-print-float-decimal-approximate-integer-5 {
   var hundred-thousand-f/xmm0: float <- convert hundred-thousand
   print-float-decimal-approximate screen, hundred-thousand-f
   #
-  check-screen-row screen, 1, "1e5 ", "F - test-print-float-decimal-approximate-integer-5"
+  check-screen-row screen, 1, "100000 ", "F - test-print-float-decimal-approximate-integer-5"
 }
 
 fn test-print-float-decimal-approximate-zero {
@@ -505,8 +505,12 @@ fn print-float-decimal-approximate screen: (addr screen), n: float {
     break-if-!=
     var result/eax: int <- copy mantissa
     result <- or 0x00800000  # insert implicit 1
-    result <- repeated-shift-left result, exponent
-    result <- shift-right 0x17  # 24 bits
+#?     print-string 0, "mantissa2: "
+#?     print-int32-hex 0, result
+#?     print-string 0, "\n"
+    var all-but-exponent/edx: int <- copy 0x17  # 23 bits for mantissa treated as a whole number
+    all-but-exponent <- subtract exponent
+    result <- repeated-shift-right result, all-but-exponent
 #?     print-string 0, "result: "
 #?     print-int32-hex 0, result
 #?     print-string 0, "\n"
@@ -525,8 +529,8 @@ fn print-float-decimal-approximate screen: (addr screen), n: float {
     # normal numbers
     print-string screen, "1"
   }
-#?   var mantissa/ebx: int <- copy bits
-#?   mantissa <- and 0x7fffff
+  var mantissa/ebx: int <- copy bits
+  mantissa <- and 0x7fffff
   compare mantissa, 0
   {
     break-if-=
@@ -543,7 +547,7 @@ fn print-float-decimal-approximate screen: (addr screen), n: float {
 }
 
 #? fn main -> _/ebx: int {
-#?   run-tests
-#? #?   test-print-float-decimal-approximate-integer
+#? #?   run-tests
+#?   test-print-float-decimal-approximate-integer-5
 #?   return 0
 #? }
href='#n129'>129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321