mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-30 23:23:07 +00:00 
			
		
		
		
	Add some more test cases for hex floats.
This commit is contained in:
		| @@ -298,11 +298,10 @@ int janet_scan_number_base( | ||||
|     } | ||||
|  | ||||
|     /* If still base is 0, set to default (10) */ | ||||
|     int exp_base = base; | ||||
|     if (base == 0) { | ||||
|         base = 10; | ||||
|         exp_base = 10; | ||||
|     } | ||||
|     int exp_base = base; | ||||
|  | ||||
|     /* Skip leading zeros */ | ||||
|     while (str < end && (*str == '0' || *str == '.')) { | ||||
|   | ||||
| @@ -39,7 +39,7 @@ | ||||
| (defmacro assert | ||||
|   [x &opt e] | ||||
|   (def xx (gensym)) | ||||
|   (default e ~',x) | ||||
|   (default e (string/format "%j" x)) | ||||
|   ~(do | ||||
|      (def ,xx ,x) | ||||
|      (,assert-no-tail ,xx ,e) | ||||
|   | ||||
| @@ -210,6 +210,12 @@ | ||||
|  | ||||
| # Hex floats | ||||
| (assert (= math/pi +0x1.921fb54442d18p+0001)) | ||||
| (assert (= math/int-max +0x1.ffff_ffff_ffff_ffp+0052)) | ||||
| (assert (= math/int-min -0x1.ffff_ffff_ffff_ffp+0052)) | ||||
| (assert (= 1 0x1P0)) | ||||
| (assert (= 2 0x1P1)) | ||||
| (assert (= -2 -0x1p1)) | ||||
| (assert (= -0.5 -0x1p-1)) | ||||
|  | ||||
| (end-suite) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose