Printing floating points
Bruce Carneal
bcarneal at gmail.com
Tue Jan 26 21:10:20 UTC 2021
On Tuesday, 26 January 2021 at 20:34:51 UTC, Ola Fosheim Grøstad
wrote:
> On Tuesday, 26 January 2021 at 20:27:25 UTC, Ola Fosheim
> Grøstad wrote:
>> For instance, for a converter from int to string, the most
>> likely failure point will be tied to crossing between "9" and
>> "0" as well as the ends of the base-2 input. Meaning, if it
>> works for 1,2,3, you know that it also works for 4,5,6,7,8,
>> but maybe not 9,10.
>
> Or to put it another way. If you can prove that these
> implication holds:
>
> 0-1 works => 2-8 works
> 0-11 works => 12-98 works
> 0-101 works => 102-998 works
> etc
> then you only need to test 9-11, 99-101.
I think this is a great way to go for simple functions. If the
domain ==> co-domain mapping is truly obvious then we can exploit
that to write an efficient unittest that we can take as the next
best thing to the simpler exhaustive proof.
I don't see a mapping for the current problem that would allow
for such efficient enumerative testing but it's not my field.
Still, if/when you prove that you've fully covered the domain I'd
be very excited to read about it. It could be a major advance.
Note: by "proof" I do not mean probabilistic evidence. We
already have that.
Even if you don't come up with proof, the attempt may be worth
your time. Good luck.
More information about the Digitalmars-d
mailing list