Repository navigation
AboutNumbers wrong types #474
Copy link
Copy link
Open
Labels
Issue-Bug 🐛Something's wrong!Something's wrong!
Description
Activity
Although your observation is correct, there is some obfuscation involved. Essentially "Long" is an alias for the underlying actual datatype.
Refer to this page on "Numeric Type Accelerators": https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_numeric_literals?view=powershell-7.3#numeric-type-accelerators
I would expect the-BeOfTypeparameter to handle this, and indeed it seems to on my install of PSKoans.- It's a legitimate issue. ```powershell ([int]::MaxValue + 200) -is [long] ``` is basically what Pester is doing. Both win PS and pwsh cause addition to yield a Double. Please may I ask what version of PS you're testing in Justin? And if you get True for the expression above (I get False because it does indeed yield a Double).…On Thu, 2 Mar 2023 at 15:47, Justin Warwick ***@***.***> wrote: Although your observation is correct, there is some obfuscation involved. Essentially "Long" is an alias for the underlying actual datatype. Refer to this page on "Numeric Type Accelerators": https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_numeric_literals?view=powershell-7.3#numeric-type-accelerators I would expect the -BeOfType parameter to handle this, and indeed it seems to on my install of PSKoans. — Reply to this email directly, view it on GitHub <#474 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADB3UDVB7MMYMNZQGK6FCA3W2C6JRANCNFSM6AAAAAATFZOL2M> . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
Metadata
Metadata
Assignees
Labels
Issue-Bug 🐛Something's wrong!Something's wrong!
Type
Projects
- StatusShow more project fieldsTodo
https://github.com/vexx32/PSKoans/blob/1317701a7d2bf6ca7efff0eb21d3a3d0478740e9/PSKoans/Koans/Introduction/AboutNumbers.Koans.ps1#L94-L99
Is this part correct about numbers getting converted to
longs?Because no matter, what I try for me it's always a
doubleCode:
Output:
Starting with a
shortand increasing it to >MaxValue behaves the same: