# Odd Even Crop Integer.bb

Post Reply
User avatar
Dutchman
Posts: 148
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

# Odd Even Crop Integer.bb

Post by Dutchman » Wed Nov 20, 2019 12:21 pm

# Odd Even Crop Integer.bb is a test and demo program for ! Math utils

Code: Select all

'Integer test on cropped number ratio
'by Ton Nillesen, October 2019
'
{/Extensions/Math/! Math utils} ' Include lib
OPTION TAB 15
D=0.5
PRINT "D =";D
PRINT "  I"," I/D","Math Odd+Even"
FOR i=-0.5 TO 0.5 STEP 0.1
  R=i/d   ' crop needed, else wrong result
  R=Math_Crop(i/d,9) ' trim mantissa to 9 significant digits
  PRINT i,r,MATh ODD(r)+MATH EVEN(r)
NEXT i
END
Output on console:
Screenshot.JPG
Screenshot.JPG (30.96 KiB) Viewed 63 times
UPDATES:
20191125
ODD and EVEN replaced by built-in MATH ODD and EVEN
Math_Crop() still needed
It is still a long way to go

Post Reply