B BCox5351 New Member Sep 4, 2011 #1 Does anyone have a way to extract the integer value from a decimal number? OshonSoft does not seem to have an Integer(x) function.
Does anyone have a way to extract the integer value from a decimal number? OshonSoft does not seem to have an Integer(x) function.
3v0 Coop Build Coordinator Forum Supporter Sep 4, 2011 #2 I do not use OshonSoft so if I get this wrong please correct me. Depends on what you want to do with the fractional part. Do you want to round or truncate ? You should be able to truncate by saying IntVar = decimalVar to round just add .5 to the decimalVar first Last edited: Sep 4, 2011
I do not use OshonSoft so if I get this wrong please correct me. Depends on what you want to do with the fractional part. Do you want to round or truncate ? You should be able to truncate by saying IntVar = decimalVar to round just add .5 to the decimalVar first
ericgibbs Well-Known Member Most Helpful Member Sep 4, 2011 #3 BCox5351 said: Does anyone have a way to extract the integer value from a decimal number? OshonSoft does not seem to have an Integer(x) function. Click to expand... Hi Can you post an example of the numbers you are working with.?? I may be able to suggest a simple work around.
BCox5351 said: Does anyone have a way to extract the integer value from a decimal number? OshonSoft does not seem to have an Integer(x) function. Click to expand... Hi Can you post an example of the numbers you are working with.?? I may be able to suggest a simple work around.
V valibb New Member Sep 5, 2011 #4 I found a trick or not Dim arg1 as Single Dim arg2 as Single 'decimal part from arg1 Dim arg3 as Long 'integer part from arg1 arg3 = arg1 Mod 0 arg2 = arg1 - arg3
I found a trick or not Dim arg1 as Single Dim arg2 as Single 'decimal part from arg1 Dim arg3 as Long 'integer part from arg1 arg3 = arg1 Mod 0 arg2 = arg1 - arg3
Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member Sep 5, 2011 #5 Mod can not be used on a single... However arg3 = arg1 is in fact the same as casting as arg3 will lose the floating point part Last edited: Sep 5, 2011
Mod can not be used on a single... However arg3 = arg1 is in fact the same as casting as arg3 will lose the floating point part