Search code examples
mathfloating-pointfloating-point-precisionforth

How to divide two integers and get a result in float in Forth?


I am looking for a way to be able to translate between single precision and double precision. One example would be to divide 2 integers and get a floating result. How is that possible?


Solution

  • 10 7 
    
    SWAP  S>D D>F  S>D D>F  F/
    
    F.
    
    > 1.4285714  Ok
    

    see also: http://forth.sourceforge.net/std/dpans/dpans12.htm