Jump to content

jchd

MVPs
  • Posts

    9,885
  • Joined

  • Last visited

  • Days Won

    114

jchd last won the day on May 17

jchd had the most liked content!

6 Followers

About jchd

  • Birthday 12/22/1954

Profile Information

  • Member Title
    Infinitely drawing infinity
  • Location
    South of France

Recent Profile Visitors

5,112 profile views

jchd's Achievements

  1. No, its a small greek letter phi (φ). I was also surprised it existed. Got that source from @Nine (above) but didn't correctly check. Code fixed.
  2. I'm always satisfied (I have close to zero use of AutoIt myself)! It's not for me, I did just clear up some dark corners in case you would be interested.
  3. For even more fun, here are more symbols and also indices available: Func _Exponent($s) Local Static $sInp = "()+-0123456789=AÆBDEƎGHIJKLMNOPRTUWabcdefghijklmnoprstuvwxyz" Local Static $sExp = "⁽⁾⁺⁻⁰¹²³⁴⁵⁶⁷⁸⁹⁼ᴬᴭᴮᴰᴱᴲᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁᵂᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻ" Local Static $mExp[] If UBound($mExp) = 0 Then For $i = 1 To StringLen($sInp) $mExp[StringMid($sInp, $i, 1)] = StringMid($sExp, $i, 1) Next EndIf Local $c For $i = 1 To StringLen($s) $c = StringMid($s, $i, 1) If MapExists($mExp, $c) Then $s = StringReplace($s, $c, $mExp[$c]) Next Return($s) EndFunc ;==>_Exponent Func _Indice($s) Local Static $sInp = "()+-0123456789=aehijklmnoprstuvx" Local Static $sInd = "₍₎₊₋₀₁₂₃₄₅₆₇₈₉₌ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓ" Local Static $mInd[] If UBound($mInd) = 0 Then For $i = 1 To StringLen($sInp) $mInd[StringMid($sInp, $i, 1)] = StringMid($sInd, $i, 1) Next EndIf Local $c For $i = 1 To StringLen($s) $c = StringMid($s, $i, 1) If MapExists($mInd, $c) Then $s = StringReplace($s, $c, $mInd[$c]) Next Return($s) EndFunc ;==>_Indice
  4. Which part(s) do you feel strange?
  5. Added more (all?) cases of infinities, indeterminates and clarified NANs (Not A Number) categories.
  6. If you need/want to characterize floats beyond just being of datatype "double", you can pick ideas from this code: Local $a = [ _ [0xfff0000000000000, "-infinity"], _ ; 1 11111111111 0000000000000000000000000000000000000000000000000000 ⎫ [0xffefffffffffffff, "smallest negative normal"], _ ; 1 11111111110 1111111111111111111111111111111111111111111111111111 ⎪ [0x8010000000000000, "largest negative normal"], _ ; 1 00000000001 0000000000000000000000000000000000000000000000000000 ⎪ [0x8000000000000000, "negative zero"], _ ; 1 00000000000 0000000000000000000000000000000000000000000000000000 ⎪ [0x0000000000000000, "positive zero"], _ ; 0 00000000000 0000000000000000000000000000000000000000000000000000 ⎬ Numbers you can deal with [0x0010000000000000, "smallest positive normal"], _ ; 0 00000000001 0000000000000000000000000000000000000000000000000000 ⎪ [0x7fefffffffffffff, "largest positive normal"], _ ; 0 11111111110 1111111111111111111111111111111111111111111111111111 ⎪ [0x7ff0000000000000, "+infinity"], _ ; 0 11111111111 0000000000000000000000000000000000000000000000000000 ⎭ [0x800fffffffffffff, "smallest negative denormal"], _ ; 1 00000000000 1111111111111111111111111111111111111111111111111111 ⎫ [0x8000000000000001, "largest negative denormal"], _ ; 1 00000000000 0000000000000000000000000000000000000000000000000001 ⎬ Numbers best avoided unless [0x0000000000000001, "smallest positive denormal"], _ ; 0 00000000000 0000000000000000000000000000000000000000000000000001 ⎪ dealing with extra-small values [0x000fffffffffffff, "largest positive denormal"], _ ; 0 00000000000 1111111111111111111111111111111111111111111111111111 ⎭ [0xfff8000000000001, "-NAN (quiet, denormal)"], _ ; 1 11111111111 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x >= 1 ⎫ [0xfff0000000000001, "-NAN (signaling, denormal)"], _ ; 1 11111111111 00xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x >= 1 ⎪ [0xfff4000000000001, "-NAN (signaling, normal)"], _ ; 1 11111111111 0100000000000000000000000000000000000000000000000000 ⎪ [0x7ff4000000000001, "+NAN (signaling, normal)"], _ ; 0 11111111111 0100000000000000000000000000000000000000000000000000 ⎬ You shouldn't get those [0x7ff8000000000001, "+NAN (quiet, denormal)"], _ ; 0 11111111111 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x >= 1 ⎪ [0x7ff0000000000001, "+NAN (signaling, denormal)"], _ ; 0 11111111111 00xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x >= 1 ⎭ [0xfff8000000000000, " NAN (indeterminate)"] _ ; 1 11111111111 1000000000000000000000000000000000000000000000000000 ◀ You made a big mistake ] ConsoleWrite("Ranges of double values" & @LF) Local $t = DllStructCreate("int64") Local $u = DllStructCreate("double", DllStructGetPtr($t)) Local $v For $n = 0 To UBound($a) - 1 DllStructSetData($t, 1, $a[$n][0]) $v = DllStructGetData($u, 1) ConsoleWrite(StringFormat("%s%23s\t%s\n", VarGetType($v), $v, $a[$n][1])) Next ConsoleWrite(@LF & "FP zeroes are signed !" & @LF) ConsoleWrite(" 0/3" & @TAB & (0/3) & @LF) ConsoleWrite("-0/-3" & @TAB & (-0/-3) & @LF) ConsoleWrite(" 0/-3" & @TAB & (0/-3) & @LF) ConsoleWrite("-0/3" & @TAB & (-0/3) & @LF) ConsoleWrite("Yet (hopefully)" & @LF) ConsoleWrite("0/-3 = 0/3" & @TAB & (0/-3 = 0/3) & @LF) ConsoleWrite("0/-3 = 0" & @TAB & (0/3 = 0) & @LF) ConsoleWrite(@LF & "Infinities compute (but if you get there, you are mostly stuck!)" & @LF) Local Const $PI = 3.141592653589793 ConsoleWrite("3/0" & @TAB & @TAB & (3/0) & @LF) ConsoleWrite("3/0 + 100" & @TAB & (3/0 + 100) & @LF) ConsoleWrite("(3/0) / 2" & @TAB & ((3/0) / 2) & @LF) ConsoleWrite("(3/0) ^ 2" & @TAB & ((3/0) ^ 2) & @LF) ConsoleWrite("-3/0" & @TAB & @TAB & (-3/0) & @LF) ConsoleWrite("-3/0 + 100" & @TAB & (-3/0 + 100) & @LF) ConsoleWrite("(-3/0) / 2" & @TAB & ((-3/0) / 2) & @LF) ConsoleWrite("(-3/0) ^ 2" & @TAB & ((-3/0) ^ 2) & @LF) ConsoleWrite("(-3/0) ^ 5" & @TAB & ((-3/0) ^ 5) & @LF) ConsoleWrite("Log(1/0)" & @TAB & Log(1/0) & @LF) ConsoleWrite("Exp(1/0)" & @TAB & Exp(1/0) & @LF) ConsoleWrite("Tan($Pi/2)" & @TAB & Tan($Pi/2) & @TAB & "<-- should be 'inf'" & @LF) ConsoleWrite("Tan(-$Pi/2)" & @TAB & Tan(-$Pi/2) & @TAB & "<-- should be '-inf'" & @LF) ConsoleWrite("ATan(1/0)" & @TAB & ATan(1/0) & @TAB & @TAB & "<-- Pi/2" & @LF) ConsoleWrite("ATan(-1/0)" & @TAB & ATan(-1/0) & @TAB & "<-- -Pi/2" & @LF) ConsoleWrite("1/(1/0)" & @TAB & @TAB & 1/(1/0) & @LF) ConsoleWrite("-1/(1/0)" & @TAB & -1/(1/0) & @LF) ConsoleWrite("1/(-1/0)" & @TAB & 1/(-1/0) & @LF) ConsoleWrite("-1/(-1/0)" & @TAB & -1/(-1/0) & @LF) ConsoleWrite("0^0)" & @TAB & @TAB & 0^0 & @TAB & @TAB & @TAB & "<-- NOT indeterminate in FP" & @LF) ConsoleWrite("(1/0)^0" & @TAB & @TAB & (1/0)^0 & @TAB & @TAB & @TAB & "<-- NOT indeterminate in FP" & @LF) ConsoleWrite(@LF & "Indeterminate forms" & @LF) Local $ind = [ _ ["0/0", 0/0], _ ["0*(1/0)", 0*(1/0)], _ ["0*(-1/0)", 0*(-1/0)], _ ["(1/0)-(1/0)", (1/0)-(1/0)], _ ["(-1/0)-(-1/0)", (-1/0)-(-1/0)], _ ["(1/0)+(-1/0)", (1/0)+(-1/0)], _ ["(-1/0)+(1/0)", (-1/0)+(1/0)], _ ["1^(1/0)", 1^(1/0)], _ ["1^(-1/0)", 1^(-1/0)], _ ["-1^(1/0)", -1^(1/0)], _ ["-1^(-1/0)", -1^(-1/0)], _ ["Cos(1/0)", Cos(1/0)], _ ["Sin(1/0)", Sin(1/0)], _ ["ACos(5)", ACos(5)], _ ["ASin(5)", ASin(5)], _ ["Sqrt(-1)", Sqrt(-1)], _ ["Log(-1)", Log(-1)] _ ] For $i = 0 To UBound($ind) - 1 ConsoleWrite(StringFormat("%-15s\t%s\t%f\n", $ind[$i][0], VarGetType($ind[$i][1]), $ind[$i][1])) Next ConsoleWrite(@LF & "NANs never compare !" & @LF) ConsoleWrite("0/0 > 0" & @TAB & @TAB & (0/0 > 0) & @LF) ConsoleWrite("0/0 = 0" & @TAB & @TAB & (0/0 = 0) & @LF) ConsoleWrite("0/0 < 0" & @TAB & @TAB & (0/0 < 0) & @LF) ConsoleWrite("0/0 > -0/0" & @TAB & (0/0 > -0/0) & @LF) ConsoleWrite("0/0 = -0/0" & @TAB & (0/0 = -0/0) & @LF) ConsoleWrite("0/0 < -0/0" & @TAB & (0/0 < -0/0) & @LF)
  7. You can add 3 AutoIt types: Keyword, Function and UserFunction. Also you can differentiate between Int32, Int64, Double and float signals.
  8. Thanks. Nitpick: if hours is a single digit, a preceding space is eaten. I seem to recall that H, M & S format is 2 digit in all cases. "2025-08-07 0:0:0" returns "2025-08-0712:0:0 AM" but should probably be "2025-08-07 12:00:00 AM" Not that I use AM/PM ridiculous convention. 24h format, like metric units, should be mandatory everywhere.
  9. If you dump the object you get, you can see it isn't an array: Object Name: SWbemObjectSet Description: A collection of Classes or Instances Associated file: C:\Windows\SysWOW64\wbem\wbemdisp.TLB Owner/marshaller: C:\WINDOWS\system32\wbem\wbemdisp.dll CLSID: {04B83D61-21AE-11D2-8B33-00600806D9B6} InterfaceID: {76A6415F-CB41-11D1-8B02-00600806D9B6} From AutoIt point of view, this is a flat variable, so UBound returns 0.
  10. Not confusing at all! Every AutoIt Is*() function tests the expression datatype and IsNumber is no exception. This works as well for Magritte's "La trahison des images", see https://en.wikipedia.org/wiki/The_Treachery_of_Images.
  11. Sorry folks, I didn't realize this was an old version of the code I use daily now.
  12. My fault: there was an extra $ there. CW is a function not a variable! $color = Chr(27) & '[31m' $CW($color & "some text" & @LF) Original post fixed. was correct!
  13. Well, this is openning a can of worms! Nowhere in the AutoIt specification of flags is mentionnend whether more than one occurence of a given flag is permitted or acted upon: is "%+++123.0f" the same as "%+123.0f". Seems easy to check in a few cases, but still without clear spec, we can't rely on that being innocuous. We do have a hint that more than one distinct flag is supported (albeit ignored) : If 0 and - appear, the 0 is ignored. the blank is ignored if both the blank and + flags appear. To provide a partial answer we need to test all combinations of flags. From "" to "-+*0#" (where * stands for a 0x20 whitespace for clarirty). Below is some code to do that and reveal that many flags combinations are not supported: ; There are 5 flag specifiers: '-', '+', '0', ' ', '#' in the StringFormat specification. ; If one assumes that a given flag may only appear once in the flags specification ; and given that more than one flag may be specified, the total numbers of flag strings ; is the power set of the set of flag specifiers. There are therefore 2^5 flag strings to ; test. ; This also assumes that the order of flags in a given flag string is irrelevant. ; ; It is easy to build that power set using binary mapping. Local $aFlags = ['-', '+', '0', ' ', '#'] Local $aFlagComb[2^5][2] Local $aComb2 For $i = 0 To 2^5 - 1 $aComb2 = StringSplit(StringFormat("%05s", _IntToString($i, 2)), "", $STR_NOCOUNT) For $j = 0 To 4 $aFlagComb[$i][0] &= ($aComb2[$j] = 1 ? $aFlags[$j] : "") Next Next For $i = 0 To UBound($aFlagComb) - 1 $aFlagComb[$i][1] = StringFormat("%" & $aFlagComb[$i][0] & "10.0f", 123) $aFlagComb[$i][0] = StringReplace($aFlagComb[$i][0], " ", "*") Next _ArrayDisplay($aFlagComb) Func _IntToString($i, $base = 16) Return DllCall("msvcrt.dll", "wstr:cdecl", "_i64tow", "int64", $i, "wstr", "", "int", $base)[0] EndFunc ;==>_IntToString It is also unclear whether the order of individual flags matter inside a given input. To fully answer this new question, one would need to create new entries in $FlagComb where the length of the flag string is > 1, split that string in individual characters and add new entries made from ArrayPermute. If you're cautious, also create new entries to cope with duplicate flags in various position(s) inside the flags strings to see if ever some rule emerges. Making a long answer short: both AI answers are incorrect. (My) conclusion: never trust a pile on unknown hardware fed with social networks toilet noises.
  14. Yes: you received a string of bytes (each UTF8 character is 1 to 4 bytes) which needs converting into UCS2 for AutoIt processing. No, it's a remnant of displaying the thing. My bad. In BinaryToString and StringToBinary, the part String refers to "native UCS2 AutoIt string", Binary refers to "string of bytes using this or that codepage". You may find clearer the code exemple found just before showing _StringToCodepage() and _CodepageToString() in that help text.
×
×
  • Create New...