useful constants

This commit is contained in:
~d6 2024-09-10 11:35:32 -04:00
parent 377cc5a30a
commit 0071604b2c
2 changed files with 32 additions and 0 deletions

View File

@ -46,6 +46,31 @@
%DENOM16 { #03e8 }
%DENOM32 { #0000 #03e8 }
( numerical constants )
( )
( to compute a constant, multiply the value you want )
( by 1000 and take its hex representation. )
( )
( example: python -c 'print(hex(round(13.5 * 1000)))' )
%x32-hundredth { #0000 #000a } ( 0.01 )
%x32-tenth { #0000 #0064 } ( 0.1 )
%x32-half { #0000 #01f4 } ( 0.5 )
%x32-one { #0000 #03e8 } ( 1.0 )
%x32-two { #0000 #07d0 } ( 2.0 )
%x32-three { #0000 #0bb8 } ( 3.0 )
%x32-four { #0000 #0fa0 } ( 4.0 )
%x32-five { #0000 #1388 } ( 5.0 )
%x32-ten { #0000 #2710 } ( 10.0 )
%x32-sqrt2 { #0000 #0586 } ( 1.414 ~ sqrt[2] )
%x32-sqrt3 { #0000 #06c4 } ( 1.732 ~ sqrt[3] )
%x32-e { #0000 #0a9e } ( 2.718 ~ e )
%x32-pi/2 { #0000 #0623 } ( 1.571 ~ pi/2 )
%x32-pi { #0000 #0c46 } ( 3.142 ~ pi )
%x32-3pi/2 { #0000 #1268 } ( 4.712 ~ 3pi/2 )
%x32-2pi { #0000 #188b } ( 6.283 ~ 2pi )
@x32-eq ( x/** y/** -> bool^ ) !u32-eq
@x32-ne ( x/** y/** -> bool^ ) !u32-ne

View File

@ -50,6 +50,13 @@
#0a18 DEO
#0000 #0001 x32-emit #0a18 DEO ( 0.001 )
#0000 #03e8 x32-emit #0a18 DEO ( 1.000 )
#0000 #0586 x32-emit #0a18 DEO ( 1.414 )
#0000 #0623 x32-emit #0a18 DEO ( 1.571 )
#0000 #06c4 x32-emit #0a18 DEO ( 1.732 )
#0000 #0a9e x32-emit #0a18 DEO ( 2.718 )
#0000 #0c46 x32-emit #0a18 DEO ( 3.142 )
#0000 #1268 x32-emit #0a18 DEO ( 4.712 )
#0000 #188b x32-emit #0a18 DEO ( 6.283 )
#0001 #0000 x32-emit #0a18 DEO ( 65.536 )
#0001 #e078 x32-emit #0a18 DEO ( 123.000 )
#0123 #4567 x32-emit #0a18 DEO ( 19088.743 )