Get sqrt( square x + square y) without intermediate overflow or underflow in Java

Description

The following code shows how to get sqrt( square x + square y) without intermediate overflow or underflow.

Example


/*from   w  ww  .ja  va  2 s  .  co  m*/
public class Main {
  public static void main(String[] args) {
    System.out.println("hypot(y, z)= " 
        + Math.hypot(2, 3));
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Development »




Java Algorithms
Java Clipboard
Java Compiler
Java Desktop
Java Virtual Machine
Java Math
OS
Random
Java Robot
Java RuntimeMXBean
Java Timer
Java UUID
Java Internationalization