Replies: 2 comments 1 reply
-
I didn't add the Truncate function, but it is easy to write:
TW.WriteLine(Truncate(0.9))
TW.WriteLine(Truncate(-0.9))
' ------------------------------------------------
Function Truncate(n)
If n < 0 Then
Return Math.Ceiling(n)
Else
Return Math.Floor(n)
EndIf
EndFunction
Please don't forget to close this issue.
Thanks.
…________________________________
From: Drugo67 ***@***.***>
Sent: Sunday, October 20, 2024 3:55 PM
To: VBAndCs/sVB-Small-Visual-Basic ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [VBAndCs/sVB-Small-Visual-Basic] division without rimander (Discussion #92)
Hello again. I would need to do a division and keep only the integer without decimals. For example 12 / 13 = 0.923 but I only need to keep the 0. If I use math.round the division is approximated to 1 and the same goes with math.ceiling. in vb6 I did it with k = int(0.9) and the result was 0. In sVB I had to transform it into a string (text.tostr) and take the integer part with an "if then" checking character by character up to the decimal point and transform it back into an integer (text.tonumber). Isn't there something easier like it was in vb6?
—
Reply to this email directly, view it on GitHub<#92>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALQ5MVT2OYWQMF5N5MR624DZ4PHANAVCNFSM6AAAAABQIUJHCOVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGM2DGNRSGM>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
I also added the Math.Truncate method, and it will be available in the next release.
…________________________________
From: Drugo67 ***@***.***>
Sent: Monday, October 21, 2024 7:03 AM
To: VBAndCs/sVB-Small-Visual-Basic ***@***.***>
Cc: Mohammad Hamdy Ghanem ***@***.***>; Comment ***@***.***>
Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] division without rimander (Discussion #92)
Closed #92<#92> as resolved.
—
Reply to this email directly, view it on GitHub<#92>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALQ5MVXWZZ2NC6IEJDCU3S3Z4SRLNAVCNFSM6AAAAABQIUJHCOVHI2DSMVQWIX3LMV45UABFIRUXGY3VONZWS33OIV3GK3TUHI5E433UNFTGSY3BORUW63R3GE2TMMZXGA2Q>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello again. I would need to do a division and keep only the integer without decimals. For example 12 / 13 = 0.923 but I only need to keep the 0. If I use math.round the division is approximated to 1 and the same goes with math.ceiling. in vb6 I did it with k = int(0.9) and the result was 0. In sVB I had to transform it into a string (text.tostr) and take the integer part with an "if then" checking character by character up to the decimal point and transform it back into an integer (text.tonumber). Isn't there something easier like it was in vb6?
Beta Was this translation helpful? Give feedback.
All reactions