How would I define a recursive function to find the biggest power of two less than an input number in VDM?
The function is as follows:
largest: N -> N
All I've got so far is:
largest(n) =
if n=1 then 0 
else if n=2 then 1 
else ... largest(...)
How would I define a recursive function to find the biggest power of two less than an input number in VDM?
The function is as follows:
largest: N -> N
All I've got so far is:
largest(n) =
if n=1 then 0 
else if n=2 then 1 
else ... largest(...)
Copyright © 2021 Jogjafile Inc.
                        
It would be something like "else one plus the largest of half this number". But since this looks suspiciously like an exercise, I'll let you work out the fine details.