mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:42:43 +00:00 
			
		
		
		
	LibJS: Generalize Intl.NumberFormat to operate on Value types
Intl.NumberFormat is meant to format both Number and BigInt types. To prepare for formatting BigInt types, this generalizes our NumberFormat implementation to operate on Value instances rather than doubles. All arithmetic is moved to static helpers that can now be updated with BigInt semantics.
This commit is contained in:
		
							parent
							
								
									4ba4e4c777
								
							
						
					
					
						commit
						a0253af8c1
					
				
					 7 changed files with 150 additions and 79 deletions
				
			
		|  | @ -50,8 +50,7 @@ ThrowCompletionOr<Value> NumberFormatFunction::call() | |||
| 
 | ||||
|     // 5. Return ? FormatNumeric(nf, x).
 | ||||
|     // Note: Our implementation of FormatNumeric does not throw.
 | ||||
|     auto formatted = format_numeric(m_number_format, value.as_double()); | ||||
| 
 | ||||
|     auto formatted = format_numeric(global_object, m_number_format, value); | ||||
|     return js_string(vm, move(formatted)); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy Flynn
						Timothy Flynn